>How can I display and edit dxf format in Delphi? Can I draw it with
>canvas?

As I understand it, DXF is a text file format used by AutoCad to
represent a vector drawing. The vector drawing format supported
by the Windows operating system WMF (Windows Meta File).
You can draw a complete WMF file on a canvas with a single
call.

So, to draw the DXF file on a canvas, you could use someone
elses software to convert it to a WMF file and just draw it.

Use Google with this search:

dxf convert wmf

and you will find a lot of options, some of which are free.

If you need to be able to edit the DXF, you could write a
graphical editor, save the file to WMF and then convert
from WMF to DXF.

The above is a straightforward "easy" way to do what you
describe; although, writing the graphical editor is non-trivial.

The way I would probably want to deal with this problem is
to write a parser for the DXF format.

Here is a link to reference docs on the DXF format:

http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=8446698

The approach would be to write a parser that reads the DXF file
and populates a structure that represents all the entities contained
in the file in a form that can be easily traversed and drawn on a
canvas. To modify the DXF, you could write a DXF generator that
traverses your data structure and writes out DXF. Editing a DXF file
then consists of reading in a DXF file, modifying your internal
entity structure to perform the edits, then writing out the DXF file.
Note that this general approach makes it straightforward to support
other formats as well.

Glenn Lawler
www.incodesystems.com

Reply via email to