<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic TranslateCoordinates to DCS .NET C#\VB in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/translatecoordinates-to-dcs-net-c-vb/m-p/9666564#M18843</link>
    <description>&lt;P&gt;Hello. I wanted to convert the coordinates of 2 points. I used this method once ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim point1DCS() As Double = AcadApp.ActiveDocument.Utility.TranslateCoordinates(pt1, AcCoordinateSystem.acWorld, AcCoordinateSystem.acDisplayDCS, False)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone know how to get this effect in NET API?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 31 Jul 2020 15:23:37 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-07-31T15:23:37Z</dc:date>
    <item>
      <title>TranslateCoordinates to DCS .NET C#\VB</title>
      <link>https://forums.autodesk.com/t5/net-forum/translatecoordinates-to-dcs-net-c-vb/m-p/9666564#M18843</link>
      <description>&lt;P&gt;Hello. I wanted to convert the coordinates of 2 points. I used this method once ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim point1DCS() As Double = AcadApp.ActiveDocument.Utility.TranslateCoordinates(pt1, AcCoordinateSystem.acWorld, AcCoordinateSystem.acDisplayDCS, False)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone know how to get this effect in NET API?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 15:23:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/translatecoordinates-to-dcs-net-c-vb/m-p/9666564#M18843</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-07-31T15:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: TranslateCoordinates to DCS .NET C#\VB</title>
      <link>https://forums.autodesk.com/t5/net-forum/translatecoordinates-to-dcs-net-c-vb/m-p/9666575#M18844</link>
      <description>&lt;P&gt;You can still use that if you reference the ActiveX api using Autodesk.AutoCAD.Interop&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 15:28:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/translatecoordinates-to-dcs-net-c-vb/m-p/9666575#M18844</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2020-07-31T15:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: TranslateCoordinates to DCS .NET C#\VB</title>
      <link>https://forums.autodesk.com/t5/net-forum/translatecoordinates-to-dcs-net-c-vb/m-p/9666607#M18845</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With plain .NET, you can use the following extension methods.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dim point1DCS() As Double = AcadApp.ActiveDocument.Utility.TranslateCoordinates(pt1, AcCoordinateSystem.acWorld, AcCoordinateSystem.acDisplayDCS, False)&lt;/P&gt;
&lt;P&gt;would be:&lt;/P&gt;
&lt;P&gt;Point3d point1DCS = pt1.TransformBy(ed.WCS2DCS());&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using System;

namespace AutoCadUtilsLibrary
{
    public static class Extension
    {
        public static Matrix3d EyeToWorld(this AbstractViewTableRecord view)
        {
            if (view == null)
                throw new ArgumentNullException("view");
            return
                Matrix3d.Rotation(-view.ViewTwist, view.ViewDirection, view.Target) *
                Matrix3d.Displacement(view.Target.GetAsVector()) *
                Matrix3d.PlaneToWorld(view.ViewDirection);
        }

        public static Matrix3d WorldToEye(this AbstractViewTableRecord view)
        {
            if (view == null)
                throw new ArgumentNullException("view");
            return
                Matrix3d.WorldToPlane(view.ViewDirection) *
                Matrix3d.Displacement(view.Target.GetAsVector().Negate()) *
                Matrix3d.Rotation(view.ViewTwist, view.ViewDirection, view.Target);
        }

        public static Matrix3d DCS2WCS(this Editor ed)
        {
            if (ed == null)
                throw new ArgumentNullException("ed");
            using (ViewTableRecord view = ed.GetCurrentView())
            {
                return view.EyeToWorld();
            }
        }
        public static Matrix3d WCS2DCS(this Editor ed)
        {
            if (ed == null)
                throw new ArgumentNullException("ed");
            using (ViewTableRecord view = ed.GetCurrentView())
            {
                return view.WorldToEye();
            }
        }
    }
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 15:50:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/translatecoordinates-to-dcs-net-c-vb/m-p/9666607#M18845</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2020-07-31T15:50:53Z</dc:date>
    </item>
  </channel>
</rss>

