Page 1 of 1

Extract a list of all strings in a .dwg document

Posted: 12 Mar 2015, 10:31
by palee1952
I am using CAD Import VCL 8.0 (Delphi) and would like to be able to extract a list of all strings within an autocad document. I have had a look at the functions that are available but cannot see anything obvious.

Any help much appreciated.

Peter

Re: Extract a list of all strings in a .dwg document

Posted: 12 Mar 2015, 10:33
by palee1952
OOps, sorry wrong section.

Re: Extract a list of all strings in a .dwg document

Posted: 12 Mar 2015, 19:33
by support
Hello,

In order to extract all the text strings from an AutoCAD file, you should access TsgDXFText and TsgDXFMText entities as shown in the code snippet below:

Code: Select all

uses
  ...,
  CADImage, DXFConv, DWG, DXF;


procedure AccessDXFTexts(ACADImage: TsgCADImage);
var
  I: Integer;
  vEntity: TsgDXFEntity;
  vText: TsgDXFText;
  vMText: TsgDXFMText;
begin
  for I := 0 to ACADImage.Converter.Counts[csEntities] - 1 do
  begin
    vEntity := ACADImage.Converter.Entities[I];
    if vEntity.EntType = ceText then
      vText := vEntity as TsgDXFText;
    if vEntity.EntType = ceMText then
      vMText := vEntity as TsgDXFMText;
  end;
end;
Mikhail