[GIS] How to change DXF unit by Python 2.6

autocadconvertdxfmap-unitpython-2.6

I have a bunch of DXF files to import into ArcGIS 10 but they are all in mm. However I need to change the unit to Meter and to do this I have to open AutoCAD to do it each time.
Can anyone help to write a script in Python to batch convert the unit of DXF from mm to m without going through openning AutoCAD? Then they can be added in Arcmap to create shapefiles out of them.

Best Answer

You need to change $INSUNITS system variable inside dxf file from value 4 to 6. 4 are millimeters, 6 are meters. Because dxf is plain text file, you can easily read it and manipulate it as such.

I have tired to solve your problem with dxfwrite, but with no success. I could not successfully change that variable so that AutoCAD accepts modification.