.NET

Reply
Valued Contributor
dynamicscope
Posts: 95
Registered: ‎04-04-2012
Message 1 of 5 (601 Views)

Change initial view port size in paper space

601 Views, 4 Replies
06-27-2013 02:20 AM

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.

ADN Support Specialist
augusto.goncalves
Posts: 312
Registered: ‎04-30-2009
Message 2 of 5 (552 Views)

Re: Change initial view port size in paper space

07-03-2013 06:47 AM in reply to: dynamicscope

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
Autodesk Developer Network
Valued Contributor
dynamicscope
Posts: 95
Registered: ‎04-04-2012
Message 3 of 5 (536 Views)

Re: Change initial view port size in paper space

07-03-2013 06:55 PM in reply to: augusto.goncalves
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??
Valued Contributor
dynamicscope
Posts: 95
Registered: ‎04-04-2012
Message 4 of 5 (532 Views)

Re: Change initial view port size in paper space

07-03-2013 07:27 PM 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);
Valued Contributor
dynamicscope
Posts: 95
Registered: ‎04-04-2012
Message 5 of 5 (519 Views)

Re: Change initial view port size in paper space

07-04-2013 12:34 AM in reply to: augusto.goncalves

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?

 

:smileysad:

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community