.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Paperspace Paper Shadow

1 REPLY 1
Reply
Message 1 of 2
Anonymous
415 Views, 1 Reply

Paperspace Paper Shadow

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.

1 REPLY 1
Message 2 of 2
_gile
in reply to: Anonymous

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta