Page 1 of 1
Help with paper space layouts
Posted: 04 Dec 2013, 14:32
by jose_olalla
Hello from Spain.
I'm writing a DXF from scratch with CADExport VCL (last version).
Can somebody help me with a little example about creating and using Viewports within Paper Space ??
Best Regards.
Re: Help with paper space layouts
Posted: 06 Dec 2013, 11:20
by support
Hello,
The example below demonstrates how to create Viewport and add it to the new layout:
Code: Select all
procedure AddViewPort(AImage: TsgCADImage);
var
vLayout: TsgDXFLayout;
vViewPort: TsgDXFViewport;
vRect: TFRect;
vRatio: Double;
vWH: TFPoint;
begin
vLayout := TsgDXFLayout.Create();
vLayout.Name := 'Layout1';
AImage.Converter.AddLayout(vLayout);
AImage.Converter.Loads(vLayout);
AImage.CurrentLayout := vLayout;
vRect := AImage.Converter.Layouts[0].Box;
vRatio := (vRect.Top - vRect.Bottom) / (vRect.Right - vRect.Left);
vWH := AbsFPoint2D(SubFPoint2D(vRect.TopLeft, vRect.BottomRight));
vViewPort := AImage.Converter.GenerateDisplayViewPort(cnstDefaultLayoutWidth, cnstDefaultLayoutWidth * vRatio);
AImage.CurrentLayout.AddEntity(vViewPort);
vViewPort := AImage.Converter.GenerateModelViewPort(MiddleFPoint(vRect.TopLeft, vRect.BottomRight), vWH.X, vWH.Y, True);
AImage.CurrentLayout.AddEntity(vViewport);
AImage.GetExtents;
end;
Mikhail.