From DIDEAS Wiki
- DXF files have a curious mix of group codes followed by values / attributes
- every command / attribute is preceded by a number called a group code that below is intended (indentation probably not required)
- The group code 0 sets off a command (or entity type, etc.)
- here is an example header section with a comment (note header section is not required. )
0 SECTION 2 HEADER 999 this is a comment. 0 ENDSEC
- The entities section is where drawing elements are placed
- There are several entity types such as line, arc, circle that are easy to use as show below.
- The key is that following the entity type is group code 8 which specifies the layer name. It is non-optional! What is placed in the layer name seems to not matter at least until the DXF is used by another application. Probably want to group the output using the layer name.
- The group code 10,20 specify the initial X,Y coordinates
- The group code 11,21 specify the final X,Y coordinates
- Group code 62 specifies the line color
0 SECTION 2 ENTITIES 0 LINE 8 LAYER_NAME 10 1.9456451613 20 3.6438548387 11 0.9456451613 21 3.3289693701 0 LINE 8 0 62 4 10 2.9456451613 20 2.6438548387 11 1.9456451613 21 3.3289693701 0 ENDSEC 0 EOF