DWG to DXF conversion
Moderators: SDS, support, admin
-
- Posts: 7
- Joined: 15 Apr 2005, 20:08
DWG to DXF conversion
I am looking for the easiest way to read a DWG file using CAD Import VCL and write its contents to DXF using DXF Export VCL. Do I have to iterate through the entities?
Rest regards
Richard
Rest regards
Richard
Dear Mr. Richard Wissler,
Here goes an example of import-export through metafile without iterating entities. This example is created basing on Demo Viewer from ..\CADImportVCL\Delphi\Demos\Viewer\.. folder (<b>CADImportVCL</b> is available on: http://www.cadsofttools.com/download/cadimportvcl.zip).
<b>Note</b>: it is necessary to add to the project module <b>DXFExport</b> (<b>DXFExportVCL</b> is available on: http://www.cadsofttools.com/download/dxfexportvcl.zip)
Current version of <b>DXFExportVCL</b> implements export to DXF through metafile only.
We plan to release direct export to DXF soon. The whole inner structure of CAD file will be saved.
Best regards,
Sergey Verbenko
please post questions to the forum or write to support@cadsofttools.com
Here goes an example of import-export through metafile without iterating entities. This example is created basing on Demo Viewer from ..\CADImportVCL\Delphi\Demos\Viewer\.. folder (<b>CADImportVCL</b> is available on: http://www.cadsofttools.com/download/cadimportvcl.zip).
<b>Note</b>: it is necessary to add to the project module <b>DXFExport</b> (<b>DXFExportVCL</b> is available on: http://www.cadsofttools.com/download/dxfexportvcl.zip)
Code: Select all
<b>procedure</b> TForm1.SaveToDXF(AFileName: <b>string</b>);
<b>var</b>
E: TsgDXFExport;
vMet: TMetafile;
vGr: TGraphic;
vOffX, vOffY, vUSize: TsgFloat;
<b>begin</b>
vGr := sgPaintBox.Picture.Graphic;
E := TsgDXFExport.Create;
<b>try</b>
E.IsParseWhite := True;// False
<b>if not</b> ((vGr <b>is</b> TsgDXFImage) <b>or</b> (vGr <b>is</b> TMetafile)) <b>then
begin</b>
ShowMessage('Raster drawings can not be saved to DXF format');
Exit;
<b>end
else
begin
if not</b> (vGr <b>is</b> TsgDXFImage) <b>then
begin</b>
E.Use01MM := False;
E.Canvas.StretchDraw(Rect(0, 0, vGr.Width, vGr.Height), vGr);
E.EndDraw;
<b>end
else
begin</b>
vMet := TsgDXFImage(vGr).ExportToMetafile(vOffX, vOffY, vUSize);
DXFExport.OffsetX := vOffX;
DXFExport.OffsetY := vOffY;
E.UnitSize := vUSize;
E.LoadFromMetafile(vMet);
vMet.Free;
<b>end</b>;
<b>end</b>;
E.SaveToFile(AFileName);
<b>finally</b>
E.Free;
<b>end</b>;
<b>end</b>;
We plan to release direct export to DXF soon. The whole inner structure of CAD file will be saved.
Best regards,
Sergey Verbenko
please post questions to the forum or write to support@cadsofttools.com
Hello all!!!
It is very important to note that when implementing the import-export through metafile the inner stucture of CAD file changes.
Finally the same picture is received when viewing source and destination files. But block and layers are lost and some copmplicated entites are converted to lines.
Sergey.
please post questions to the forum or write to support@cadsofttools.com
It is very important to note that when implementing the import-export through metafile the inner stucture of CAD file changes.
Finally the same picture is received when viewing source and destination files. But block and layers are lost and some copmplicated entites are converted to lines.
Sergey.
please post questions to the forum or write to support@cadsofttools.com