How to create a BLOCK
Posted: 26 Oct 2010, 18:18
Hi,
I need an example on how to create and use a block.
Is there any ?
Thanks
Aby
I need an example on how to create and use a block.
Is there any ?
Thanks
Aby
CADSoftTools - AutoCAD DWG DXF HPGL (PLT) SVG CGM STEP IGES STL SAT viewers, converters and developer tools. Delphi and C# source code.
https://cadsofttools.com/forum/
Code: Select all
void Add_Entity(TsgDXFConverter * AConverter, TConvSection sect, TsgDXFEntity * AEnt)
{
AConverter->Sections[sect]->AddEntity(AEnt);
if (AConverter->OnCreate)
AConverter->OnCreate(AEnt);
AConverter->Loads(AEnt);
}
void __fastcall TfmMain::btnNewClick(TObject *Sender)
{
TsgDXFEntity *Ent = NULL;
TsgCADImage *Im;
TsgDXFBlock *blck;
TsgDXFInsert *ins;
if (!sgPaintBox->Empty())
if (sgPaintBox->Picture->Graphic->InheritsFrom(__classid(TsgCADImage)))
{
Im = dynamic_cast<TsgCADImage *>(sgPaintBox->Picture->Graphic);
Ent = GetEntity(Im);
if (Ent != NULL)
{
TsgDXFBlock *blck = new TsgDXFBlock();
blck->Name = "NAME1";
TsgDXFInsert *ins = new TsgDXFInsert();
ins->Block = blck;
//AddEntity(Im->Converter, Ent);
blck->AddEntity(Ent);
Add_Entity(Im->Converter, csBlocks, blck);
Add_Entity(Im->Converter, csEntities, ins);
Im->GetExtents();
FLastAdded = Ent;
}
sgPaintBox->Refresh();
}
}