DXF Export (VCL): Text Labels not in DXF
Posted: 15 Sep 2009, 02:04
Hello,
I am demoing CADSoftTools DXF Export for VCL with a Delphi 7 application that uses MapObjects LT 2.0. I use the MapObjects method, ExportMap2 to write the visible extent of a map to an enhanced metafile. I then pass this metafile to the DXF Export method, ExportToDXF with the XP_USE01MM flag. When I open the DXF which is created, none of the text labels on the map are appearing in the image. When I open the DXF in a text editor, a confirms that the map labels were not written to the file. Do you know of anything that could be causing the text to be missing?
The code:
Thanks,
erzsebet
I am demoing CADSoftTools DXF Export for VCL with a Delphi 7 application that uses MapObjects LT 2.0. I use the MapObjects method, ExportMap2 to write the visible extent of a map to an enhanced metafile. I then pass this metafile to the DXF Export method, ExportToDXF with the XP_USE01MM flag. When I open the DXF which is created, none of the text labels on the map are appearing in the image. When I open the DXF in a text editor, a confirms that the map labels were not written to the file. Do you know of anything that could be causing the text to be missing?
The code:
Code: Select all
function ExportToDXF(Hanlde: THandle; FileName: PChar; Flags: DWORD): Integer; stdcall; external 'C:\DXFExp.dll' name 'ExportToDXF';
procedure TMapPage.SaveClick(Sender: TObject);
var
DFXFile: string;
Path: string;
AMetaFile : TMetafile;
begin
if not Assigned(Map) then exit; // Map is an ESRI TMapLT object
if TMenuItem(Sender).Tag = 0 then begin
with TSaveDialog.Create(Self) do try
InitialDir := ShellDir('Personal');
DefaultExt := 'dfx';
Filter := 'DXF Files (*.dxf) | *.dxf';
Execute;
DFXFile := Filename;
finally Free end;
end;
if (Copy(DFXFile, Length(DFXFile)-3,4) = '.dxf') then begin
try
try
Map.ExportMap2(moExportEMF, DFXFile, 1, True);
AMetaFile := TMetafile.Create;
AMetaFile.Enhanced := True;
AMetaFile.LoadFromFile(DFXFile);
if (AMetaFile.HandleAllocated) then
ExportToDXF(AMetaFile.Handle, PChar(DFXFile), XP_USE01MM)
finally
AMetaFile.Free;
end;
except
on E : Exception do
ShowMessage('Error : ' + E.Message);
end;
end;
erzsebet