How to draw line on the dxf image

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

Moderators: SDS, support, admin

Post Reply
mangchy
Posts: 15
Joined: 08 Nov 2005, 03:06

How to draw line on the dxf image

Post by mangchy » 11 Nov 2005, 15:16

Hi!
using CADImportVCL
CPP Builder 6

How to draw the line on the dxf image?
When open dxf image, I want to draw line to measure distance.

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

Post by support » 14 Nov 2005, 11:47

Hello,
There are two ways. CADImportVCL (available on: http://www.cadsofttools.com/download/CADImportVCL.zip) includes Add new entities demo in CADImportVCL\CBuilder\BCB6\AddNew folder.

1. Add new TSpeedButton object to the project and fill OnClick event:

Code: Select all

void __fastcall TfmMain::SpeedButtonClick(TObject *Sender)
{
  sgCADImage->Canvas->Brush->Style = bsClear;
  sgCADImage->Canvas->Rectangle(0, 0, 100, 200);
}
It is possible to draw entities on the canvas of the loaded CAD object.

2. Add new entities demo in fMain.cpp module already includes a function that allows adding entities to the list of the loaded CAD object:

Code: Select all

<b>void __fastcall</b> TfmMain::btnNewClick(TObject *Sender)
  TsgDXFEntity *Ent = NULL;
  TsgDXFImage *Im;

  <b>if</b> ((!sgCADImage->Empty())&&
     (sgCADImage->Picture->Graphic->ClassType() == <b>__classid</b>(TsgDXFImage)))
  {
    Im = <b>dynamic_cast</b><TsgDXFImage *>(sgCADImage->Picture->Graphic);
    Ent = GetEntity(Im);
    <b>if</b> (Ent != NULL)
    {
      Im->Converter->Sections[csEntities]->AddEntity(Ent);
      if (Im->Converter->OnCreate != NULL)
        Im->Converter->OnCreate(Ent);
      Im->Converter->Loads(Ent);
      Im->GetExtents();
      FLastAdded = Ent;
    }
    sgCADImage->Refresh();
  }
}
Entities Line, Plolyline, Circle are supported. Adding of the grid on the separate layer is available.
Sergey.

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

Post Reply