Determining Viewport of imported DXF
Moderators: SDS, support, admin
Determining Viewport of imported DXF
I am evaluating the CADImport functions prior to purchase and wanted to modify the SimpleImport demo to return the ViewPort size and position. I tried adding a simple procedure based on the other ImportXXX procedures but it seems that the TsgDXFViewport is not covered by the Iterate function.
Can someone tell me what I need to do?
Thanks,
David.
Can someone tell me what I need to do?
Thanks,
David.
Hello,
Entity <b>VIEWPORT</b> (<b>TsgDXFViewport</b> in <b>CADImportVCL</b> terms) is located in the <b>PaperSpace</b> in every correct <b>AutoCAD</b> drawing.
<br /><b>SimpleImport</b> iterates through entities in the <b>ModelSpace</b>. The following code allows to get <b>VIEWPORT</b> if current layout is not <b>Model</b> (TsgDXFImage.CurrentLayout<>TsgDXFImage.Layouts[0]).
Sergey.
please post questions to the forum or write to support@cadsofttools.com
Entity <b>VIEWPORT</b> (<b>TsgDXFViewport</b> in <b>CADImportVCL</b> terms) is located in the <b>PaperSpace</b> in every correct <b>AutoCAD</b> drawing.
<br /><b>SimpleImport</b> iterates through entities in the <b>ModelSpace</b>. The following code allows to get <b>VIEWPORT</b> if current layout is not <b>Model</b> (TsgDXFImage.CurrentLayout<>TsgDXFImage.Layouts[0]).
Code: Select all
<b>procedure</b> TForm1.ReadCADEntities(Entity: TsgDXFEntity);
...
<b>if</b> Entity <b>is</b> TsgDXFViewPort <b>then
begin</b>
ImportViewPort(Entity);
Exit;
<b>end</b>;
...
<b>procedure</b> TForm1.Button1Click(Sender: TObject);
...
//TsgDXFImage(Image1.Picture.Graphic).Converter.Iterate(ReadCADEntities, FCADParams);
TsgDXFImage(Image1.Picture.Graphic).Converter.Params := @FCADParams;
TsgDXFImage(Image1.Picture.Graphic).CurrentLayout.Iterate(TsgDXFImage(Image1.Picture.Graphic).Converter, ReadCADEntities);
...
<b>procedure</b> TForm1.ImportViewPort(Sender: TObject);
<b>var</b>
V: TsgDXFViewPort absolute Sender;
<b>begin</b>
MessageBox(Application.Handle, PChar('Box'
+ #13#10' Left= ' + FloatToStr(V.Rect.Left)
+ #13#10' Top= ' + FloatToStr(V.Rect.Top)
+ #13#10' Z1= ' + FloatToStr(V.Rect.Z1)
+ #13#10' Right= ' + FloatToStr(V.Rect.Right)
+ #13#10' Bottom= ' + FloatToStr(V.Rect.Bottom)
+ #13#10' Z2= ' + FloatToStr(V.Rect.Z2)), 'VIEWPORT', MB_OK);
<b>end</b>;
please post questions to the forum or write to support@cadsofttools.com
Hello!
Updated version of SimpleImport is available in the ..\CADImportVCL_site_beta_010906\Delphi\Demos\SimpleImport\.. folder of the CADImportVCL beta package (avalable on: http://www.cadsofttools.com/download/CA ... 010906.zip)
Sergey.
please post questions to the forum or write to support@cadsofttools.com
Updated version of SimpleImport is available in the ..\CADImportVCL_site_beta_010906\Delphi\Demos\SimpleImport\.. folder of the CADImportVCL beta package (avalable on: http://www.cadsofttools.com/download/CA ... 010906.zip)
Sergey.
please post questions to the forum or write to support@cadsofttools.com