Paperspace Paper Shadow

Paperspace Paper Shadow

Anonymous
Not applicable
557 Views
1 Reply
Message 1 of 2

Paperspace Paper Shadow

Anonymous
Not applicable

Is there a way to re-align the paper shadow in Paperspace in code? I've created viewports that are 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.

I've tried re-applying the page setup in code but it doesn't reproduce the same effect.

0 Likes
558 Views
1 Reply
Reply (1)
Message 2 of 2

_gile
Consultant
Consultant

Hi,

 

What about doing things in the reverse order.

Typically we define the page setup first so that we can get the paper size and the paper margins to create the viewport.

 

Here's a little snippet which shows how to create a viewport (as the 'Fit' option of the _MVIEW command).

 

        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;
        }


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes