<?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 Betreff: Problem with VieTableRecord CenterPoint vs Target in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/problem-with-vietablerecord-centerpoint-vs-target/m-p/12650060#M4986</link>
    <description>&lt;P&gt;sorry i forgotten the files&lt;/P&gt;</description>
    <pubDate>Tue, 19 Mar 2024 07:57:22 GMT</pubDate>
    <dc:creator>mario.rosenbohm</dc:creator>
    <dc:date>2024-03-19T07:57:22Z</dc:date>
    <item>
      <title>Problem with VieTableRecord CenterPoint vs Target</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-with-vietablerecord-centerpoint-vs-target/m-p/12647277#M4981</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have a big problem with th ViewTableRecord.&lt;/P&gt;&lt;P&gt;From this i will read the coordinate from current view rectangle for build the search frame.&lt;/P&gt;&lt;P&gt;I habe two dwg's both i view Width ~5800 hand Height ~2400, both ViewOrthographic is TopView and all other relevant Properties are equal.&lt;/P&gt;&lt;P&gt;On first dwg is the Target (0,0,0) and the CenterPoint (2659.5,1429.4) get the coordinate from real center.&lt;/P&gt;&lt;P&gt;On the second dwg is the Target (4432100,5612220,0) and the CenterPoint (2192.7,1215.0). Here get the Target the real center.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why it is?&lt;/P&gt;&lt;P&gt;How can i detect whether CenterPoint or Target take the real Center?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards Mario&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2024 07:45:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-with-vietablerecord-centerpoint-vs-target/m-p/12647277#M4981</guid>
      <dc:creator>mario.rosenbohm</dc:creator>
      <dc:date>2024-03-18T07:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with VieTableRecord CenterPoint vs Target</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-with-vietablerecord-centerpoint-vs-target/m-p/12647351#M4982</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm not sure to understand what you mean with "real Center".&lt;/P&gt;
&lt;P&gt;You have to keep in mind the view Target is a WCS 3d point and the view centerPoint is a DCS 2d point.&lt;/P&gt;
&lt;P&gt;You can use these extension methods adapted from &lt;A href="https://github.com/gileCAD/GeometryExtensions" target="_blank" rel="noopener"&gt;this library&lt;/A&gt; to transform points.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;/// &amp;lt;summary&amp;gt;
    /// Provides extension for the AbstractViewTableRecord type.
    /// &amp;lt;/summary&amp;gt;
    public static class AbstractViewTableRecordExtension
    {
        /// &amp;lt;summary&amp;gt;
        /// Gets the transformation matrix from the view Display Coordinate System (DCS) to World Coordinate System (WCS).
        /// &amp;lt;/summary&amp;gt;
        /// &amp;lt;param name="view"&amp;gt;Instance to which the method applies.&amp;lt;/param&amp;gt;
        /// &amp;lt;returns&amp;gt;The DCS to WCS transformation matrix.&amp;lt;/returns&amp;gt;
        /// &amp;lt;exception cref="System.ArgumentNullException"&amp;gt;Thrown if &amp;lt;paramref name ="view"/&amp;gt; is null.&amp;lt;/exception&amp;gt;
        public static Matrix3d EyeToWorld(this AbstractViewTableRecord view)
        {
            if (view is null) throw new System.ArgumentNullException(nameof (view));

            return
                Matrix3d.Rotation(-view.ViewTwist, view.ViewDirection, view.Target) *
                Matrix3d.Displacement(view.Target.GetAsVector()) *
                Matrix3d.PlaneToWorld(view.ViewDirection);
        }

        /// &amp;lt;summary&amp;gt;
        /// Gets the transformation matrix from World Coordinate System (WCS) to the view Display Coordinate System (DCS).
        /// &amp;lt;/summary&amp;gt;
        /// &amp;lt;param name="view"&amp;gt;Instance to which the method applies.&amp;lt;/param&amp;gt;
        /// &amp;lt;returns&amp;gt;The WCS to DCS transformation matrix.&amp;lt;/returns&amp;gt;
        /// &amp;lt;exception cref="System.ArgumentNullException"&amp;gt;Thrown if &amp;lt;paramref name ="view"/&amp;gt; is null.&amp;lt;/exception&amp;gt;
        public static Matrix3d WorldToEye(this AbstractViewTableRecord view)
        {
            if (view is null) throw new System.ArgumentNullException(nameof (view));

            return
                Matrix3d.WorldToPlane(view.ViewDirection) *
                Matrix3d.Displacement(view.Target.GetAsVector().Negate()) *
                Matrix3d.Rotation(view.ViewTwist, view.ViewDirection, view.Target);
        }
    }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 14:18:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-with-vietablerecord-centerpoint-vs-target/m-p/12647351#M4982</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2024-03-19T14:18:38Z</dc:date>
    </item>
    <item>
      <title>Betreff: Problem with VieTableRecord CenterPoint vs Target</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-with-vietablerecord-centerpoint-vs-target/m-p/12648027#M4983</link>
      <description>&lt;P&gt;Hello Gilles,&lt;BR /&gt;&lt;BR /&gt;yes i know and i use the functions to transform the viewpoint coordinates. In (first) test.dwg is the left bottom viewcorner (-158.8,217.8) the ViewPort.Centerpoint considered this displacement. But the matrix as result of function is identity matrix!?&amp;nbsp; Viewport.Target is 0,0,0!?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards Mario&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2024 13:33:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-with-vietablerecord-centerpoint-vs-target/m-p/12648027#M4983</guid>
      <dc:creator>mario.rosenbohm</dc:creator>
      <dc:date>2024-03-18T13:33:41Z</dc:date>
    </item>
    <item>
      <title>Betreff: Problem with VieTableRecord CenterPoint vs Target</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-with-vietablerecord-centerpoint-vs-target/m-p/12648367#M4984</link>
      <description>&lt;P&gt;This should work:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;var ed = Application.DocumentManager.MdiActiveDocument.Editor;
using (var view = ed.GetCurrentView())
{
    var viewCenterPoint = view.CenterPoint;
    var wcsCenterPoint = new Point3d(viewCenterPoint.X, viewCenterPoint.Y, 0.0).TransformBy(view.EyeToWorld());
}&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 18 Mar 2024 15:27:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-with-vietablerecord-centerpoint-vs-target/m-p/12648367#M4984</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2024-03-18T15:27:40Z</dc:date>
    </item>
    <item>
      <title>Betreff: Problem with VieTableRecord CenterPoint vs Target</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-with-vietablerecord-centerpoint-vs-target/m-p/12650058#M4985</link>
      <description>&lt;P&gt;Hello Gilles,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;okay, for the test.dwg it works.&lt;/P&gt;&lt;P&gt;I have two another dwg files test2.dwg and test3.dwg on both is the "real centerpoint" on (32439596.0, 5967780.0).&lt;/P&gt;&lt;P&gt;On test2.dwg (is only test.dwg with 'moveto') it the sam ViewPort as test.dwg (CenterPoint = (32439596.0, 5967780.0,0) and Target = (0,0,0)&lt;/P&gt;&lt;P&gt;"test3.dwg" is 'wblock' from my working-dwg, this has no civil-elements, has no coordinate system, is create from plain autocad-template. On this dwg is the ViewPort CenterPoint=(27697465.988,356748.777) and Target=(4742130.012,5611031.223,0.0).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What ist the function of Target and CenterPoint?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 07:56:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-with-vietablerecord-centerpoint-vs-target/m-p/12650058#M4985</guid>
      <dc:creator>mario.rosenbohm</dc:creator>
      <dc:date>2024-03-19T07:56:12Z</dc:date>
    </item>
    <item>
      <title>Betreff: Problem with VieTableRecord CenterPoint vs Target</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-with-vietablerecord-centerpoint-vs-target/m-p/12650060#M4986</link>
      <description>&lt;P&gt;sorry i forgotten the files&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 07:57:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-with-vietablerecord-centerpoint-vs-target/m-p/12650060#M4986</guid>
      <dc:creator>mario.rosenbohm</dc:creator>
      <dc:date>2024-03-19T07:57:22Z</dc:date>
    </item>
    <item>
      <title>Betreff: Problem with VieTableRecord CenterPoint vs Target</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-with-vietablerecord-centerpoint-vs-target/m-p/12650095#M4987</link>
      <description>&lt;P&gt;I use the CenterPoint as startpoint for transformation and the target as displacement.&lt;BR /&gt;I hope thats right &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 08:17:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-with-vietablerecord-centerpoint-vs-target/m-p/12650095#M4987</guid>
      <dc:creator>mario.rosenbohm</dc:creator>
      <dc:date>2024-03-19T08:17:09Z</dc:date>
    </item>
    <item>
      <title>Betreff: Problem with VieTableRecord CenterPoint vs Target</title>
      <link>https://forums.autodesk.com/t5/net-forum/problem-with-vietablerecord-centerpoint-vs-target/m-p/12650977#M4988</link>
      <description>&lt;P&gt;Sorry, I'm afraid to not fully understand what you want to do.&lt;/P&gt;
&lt;P&gt;The following TEST command, computes the current viewport center using &lt;A href="https://forums.autodesk.com/t5/net/problem-with-vietablerecord-centerpoint-vs-target/m-p/12647351/highlight/true#M81100" target="_blank" rel="noopener"&gt;the upper extension methods&lt;/A&gt; and draws a temporary red cross on this point. From the tests I did it works whatever the curent view (even 3d orbited).&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;        public void Test()
        {
            var ed = Application.DocumentManager.MdiActiveDocument.Editor;
            using (var view = ed.GetCurrentView())
            {
                var viewCenterPoint = view.CenterPoint;
                var wcsCenterPoint = new Point3d(viewCenterPoint.X, viewCenterPoint.Y, 0.0).TransformBy(view.EyeToWorld());
                double d = view.Height / 50.0;
                using (var resbuf = new ResultBuffer
                {
                    new TypedValue(5003, 1),
                    new TypedValue(5002, new Point2d(wcsCenterPoint.X - d, wcsCenterPoint.Y - d)),
                    new TypedValue(5002, new Point2d(wcsCenterPoint.X + d, wcsCenterPoint.Y + d)),
                    new TypedValue(5002, new Point2d(wcsCenterPoint.X - d, wcsCenterPoint.Y + d)),
                    new TypedValue(5002, new Point2d(wcsCenterPoint.X + d, wcsCenterPoint.Y - d))
                })
                    ed.DrawVectors(resbuf, Matrix3d.Identity);
            }
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 19 Mar 2024 14:25:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/problem-with-vietablerecord-centerpoint-vs-target/m-p/12650977#M4988</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2024-03-19T14:25:39Z</dc:date>
    </item>
  </channel>
</rss>

