How to get all the entities?

Discuss and ask questions about CAD VCL (Delphi and C++ Builder).

Moderators: SDS, support, admin

Post Reply
andyseo
Posts: 4
Joined: 23 Apr 2007, 22:00
Location: USA

How to get all the entities?

Post by andyseo » 23 Apr 2007, 22:04

Hi, I need to get two things from DXF files.

1. The number of all the entities (shapes)
2. All the entities points so that I can manipulate in my program.

Basically I need to extract those two info, and need to draw them in XOR fashion. (So, some shapes are filled and some shapes are unfilled.)
How do I get those info from DXF? It is quite confusing to figure them out from your demo...
Thank you so much.

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 25 Apr 2007, 14:56

Hello!

The code below is based on Viewer demo. Find it in the ..\cadimportvcl\Delphi\Demos\Viewer\.. folder of the <b>CAD Import VCL</b> package: http://www.cadsofttools.com/download/cadimportvcl.zip It is shown how to get access to the entities on the current layout of the loaded CAD file.

Code: Select all

<b>procedure</b> TForm1.btnGetEntitiesClick(Sender: TObject);
<b>var</b>
  J: Integer;
  vCADImg: TsgDXFImage;
  vEnt: TsgDXFEntity;
<b>begin
  if</b> sgPaintBox.Picture.Graphic <b>is</b> TsgDXFImage <b>then</b>
    vCADImg := TsgDXFImage(sgPaintBox.Picture.Graphic)
  <b>else</b>
    Exit;

  <b>for</b> J := 0 <b>to </b>vCADImg.CurrentLayout.Converter.Counts[csEntities] - 1 <b>do
  begin</b>
    vEnt := vCADImg.CurrentLayout.Converter.Sections[csEntities].Entities[J];
    <font color="blue"><i>//do your actions</i></font id="blue">
  <b>end</b>;
<b>end</b>;
Sergey.

Please post questions to the forum or write to support@cadsofttools.com

Post Reply