Hello aby.
You're correct, Entites[0] is a TsgDXFDimension object. The attached file contains one entity (dimension) only, so there is only one entity in
Converter->Entities list. However DWG/DXF structure provides a dimension consists of a set of other entities such as lines, solids, MText. These entities can be accessed via BLOCKS section
FImg->Converter->Sections[csBlocks]. My previous post contains an error, sorry. Group must be refer to BLOCKS, not ENTITIES:
- Code: Select all
TsgDXFDimension* dim = (TsgDXFDimension*)FImg->Converter->Entities[0];
FImg->Converter->Loads(dim);
// FImg->Converter->Sections[csEntities] ---- incorrect
TsgDXFGroup* group = (TsgDXFGroup*)FImg->Converter->Sections[csBlocks];
FImg->Converter->Loads(((TsgDXFBlock*)group->Entities[3])->Entities[6]);
//if not doublebuffered. Otherwise FImg->GetExtents();
sgPaintBox->Invalidate();
Dimension's block have index 3 and the MText have index 6 within block's entities.
MText can be also accessed as
TsgDXFDimension->Block->Entities:
- Code: Select all
TsgDXFDimension* dim = (TsgDXFDimension*)FImg->Converter->Entities[0];
FImg->Converter->Loads(dim);
FImg->Converter->Loads(dim->Block->Entities[6]);
//if not doublebuffered. Otherwise FImg->GetExtents();
sgPaintBox->Invalidate();
Any of above posted snippets must be run after your code changing the text style. More complex files with multiple dimensions/texts require reload all entities that use the modified style.
Alexander.