<?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: Paperspace Paper Shadow in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/paperspace-paper-shadow/m-p/8217254#M24950</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What about doing things in the reverse order.&lt;/P&gt;
&lt;P&gt;Typically we define the page setup first so that we can get the paper size and the paper margins to create the viewport.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a little snippet which shows how to create a viewport (as the 'Fit' option of the _MVIEW command).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        private static Viewport CreateFitViewport(Transaction tr, Layout layout)
        {
            Point2d
                minPt = layout.PlotPaperMargins.MinPoint,
                maxPt = layout.PlotPaperMargins.MaxPoint,
                pSize = layout.PlotPaperSize;
            double width, height;
            if ((int)layout.PlotRotation % 2 == 0)
            {
                width = pSize.X - maxPt.X - minPt.X;
                height = pSize.Y - maxPt.Y - minPt.Y;
            }
            else
            {
                width = pSize.Y - maxPt.Y - minPt.Y;
                height = pSize.X - maxPt.X - minPt.X;
            }
            
            var btr = (BlockTableRecord)tr.GetObject(layout.BlockTableRecordId, OpenMode.ForWrite);
            var viewport = new Viewport();
            viewport.Width = width;
            viewport.Height = height;
            viewport.CenterPoint = new Point3d(width / 2.0, height / 2.0, 0.0);
            btr.AppendEntity(viewport);
            tr.AddNewlyCreatedDBObject(viewport, true);
            return viewport;
        }&lt;/PRE&gt;</description>
    <pubDate>Wed, 22 Aug 2018 16:38:46 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2018-08-22T16:38:46Z</dc:date>
    <item>
      <title>Paperspace Paper Shadow</title>
      <link>https://forums.autodesk.com/t5/net-forum/paperspace-paper-shadow/m-p/8216966#M24949</link>
      <description>&lt;P&gt;Is there a way to re-align the paper shadow in Paperspace in code? I've created viewports that are&amp;nbsp;larger than the paper outline and usually I can just re-apply the page layout and the paper outline would just move to the extents of the viewport.&lt;/P&gt;&lt;P&gt;I've tried re-applying the page setup in code but it doesn't reproduce the same effect.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 14:59:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/paperspace-paper-shadow/m-p/8216966#M24949</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-22T14:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Paperspace Paper Shadow</title>
      <link>https://forums.autodesk.com/t5/net-forum/paperspace-paper-shadow/m-p/8217254#M24950</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What about doing things in the reverse order.&lt;/P&gt;
&lt;P&gt;Typically we define the page setup first so that we can get the paper size and the paper margins to create the viewport.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a little snippet which shows how to create a viewport (as the 'Fit' option of the _MVIEW command).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        private static Viewport CreateFitViewport(Transaction tr, Layout layout)
        {
            Point2d
                minPt = layout.PlotPaperMargins.MinPoint,
                maxPt = layout.PlotPaperMargins.MaxPoint,
                pSize = layout.PlotPaperSize;
            double width, height;
            if ((int)layout.PlotRotation % 2 == 0)
            {
                width = pSize.X - maxPt.X - minPt.X;
                height = pSize.Y - maxPt.Y - minPt.Y;
            }
            else
            {
                width = pSize.Y - maxPt.Y - minPt.Y;
                height = pSize.X - maxPt.X - minPt.X;
            }
            
            var btr = (BlockTableRecord)tr.GetObject(layout.BlockTableRecordId, OpenMode.ForWrite);
            var viewport = new Viewport();
            viewport.Width = width;
            viewport.Height = height;
            viewport.CenterPoint = new Point3d(width / 2.0, height / 2.0, 0.0);
            btr.AppendEntity(viewport);
            tr.AddNewlyCreatedDBObject(viewport, true);
            return viewport;
        }&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Aug 2018 16:38:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/paperspace-paper-shadow/m-p/8217254#M24950</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-08-22T16:38:46Z</dc:date>
    </item>
  </channel>
</rss>

