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

Change initial view port size in paper space

4 REPLIES 4
Reply
Message 1 of 5
dynamicscope
1607 Views, 4 Replies

Change initial view port size in paper space

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.

 

2013-06-27 18;03;10.PNG

 

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.

4 REPLIES 4
Message 2 of 5

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

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
Message 3 of 5

Awesome!!
I can tweak a little bit and use it.

Now I am wondering what the dotted border is??
Is it possible to get the width and height of the dotted border??
Message 4 of 5
dynamicscope
in reply to: dynamicscope

Oh, it was the PlotPaperMargins...
I did this and achieved what I wanted!!

vp.Width = layoutObj.PlotPaperSize.Y - (layoutObj.PlotPaperMargins.MinPoint.Y * 2);
vp.Height = layoutObj.PlotPaperSize.X - (layoutObj.PlotPaperMargins.MinPoint.X * 2);
Message 5 of 5

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.

 

2013-07-04 16;19;51.PNG

 

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...

 

2013-07-04 16;21;11.PNG

 

However, after I create a new drawing and do the exactly same procedure....

I get....

 

2013-07-04 16;22;10.PNG

 

Note, PlotPaperSize : 279, 215

But Viewport #2 : 8, 6

 

As a result if I run the same code as above...

I get...

 

2013-07-04 16;23;06.PNG

 

.....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.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost