When I first draw something on a model space and click the Layout1 tab to see paper space.
The default view port size (the red box) looks like the following.
But I want to maximize the view port size such that (for example) the dotted line to be the defualt view port size in the paper space.
Could I do this by code??
I am currently using ObjectARX 2007 in C#.
Thank you in advance.
You would need to access the Viewport on the Layout, then set its Height and Width
This post show how to access the viewport, just change the end of the code to adjust the height and width: http://adndevblog.typepad.com/autocad/2012/08/changing-zoom-in-paperspace-viewport.html
Actually... It doesn't quite work.
It only works once.
For example...
I run the AutoCAD and draw a circle and change the layout to Paperspace.
If you look at the command box,
PlotPaperSize : 297, 210
Viewport #2 : 205.6 156
so if I run below code....
... // set the viewport parameters if (vp.Number == 2) { vp.UpgradeOpen(); double width = layoutObj.PlotPaperSize.Y - (layoutObj.PlotPaperMargins.MinPoint.Y * 2); double height = layoutObj.PlotPaperSize.X - (layoutObj.PlotPaperMargins.MinPoint.X * 2); vp.Width = width; vp.Height = height; // set the view height - adjusted by 1% vp.ViewHeight = mHeight * 1.01; // set the view center vp.ViewCenter = mCentPt; vp.Visible = true; vp.On = true; vp.UpdateDisplay(); ed.SwitchToModelSpace(); Application.SetSystemVariable("CVPORT", vp.Number); } ...
I get what I want...
However, after I create a new drawing and do the exactly same procedure....
I get....
Note, PlotPaperSize : 279, 215
But Viewport #2 : 8, 6
As a result if I run the same code as above...
I get...
.....this....
Does this mean that the white space size is not PlotPaperSize????
What could have been gone wrong?
😞
Can't find what you're looking for? Ask the community or share your knowledge.