<?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: A problem with transforming an existing Viewport in paperspace in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/a-problem-with-transforming-an-existing-viewport-in-paperspace/m-p/6204032#M36871</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you try to rotate the polyline before using it to create the viewport ?&lt;/P&gt;</description>
    <pubDate>Tue, 08 Mar 2016 07:28:15 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2016-03-08T07:28:15Z</dc:date>
    <item>
      <title>A problem with transforming an existing Viewport in paperspace</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-problem-with-transforming-an-existing-viewport-in-paperspace/m-p/6203845#M36868</link>
      <description>&lt;P&gt;Hello all,&lt;BR /&gt;I am having a slight problem in my C# NET code and I am hoping someone can point me in the right direction.&lt;BR /&gt;So far I have successfully written code to take a polyline from modelspace and use it to create a clipped viewport of the area in a new layout.&lt;BR /&gt;My problem arises when I try to rotate this viewport afterwards (if it is taller than it is wide).&lt;BR /&gt;&lt;BR /&gt;Here is a snippet of the code after I have opened the viewport for write within the transaction...&lt;BR /&gt;note: 'pl' is a polyline in paper space that has been scaled from the original polyline in modelspace&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;                Viewport acVport = (Viewport)vpId.GetObject(OpenMode.ForWrite, true);

                Point3d centerPoint = pl.Center();

                acVport.Width = pl.Bounds.Value.MaxPoint.X - pl.Bounds.Value.MinPoint.X;
                acVport.Height = pl.Bounds.Value.MaxPoint.Y - pl.Bounds.Value.MinPoint.Y;

                Point2d a = new Point2d(acVport.Bounds.Value.MaxPoint.X, acVport.Bounds.Value.MaxPoint.Y);
                Point2d b = new Point2d(acVport.Bounds.Value.MinPoint.X, acVport.Bounds.Value.MinPoint.Y);

                Point2d pSpaceVpCenter = (a.Add(b)) / 2.0;
                
                acVport.ViewDirection = new Vector3d(0, 0, 1);
                acVport.CenterPoint = new Point3d(centerPoint.X, centerPoint.Y, 0);
                acVport.CustomScale = 0.01;
                pl.TransformBy(Matrix3d.Displacement(pSpaceDisplacementVector));
                acBlkTblRec.AppendEntity(pl);
                acTrans.AddNewlyCreatedDBObject(pl, true);
  
                acVport.NonRectClipEntityId = pl.ObjectId;
                acVport.NonRectClipOn = true;
                acVport.ViewCenter = new Point2d(modelCenter.X, modelCenter.Y);

                bool landscapeOriented = (acVport.Bounds.Value.MaxPoint.X - acVport.Bounds.Value.MinPoint.X) &amp;gt;= (acVport.Bounds.Value.MaxPoint.Y - acVport.Bounds.Value.MinPoint.Y);

                if (!landscapeOriented)
                {
                    &lt;FONT color="#800080"&gt;acDoc.Editor.WriteMessage("Rotating Viewport... (90 deg CC)\n");
                    Matrix3d acMat3d = Matrix3d.Rotation(Math.PI / 2.0, Vector3d.ZAxis, acVport.Bounds.Value.MinPoint);
                    // rotate 90 degrees (counter clockwise)
                    
                    acVport.TransformBy(acMat3d);&lt;/FONT&gt;
                }
                
                acTrans.Commit();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Everything works as desired except for the final transformation (the 90 degree rotation). The editor does spit out the message "Rotating Viewport... (90 deg CC)", so I know the block is being executed. Does anyone know why this transformation is not actually happening to the paper-space viewport? Any advice is greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2016 03:59:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-problem-with-transforming-an-existing-viewport-in-paperspace/m-p/6203845#M36868</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-08T03:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: A problem with transforming an existing Viewport in paperspace</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-problem-with-transforming-an-existing-viewport-in-paperspace/m-p/6203902#M36869</link>
      <description>&lt;P&gt;&lt;BR /&gt;EDIT: I realize that I need to transform the polyline that acts as the non-rectangular clip, but I am not sure how to apply this transformation without messing up the viewport. (I want to rotate them both at the same time, so that NORTH appears WEST in paperspace but the region that the viewport represents is not altered).&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2016 04:43:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-problem-with-transforming-an-existing-viewport-in-paperspace/m-p/6203902#M36869</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-08T04:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: A problem with transforming an existing Viewport in paperspace</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-problem-with-transforming-an-existing-viewport-in-paperspace/m-p/6203998#M36870</link>
      <description>&lt;P&gt;UPDATE: I've also attempted to achieve rotation by calling acVport.SetUcs() to change the x and y axes, but I've been unable to get the UCS to change from 'world'. I also tried setting acVport.UcsPerViewport to true before setting the UCS. I appreciate any attempt to resolve my confusion!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2016 07:03:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-problem-with-transforming-an-existing-viewport-in-paperspace/m-p/6203998#M36870</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-08T07:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: A problem with transforming an existing Viewport in paperspace</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-problem-with-transforming-an-existing-viewport-in-paperspace/m-p/6204032#M36871</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you try to rotate the polyline before using it to create the viewport ?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2016 07:28:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-problem-with-transforming-an-existing-viewport-in-paperspace/m-p/6204032#M36871</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2016-03-08T07:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: A problem with transforming an existing Viewport in paperspace</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-problem-with-transforming-an-existing-viewport-in-paperspace/m-p/6204237#M36872</link>
      <description>_gile hello and thank you for your response! I did try to rotate the polyline before doing the viewport clip, in which case I got the shape I wanted but was still unable to reorient the view. I tried setting the ucs with the acVport.SetUcs method</description>
      <pubDate>Tue, 08 Mar 2016 10:18:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-problem-with-transforming-an-existing-viewport-in-paperspace/m-p/6204237#M36872</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-08T10:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: A problem with transforming an existing Viewport in paperspace</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-problem-with-transforming-an-existing-viewport-in-paperspace/m-p/6204311#M36873</link>
      <description>&lt;P&gt;Did you try to change the Viewport.TwistAngle value ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;double rotation = -Math.PI / 2.0;
viewport.TwistAngle += rotation;
viewport.ViewCenter = viewport.ViewCenter.TransformBy(Matrix2d.Rotation(rotation, Point2d.Origin));&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2016 11:44:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-problem-with-transforming-an-existing-viewport-in-paperspace/m-p/6204311#M36873</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2016-03-08T11:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: A problem with transforming an existing Viewport in paperspace</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-problem-with-transforming-an-existing-viewport-in-paperspace/m-p/6204942#M36874</link>
      <description>&lt;P&gt;Thank you, _gile! I was unaware of the TwistAngle property, you have solved my problem!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2016 16:57:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-problem-with-transforming-an-existing-viewport-in-paperspace/m-p/6204942#M36874</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-08T16:57:08Z</dc:date>
    </item>
  </channel>
</rss>

