Help with paper space layouts

Discuss and ask questions about CAD VCL (Delphi and C++ Builder).

Moderators: SDS, support, admin

Post Reply
jose_olalla
Posts: 5
Joined: 04 Dec 2013, 14:21

Help with paper space layouts

Post by jose_olalla » 04 Dec 2013, 14:32

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.

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: Help with paper space layouts

Post by support » 06 Dec 2013, 11:20

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.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply