Adding TsgCADMLine ?

If you have any comments or questions about our developing tools, please do not hesitate to contact us at this forum

Moderators: admin, SDS, support

Adding TsgCADMLine ?

Postby bilcan » 02 Nov 2011, 14:41

Hi,

I'd like to add a MultiLine (for example Double) entity to CAD Image but I couldn't find a demo or explanation, could you give me an simple example

Bilal.
bilcan
 
Posts: 7
Joined: 19 Aug 2011, 13:37

Re: Adding TsgCADMLine ?

Postby support » 16 Nov 2011, 15:59

Hello Bilal.
Here is the snippet that shows MultiLine creation. The number of lines in MultiLine defined by TsgMLineStyle.Entries. TsgMVertex.Point and TsgMVertex.Direction define MLINE geometry. Please note, MultiLine can't be exported to DXF with VCL export component current version.
Code: Select all
  style := TsgMLineStyle.Create();
  style.Name := 'my_style';

  M := TsgMLineEntry.Create;
  M.Offset := 5;
  M.Color := clBlue;
  style.AddEntity(M);

  M := TsgMLineEntry.Create;
  M.Offset := 15;
  M.Color := clRed;
  style.AddEntity(M);

  Img.Converter.Loads(style);
  Img.Converter.OnCreate(style);
  Img.Converter.Sections[csMLineStyles].AddEntity(style);

  mline := TsgCADMLine.Create();
  mline.Scale := MakeFPoint(1, 1, 1);
  mline.Style := style;
  mline.Flags := 1;
  mline.Justify := 0;

  mvert := TsgMVertex.Create();
  mvert.Point := MakeFPoint(500, 0, 0);
  mvert.Direction := MakeFPoint(100, 100, 0);
  mvert.Miter := MakeFPoint(0.0, 20.0, 0.0);
  mvert.NewList();
  mvert.NewList();
  mvert.NewList();
  mvert.Params[0, 0] := 0.0;
  mvert.Params[0, 1] := 1.0;
  mvert.Params[1, 0] := 1.0;
  mvert.Params[1, 1] := 1.0;
  mline.AddEntity(mvert);

  mvert := TsgMVertex.Create();
  mvert.Point := MakeFPoint(0, 500, 0);
  mvert.Direction := MakeFPoint(100, 100, 0);
  mvert.Miter := MakeFPoint(0.0, 20.0, 0.0);
  mvert.NewList();
  mvert.NewList();
  mvert.NewList();
  mvert.Params[0, 0] := 0.0;
  mvert.Params[0, 1] := 1.0;
  mvert.Params[1, 0] := 1.0;
  mvert.Params[1, 1] := 1.0;
  mline.AddEntity(mvert);

  mvert := TsgMVertex.Create();
  mvert.Point := MakeFPoint(-300, 100, 0);
  mvert.Direction := MakeFPoint(100, 200, 0);
  mvert.Miter := MakeFPoint(0.0, 20.0, 0.0);
  mvert.NewList();
  mvert.NewList();
  mvert.NewList();
  mvert.Params[0, 0] := 0.0;
  mvert.Params[0, 1] := 1.0;
  mvert.Params[1, 0] := 1.0;
  mvert.Params[1, 1] := 1.0;
  mline.AddEntity(mvert);

  Img.Converter.Loads(mline);
  Img.Converter.OnCreate(mline);
  Img.CurrentLayout.AddEntity(mline);

  Img.GetExtents();

Alexander.
Please post questions to the forum or write to support@cadsofttools.com
support
 
Posts: 2226
Joined: 30 Mar 2005, 08:36
Location: Russia


Return to CADImportVCL + DXFExportVCL

Who is online

Users browsing this forum: No registered users and 1 guest