<?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 Re: Create Named View from object in UCS in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/create-named-view-from-object-in-ucs/m-p/11217053#M12764</link>
    <description>&lt;P&gt;Anyone has an idea on how to do it? I couldn't solve it yet...&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jun 2022 13:22:40 GMT</pubDate>
    <dc:creator>ediloreto8W6MG</dc:creator>
    <dc:date>2022-06-06T13:22:40Z</dc:date>
    <item>
      <title>Create Named View from object in UCS</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-named-view-from-object-in-ucs/m-p/11205626#M12763</link>
      <description>&lt;P&gt;I'm trying to create named views from objects (for example a rectangle). Right now I'm using the object extends to get the view's centerpoint, widht and height using the following code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public static ViewTableRecord CreateFromEntity(Entity entity)
        {
            ViewTableRecord viewTableRecord = new ViewTableRecord();
            AssignEntityCoords(entity, ref viewTableRecord);

            return viewTableRecord;
        }


private static void AssignEntityCoords(Entity entity, ref ViewTableRecord viewTableRecord)
        {
            Extents3d ext = entity.GeometricExtents;

            Point2d centerPoint = new Point2d((ext.MinPoint.X + ext.MaxPoint.X) * 0.5, (ext.MinPoint.Y + ext.MaxPoint.Y) * 0.5);
            double width = Math.Abs(ext.MinPoint.X - ext.MaxPoint.X);
            double height = Math.Abs(ext.MinPoint.Y - ext.MaxPoint.Y);

            viewTableRecord.CenterPoint = centerPoint;
            viewTableRecord.Width = width;
            viewTableRecord.Height = height;

        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is working great when using the WCS, but if I have a rotated rectangle the view is created like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="aCZxErGWzc.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1074285i71625ADCAD1A1CCA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="aCZxErGWzc.png" alt="aCZxErGWzc.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried applying trasformation to the entity before creating the view but didnt get any luck:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Matrix3d transf = Editor.CurrentUserCoordinateSystem; // Using a UCS
Entity newEntity = entity.GetTransformedCopy(transf);
ViewTableRecord view = CreateFromEntity(newEntity);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In short, I am trying to make a view that aligns with UCS. This can be done easily from the view manager but it becomes tedious to make many views.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2022 17:58:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-named-view-from-object-in-ucs/m-p/11205626#M12763</guid>
      <dc:creator>ediloreto8W6MG</dc:creator>
      <dc:date>2022-05-31T17:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Create Named View from object in UCS</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-named-view-from-object-in-ucs/m-p/11217053#M12764</link>
      <description>&lt;P&gt;Anyone has an idea on how to do it? I couldn't solve it yet...&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 13:22:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-named-view-from-object-in-ucs/m-p/11217053#M12764</guid>
      <dc:creator>ediloreto8W6MG</dc:creator>
      <dc:date>2022-06-06T13:22:40Z</dc:date>
    </item>
  </channel>
</rss>

