Copying sgDXFLine?

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

Moderators: SDS, support, admin

Post Reply
jasonz_2003
Posts: 24
Joined: 13 Apr 2006, 16:20

Copying sgDXFLine?

Post by jasonz_2003 » 18 Jun 2006, 01:08

Hi Sergey,

I have tried to copy a Line Entity using the copy constructor:

TsgDXFLine *TheEnt;
TheEnt = new TsgDXFLine(*((TsgDXFLine *)FImg->Entities));

It gave me a new Line entity, except with DottedSingPts pointing to the DottedSingPts of the old Line entity. That is, the DottedSingPts of both entities pointing to the same address. Please help to solve this problem. Also, do I miss anything else in doing this way?

thanks
Jason

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

Post by support » 19 Jun 2006, 12:27

Hello Jason,

Please try the following code:

Code: Select all

<b>void __fastcall</b> TForm1::AssignEntTsgDXFLineLine1Click(TObject *Sender)
{
  Dxfimage::TsgDXFImage *vImg = (TsgDXFImage*) sgPaintBox->Picture->Graphic;
  <b>if</b> (vImg == NULL) exit;
  Dxfconv::TsgDXFConverter *vConverter = vImg->Converter;
  Dxfconv::TsgDXFLine *vLine, *vLineOrg = NULL;
  <b>for</b> (<b>int</b> i = 0; i < vConverter->Counts[csEntities]; i++)
  { 
    <b>if</b> (String(vConverter->Sections[csEntities]->Entities[i]->ClassName()) == "TsgDXFLine")
    {
      vLineOrg = (TsgDXFLine*) vConverter->Sections[csEntities]->Entities[i];
      <b>break</b>;
    }
  }
  <b>if</b> (vLineOrg != NULL)
  {  
    vLine = <b>new</b> TsgDXFLine;
    vLine->AssignEntity(vLineOrg);
    vConverter->Sections[csEntities]->AddEntity(vLine);
    vConverter->Loads(vLine);
    vConverter->OnCreate(vLine);
  }
}
Sergey.

please post questions to the forum or write to support@cadsofttools.com

jasonz_2003
Posts: 24
Joined: 13 Apr 2006, 16:20

Post by jasonz_2003 » 19 Jun 2006, 20:00

Hi Sergey,

Thanks for your reply. It worked with TsgDXFLine. Do you have AssignEntity() method with other Entity types as well? I am using versio 5.25. The method is not shown in the Help. I'll try other entity types anyway.

Jason

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

Post by support » 20 Jun 2006, 13:04

Hi Jason,

CADImportVCL v.5.2.5 (http://www.cadsofttools.com/download/cadimportvcl.zip):
the following entities have AssignEntity() method:

Code: Select all

<ul><li>TsgCADCurvePolygon</li>
<li>TsgCADGradientPolygon</li>
<li>TsgCADHatch</li>
<li>TsgCADPolyPolygon</li>
<li>TsgDXFACISEntity</li>
<li>TsgDXFArc</li>
<li>TsgDXFAttdef</li>
<li>TsgDXFCircle</li>
<li>TsgDXFCustomVertex</li>
<li>TsgDXFDimension</li>
<li>TsgDXFEllipse</li>
<li>TsgDXFEntity</li>
<li>TsgDXFInsert</li>
<li>TsgDXFLine</li>
<li>TsgDXFMText</li>
<li>TsgDXFObjectEntity</li>
<li>TsgDXFOle2Frame</li>
<li>TsgDXFPenEntity</li>
<li>TsgDXFPenLine</li>
<li>TsgDXFPolyline</li>
<li>TsgDXFSpline</li>
<li>TsgDXFText</li>
<li>TsgDXFVertex</li></ul>
Sergey.

please post questions to the forum or write to support@cadsofttools.com

Post Reply