please see the picture below, I am sure you can get my words.
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?
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
thanks for your reply, but could you give me some C++ expample codes? I am not quite familar with .Net.
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.