Does anyone know of source code, ideally in C# or similar, for reading .DXF files (as used by AutoCAD etc)? If not code, then tables showing the various codes (elements / blocks / etc) and their meanings?
I am writing a reader myself, and have dead tree documentation detailing the format, but am trying to avoid writing e.g. a converter from each of the 255 ACI colours to RGB... Thanks!
Fortunately AutoCAD publish the DXF format information here: DXF Formats
I've written some C# code to read points/lines/arc's from all ASCII DXF versions available at the moment with the same code
You can add more objects bij just adding more subroutines with the correct name
(look inside the DXF).
What it does:
(R12 till R14 use POINT / LINE/ ARC)
(R2000 till R2013 use AcDbPoint / AcDbLine / AcDbArc or AcDbCircle if it contains the angles)
Then you can do something with the data
Cadlib from WoutWare have I been using for a couple of projects with good results.
Here is another open source dxf reader, in Java. Buggy however!
I have work a couple of years at developing my own DXf-Viewer in java (you could drop your own DXF file or an URL on the viewer) for 2D drawings.
The published information from AutoCAD is a good base but doesn't explain how it works.
Becoming member of the Open Design Alliance, will give you the possibility to convert several CAD formats to DXF. It may be a good idea if you are developing a commercial product.
There is a german book (http://www.crlf.de/Verlag/DXF-intern/DXF-intern.html) about DXF which really explain this format. It's expensive, but could save days of search.
The colors in the DXF Format are indexed, you must have a converter from ACI to RGB. Be careful with values 0 and 1 which having a special meaning.
Regards.
Update in case someone is still looking...
It's the same library, just including both links.
https://github.com/haplokuon/netDxf
https://www.nuget.org/packages/netDXF/