Page 1 of 1
How to draw line on the dxf image
Posted: 11 Nov 2005, 15:16
by mangchy
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.
Posted: 14 Nov 2005, 11:47
by support
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