Add entities to specific layers

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

Moderators: SDS, support, admin

Post Reply
Klemens
Posts: 4
Joined: 01 Dec 2008, 20:36

Add entities to specific layers

Post by Klemens » 11 Dec 2008, 21:05

Hi support,

how do I can add entities like a polyline to a specific layer named as "Demo"?

Thanks a lot.

Kind regards

Klemens

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

Re: Add entities to specific layers

Post by support » 12 Dec 2008, 11:30

Hello!

Please try the following code:

Code: Select all

var  
  vPoly: TsgDXFPolyline;
  vVertex: TsgDXFVertex;
  ...
begin
...
  vPoly := TsgDXFPolyline.Create;
  vPoly.Closed := True;

  vVertex := TsgDXFVertex.Create;
  vPoly.AddEntity(vVertex);
  vVertex.Point := MakeFPoint(0,0,0);

  vVertex := TsgDXFVertex.Create;
  vPoly.AddEntity(vVertex);
  vVertex.Point := MakeFPoint(0,100,0);

  vVertex := TsgDXFVertex.Create;
  vPoly.AddEntity(vVertex);
  vVertex.Point := MakeFPoint(200,100,0);

  vVertex := TsgDXFVertex.Create;
  vPoly.AddEntity(vVertex);
  vVertex.Point := MakeFPoint(200,0,0);

  vPoly.Layer := vImg.Converter.LayerByName('Demo');

  TsgDXFImage.Converter.Sections[csEntities].AddEntity(vPoly);
  if Assigned(TsgDXFImage.Converter.OnCreate) then
    TsgDXFImage.Converter.OnCreate(vPoly);
  TsgDXFImage.Converter.Loads(vPoly);
  TsgDXFImage.GetExtents;
Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply