Page 1 of 1

How to Iterate All Entities inside a block?

Posted: 09 Apr 2015, 16:02
by FieldConsult
How to Iterate All Entities inside a block and get witch type are every one for explode later?

Re: How to Iterate All Entities inside a block?

Posted: 13 Apr 2015, 08:04
by FieldConsult
This forum is dead!!!!

Re: How to Iterate All Entities inside a block?

Posted: 13 Apr 2015, 19:29
by support
Hello,

The following procedure iterates through all entities inside a block specified by its name and reads the entity type (TsgCADEntities):

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;
Mikhail

Re: How to Iterate All Entities inside a block?

Posted: 14 Apr 2015, 21:01
by FieldConsult
Thanks!!