DXF-CSV v1.0 Usage
How to actually generate, export, and import a DXF-CSV file -- from AutoCAD's ribbon, the command line, or an AI with no source drawing at all. For "how do I hand this to an AI," see the shorter AI Guide instead.
Generating a DXF-CSV file
DXF-CSV files have three sources:
- Drawing Sync -- the flagship AutoCAD plug-in, exports from an
open drawing via
CSVOUT - AI directly -- an AI language model can generate a valid DXF-CSV from scratch given the spec and a design description, with no drawing required
- Any conforming tool -- any program that reads the spec and produces correctly structured CSV
The AI path is significant: a user can describe a design in plain language, share
the spec URL, and receive a complete importable CSV. This has been demonstrated with
mechanical brackets, electrical schematics, site plans, office furniture, and paper
space layouts -- all generated as DXF-CSV without a source drawing. Use
sha1:396cb2c5a30e (empty AutoCAD 2018 template) when generating from
scratch.
Drawing Sync is available from the Autodesk App Store or by direct download:
Direct download: https://drawingsync.com/downloads/DrawingSync-2027-x64.msi
Default install path: %ProgramFiles%\Code Truck\Drawing Sync\dwgsync.exe
The installer and all binaries are code-signed.
Basic usage
DXF-CSV files are created from AutoCAD and imported into AutoCAD.
Users create CSV files using the CSV Out button in the ribbon or
by entering CSVOUT at the Command: prompt. Users can read
CSV files created or modified by AI using the CSV In button in the
ribbon or by entering CSVIN at the Command: prompt.
Dash commands -CSVOUT and -CSVIN offer additional
options documented in the command reference.
Command line usage
dwgsync.exe supports batch and headless operation without opening the
AutoCAD UI. AutoCAD must be installed to process .dwg files.
.dxf files can be processed without AutoCAD.
Export CSV from a drawing:
dwgsync.exe "sample.dwg" -q -dxc "sample.csv" dwgsync.exe "sample.dxf" -q -dxs=TABLES,BLOCKS,ENTITIES -dxc "sample.csv"
Import CSV into a drawing:
dwgsync.exe sample.dwg -dsm sample.csv -dwg sample-out.dwg dwgsync.exe new.dxf -dsm sample.csv -dxf sample-out.dxf
| Flag | Meaning |
|---|---|
-q | Quiet mode -- exit after processing without opening the AutoCAD UI |
-dxc <path> | Export CSV file path |
-dsm <path> | Merge CSV into the drawing -- assumes table and block dependencies are available to match the sha1: source drawing |
-dwg <path> | Write output as a DWG file. AutoCAD must be installed |
-dxf <path> | Write output as a DXF file. Does not require AutoCAD |
To import into a new empty drawing, the target file should not exist -- Drawing
Sync will create it from the standard template. The sha1 for the standard empty DXF
template is 781e2fb2654f. When importing into a new or empty drawing,
use the full -dxs export so all required table entries are present in
the CSV.
Section filter -- -dxs
By default all sections are exported. The -dxs flag limits which
sections and tables are included:
-dxs=TABLES(LAYER),BLOCKS,ENTITIES <- LAYER table only; all blocks; all entities (default when omitted)
-dxs=TABLES,BLOCKS,ENTITIES <- full drawing data; all tables, blocks, entities; recommended for import into drawings empty or unrelated to the `sha1:` source
-dxs=TABLES,ENTITIES <- all tables; entities; no BLOCKS section
-dxs=TABLES(LTYPE),TABLES(STYLE),BLOCKS('block name') <- LTYPE and STYLE tables; one named block
-dxs="TABLES(LTYPE),TABLES(STYLE),BLOCKS('b1'),BLOCKS('b2')" <- two named blocks; quote when names have spaces
Default behavior: when the drawing has no BLOCK definitions or
non-LAYER table entries, CSVOUT defaults to TABLES(LAYER),BLOCKS,ENTITIES.
The LAYER table is always included. Other table types (LTYPE, STYLE, DIMSTYLE) only
appear when explicitly requested. The BLOCKS section is always emitted even when
empty (SECTION/ENDSEC pair only). A file exported without specifying LTYPE or STYLE
may reference linetypes and styles by name without defining them -- CSVIN creates or
verifies them using AutoCAD defaults on import.
Syntax rules:
- Section names:
TABLES,BLOCKS,ENTITIES - A section name without parentheses includes everything in that section
- Parentheses specify a single name -- repeat the keyword for each additional
entry:
TABLES(LTYPE),TABLES(LAYER)orBLOCKS('name1'),BLOCKS('name2') - Multiple entries are comma-separated
- Quote the full
-dxsvalue when any block name contains spaces
For users -- exporting all data: when a drawing contains block
definitions that should be included in the CSV, use Comma separated values
ALL tables,blocks,entities (*.csv) in the standard file save dialog, or use
the -CSVOUT dash command and select the All option. The default
CSVOUT command may omit block definitions depending on the drawing. If
an AI reports that INSERT rows reference blocks that have no matching BLOCK
definition in the file, re-export using the All option.
For AI -- missing block definitions: if a CSV contains INSERT
rows but the BLOCKS section is empty or absent (SECTION/ENDSEC with no BLOCK rows
between them), the block geometry was not included in the export. Do not attempt to
infer or reconstruct the block geometry. Instead, inform the user that the file was
exported without block definitions and ask them to re-export using
Comma separated values ALL tables,blocks,entities (*.csv) or the
-CSVOUT dash command All option.
-dxs=* raw dump: passing * as the
section filter exports the full DXF -- HEADER, TABLES, BLOCKS, ENTITIES, and OBJECTS
-- with no stripping. The output is a tabular CSV representation of the raw DXF group
code stream, not a DXF-CSV v1.0 file. It has no #DXF-CSV v1.0 metadata
line, includes handle columns (handle[5], id[330], etc.),
subclass markers (class[100]), XDATA, and all bookkeeping that standard
CSVOUT strips. Useful for DXF inspection and debugging -- not suitable for CSVIN
import or AI generation workflows. An AI receiving a -dxs=* output should
treat it as raw DXF tabular data rather than a conforming DXF-CSV file.
File structure
Encoding
Files are UTF-8 encoded with BOM (EF BB BF). The BOM is emitted by default by
CSVOUT and should be preserved by any tool that reads and rewrites a DXF-CSV file.
Non-ASCII characters (π, ±, °, and similar) are valid in
text[1] and other string fields. AI consumers do not require the BOM and
handle UTF-8 correctly without it. Tools that strip the BOM silently (some Unix
pipelines, naive concatenation) may cause non-ASCII characters to display incorrectly
in Excel and other consumer applications.
CSVOUT emits \r\n line endings by default (Windows convention). When
creating or modifying a DXF-CSV file, \n (LF only) is preferred -- it is
cleaner, avoids double-CR issues in text pipelines, and is accepted by both Excel and
CSVIN.
Layout
type,layer[8],pt[10],pt[11],real[40],... <- header row (row 0)
LINE,WALLS,10.0,20.0,5.0,... <- data rows
...
<- blank separator line
#DXF-CSV v1.0 | audience:ai | source:... | ... <- fixed metadata (always present)
#DXF-CSV-cond | space:model-and-paper | ... <- conditional metadata (when conditions met)
#zombies:3DSOLID HELIX MESH WIPEOUT <- zombie line (when zombies present)
A blank separator line -- entirely empty, no trailing comma -- is required
between the last data row and the metadata lines. Without it, Excel and other
table-aware tools treat the metadata as additional data rows and the table fails to
parse cleanly; the blank line is what causes Excel to stop the table there, keeping
metadata outside the formatted range. The three trailing lines that follow are all in
the type column -- all other columns on those rows are empty.
#DXF-CSV v1.0-- fixed clauses, always present. Split on|to parse.#DXF-CSV-cond-- conditional clauses, present only when the drawing has features that require them. Split on|to parse. Absent when no conditions are met.#zombies:-- space-delimited zombie type list. Absent when no zombies exist. Parse by splitting on:then splitting the value on spaces.
Metadata string
Fixed clauses -- always present on #DXF-CSV v1.0 line
| Clause | Meaning |
|---|---|
#DXF-CSV v1.0 | Format identifier and version |
audience:ai | Terse encoding is intentional -- written for machine consumption |
source:filename.dwg sha1:abc123def456 | Source drawing filename and 12-char SHA-1 content hash. Filename is unquoted when it contains no spaces. A filename containing a space is single-quoted: source:'my file.dwg'. A literal single quote in the filename is doubled: source:'rich''s file.dwg'. source: should always name a .dwg file -- it describes the origin drawing, not the CSV. For AI-generated content with no source drawing use source:generated.dwg paired with the appropriate sha1 sentinel. |
codes:dxf-r12 or codes:dxf-2018 | DXF version of the source export. dxf-r12 = AutoCAD Release 12 entity set. dxf-2018 = AutoCAD 2018 format. Future versions follow the same pattern |
dxfcsv:'https://drawingsync.com/dxfcsv/v1.0/spec.md' | This document |
last-updated:2026-07-12 | Build date of the CSVOUT binary that produced this file -- set at compile time. This date also identifies the spec version: a CSV carrying last-updated:2026-07-12 was produced by the build that corresponds to this edition of the spec. When the spec is updated, both this example date and the CSVOUT binary version advance together |
units:xx | Drawing units -- see Units reference |
coords:xy z-absent=truly-2D or coords:xyz z-absent=truly-2D | All coordinates are raw drawing units. xy = all entities are 2D, no Z values present. xyz = 3D or mixed drawing, Z present on some or all entities. Z absent on a point means genuinely 2D -- not Z=0. See Coordinates |
design:r12-extended | Post-R12 entities treated as R12-extended primitives. Handles, owners, subclass markers, CLASSES, OBJECTS stripped. See Design principle |
color:aci absent=BYLAYER | Color values are AutoCAD Color Index integers; absent cell means BYLAYER |
missing:linetype=BYLAYER color=BYBLOCK lwt=-3 | Default values suppressed -- absent linetype means BYLAYER, absent color means BYBLOCK, absent lineweight means DEFAULT (-3) |
Conditional clauses -- present on #DXF-CSV-cond line when conditions are met
| Clause | Present when |
|---|---|
blocks:inline | Block definitions are present in this export -- inline between BLOCK/ENDBLK rows. Absent when the BLOCKS section was excluded via -dxs or the drawing has no block definitions |
space:model-and-paper | File contains both model-space and paper-space entities |
ext[210]:ocs-normal absent=0 0 1 | Any entity has a non-default OCS extrusion normal -- ext[210] column is present |
mesh:polyline | 3D polygon mesh POLYLINEs present (legacy mesh, int[70] bit 4 set). int[71] and int[72] give M×N mesh dimensions on each POLYLINE row |
mesh:subdiv | MESH entities present (subdivision mesh, post-2010 smooth mesh entity) |
attrib:tag=name[2] | ATTRIB or ATTDEF entities present -- tag identifier is in name[2] |
paper[67]:paper-space | File contains paper-space entities -- paper[67]=1 on entities in the default layout (Layout1), paper[67]=2 and above for additional layouts |
angle[51]:arc-end or text-oblique | ARC entities or oblique TEXT present |
bulge:tan(theta/4) in real[42] | Bulge values present on VERTEX or LWPOLYLINE rows |
seq[66]:sequence-follows | Any POLYLINE or INSERT has a following VERTEX or ATTRIB sequence terminated by SEQEND |
truecolor:rgb[420] | Any entity uses true color (group 420) -- packed 24-bit RGB integer overriding ACI color |
url:'https://github.com/org/repo.git' | Source drawing is in a known git repository; sha1 doubles as git blob hash -- retrieve with git cat-file blob <sha1> |
Zombie line -- present only when zombie entities exist
#zombies:TYPE1 TYPE2 TYPE3
Space-delimited, alphabetically sorted list of entity type names that exported as zombies -- entities whose geometry requires an object enabler that was not loaded. A zombie row will have no geometry columns but may have non-geometric properties (layer, color, linetype, style, paper space). Do not treat zombie rows as errors. See Design principle.