How to Iterate All Entities inside a block?
Posted: 09 Apr 2015, 16:02
How to Iterate All Entities inside a block and get witch type are every one for explode later?
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
uses
..., CADImage, DXFConv, sgConsts;
procedure AccessDXFBlockByName(ACADImage: TsgCADImage; ABlockName: string);
var
I: Integer;
vBlock: TsgDXFBlock;
vEntity: TsgDXFEntity;
vDXFLine: TsgDXFLine;
vDXFCircle: TsgDXFCircle;
begin
vBlock := ACADImage.Converter.BlockByName(ABlockName);
if Assigned(vBlock) then
for I := 0 to vBlock.Count - 1 do
begin
vEntity := vBlock.Entities[I];
case vEntity.EntType of
ceLine:
vDXFLine := vEntity as TsgDXFLine;
ceCircle:
vDXFCircle := vEntity as TsgDXFCircle;
end;
end;
end;