# dxf-to-csv #
__dxf-to-csv__ is a tool to extract coordinates from CAD drawings.
AutoCAD offers the `LIST` command, which shows the geometry of selected objects, but this approach is not practical when dealing with a large number of objects.
![AutoCAD list command ](doc/autocad-list.png )
## Installation ##
`pip install dxfgrabber`
## Usage ##
Show available layers:
`python dxf_to_csv.py drawing.dxf -l`
Convert all layers:
`python dxf_to_csv.py drawing.dxf`
Convert specific layer:
`python dxf_to_csv.py drawing.dxf -n LAYER_NAME`
## Output ##
`drawing.csv`
| layer | type | id | x | y | z |
------------------------------------------------------
| MAP | LWPOLYLINE | 9896 | 202.568 | -41.517 | 0 |
| MAP | LWPOLYLINE | 9896 | 206.053 | -40.062 | 0 |
| MAP | LWPOLYLINE | 9896 | 207.450 | -36.796 | 0 |
| layer | type | id | x | y | z |
| ----- | :--------- | ---: | ------: | ------: | ---: |
| MAP | LWPOLYLINE | 9896 | 202.568 | -41.517 | 0 |
| MAP | LWPOLYLINE | 9896 | 206.053 | -40.062 | 0 |
| MAP | LWPOLYLINE | 9896 | 207.450 | -36.796 | 0 |
| layer | type | id | x | y | z |
| ----- | ---------- | ---- | ------- | ------- | --- |
| MAP | LWPOLYLINE | 9896 | 202.568 | -41.517 | 0 |
| MAP | LWPOLYLINE | 9896 | 206.053 | -40.062 | 0 |
| MAP | LWPOLYLINE | 9896 | 207.450 | -36.796 | 0 |