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

How to get Layout's paper size

3 REPLIES 3
Reply
Message 1 of 4
421232206
847 Views, 3 Replies

How to get Layout's paper size

please see the picture below, I am sure you can get my words.

layout.jpg

I create a viewport ,but It is in the center of the paper, is there any way to get the center of the white paper and its size..

and how to change its size or position?

 

Technology change world! Coding change technology! We coders are coding!
3 REPLIES 3
Message 2 of 4
derwisz6
in reply to: 421232206

Try something like that::

 

szerokosc = 420
wysokosc = 297
center(0) = szerokosc / 2
center(1) = wysokosc / 2
center(2) = 0
Set layer = ThisDrawing.Layers("Defpoints")
Set lay = ThisDrawing.Layouts.Add(nazwa & format)
ThisDrawing.ActiveLayer = layer
ThisDrawing.ActiveLayout = lay
ThisDrawing.ActiveLayout.PaperUnits = acMillimeters
ThisDrawing.ActiveLayout.ConfigName = "A3.PC3"
ThisDrawing.ActiveLayout.SetCustomScale 1, 1
ThisDrawing.ActiveLayout.RefreshPlotDeviceInfo
ThisDrawing.ActiveLayout.CanonicalMediaName = "A3"
ThisDrawing.MSpace = True
Set s_v = ThisDrawing.ActivePViewport
s_v.Delete
Set papi = ThisDrawing.PaperSpace.AddPViewport(center, szerokosc, wysokosc)
ThisDrawing.SendCommand ("-plotstamp" & vbCr & "on" & vbCr & vbCr)
ThisDrawing.SetVariable "PSLTSCALE", 0
papi.ViewportOn = True
ZoomExtents
ThisDrawing.MSpace = False
ZoomAll
ThisDrawing.ActiveSpace = acModelSpace

Message 3 of 4
421232206
in reply to: derwisz6

thanks for your reply, but could you give me some C++ expample codes?  I am not quite familar with .Net.

Technology change world! Coding change technology! We coders are coding!
Message 4 of 4
shaneoneill
in reply to: 421232206

The following functions may help. 

 

AcDbDatabase

Acad::ErrorStatus getLayoutDictionary (AcDbDictionary*& pDict,
AcDb::OpenMode mode);

 

AcDbLayout

Acad::ErrorStatus getPlotPaperSize (double& paperWidth,
double& paperHeight) const; //The center should be AcGePoint2d(paperWidth/2, paperHeight/2). 

 

AcDbViewport 

Acad::ErrorStatus setCenterPoint( const AcGePoint3d& ); //Sets the center of the viewport in paperspace

 

 

Regards,

Shane. 

 


 

 

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

Post to forums  

Autodesk Design & Make Report

”Boost