Erwan
---
Well asked. You can get the DXF format in all its gory details from the
AutoCAD Customization Manual that comes with the product (or the Reference
Manual, if before Release 12), and doubtless in various AutoCAD books. But
for the _simplest_ one, you can skip that stuff initially and check `Writing
DXF Interface Programs' near the end of the chapter on DXF in the
Customization Manual. There you'll find Basic programs (ugly compared to
something written in a decent language, but at least they prove that such a
program needn't be complex) to read and write DXF.
Whatever source book you use, remember that a DXF file can contain minimal
data, and AutoCAD will fill in the blanks -- though I can't guarantee what
other programs that claim to read DXF will do. The problem is to find, out of
the vast heaps of data that can be in DXF, what's essential. If all you want
is some vectors, for instance, you can omit the entire header and write
something as simple as this (comments marked by << aren't in the actual file):
0
SECTION
2
ENTITIES << You could have a HEADER section, a TABLES, etc, but you don't.
0
LINE
8
0 << On layer 0 (optional spec).
10
1.0 << From 1,2,3 to 4,5,6.
20
2.0
30
3.0
11
4.0
21
5.0
31
6.0
. << More of the same.
.
.
0
ENDSEC << That's all, folks.
0
EOF
This isn't enough to get you started writing DXF, but it serves to emphasize
that underlying all the hundreds of fields is a very simple-minded format.
Dan Drake | In [the Court of Appeals's] judgment, however,
dr...@Autodesk.com | a self-induced addiction to glue-sniffing brought
| on by voluntary and persistent abuse of solvents
| was wholly inconsistent with the concept of a
| reasonable man.
| -- The Times, 17 Aug 93