I want to use code to analyze dwg file. Any one know any SDK tools to start with?
3 Answers
From Wikipedia:
Autodesk sells a read/write library, called RealDWG, under selective licensing terms for use in non-competitive applications. Several companies have attempted to reverse engineer Autodesk's DWG format, and offer software libraries to read and write Autodesk DWG files. The most successful is Open Design Alliance, a non-profit consortium created in 1998 by a number of software developers (including competitors to Autodesk), released a read/write/view library called the OpenDWG Toolkit, which was based on the MarComp AUTODIRECT libraries. ODA has since rewritten and updated that code.

- 7,290
- 9
- 45
- 51
WoutWare's cadlib supports WinForms embedding and a few other things.

- 2,711
- 19
- 8
-
1And also .NET Core, so it works on Linux, too. (tested, is true) – Stefan Steiger Mar 18 '19 at 18:09
If you don't have any AutoCAD or compatible CADs, there are several OSS libraries that can handle DXF. ODA provides a free (unfortunately not open-sourced) tool ODA File Converter that converts DWG to DXF. Notably, ezdxf has a wrapper API for the ODA converter.
from ezdxf.addons import odafc
# Load a DWG file
doc = odafc.readfile('my.dwg')
# Use loaded document like any other ezdxf document
print(f'Document loaded as DXF version: {doc.dxfversion}.')
msp = doc.modelspace()
...
# Export document as DWG file for AutoCAD R2018
odafc.export_dwg(doc, 'my_R2018.dwg', version='R2018')
There is also LibreCAD's module libdxfrw
, but I haven't tried it.

- 2,268
- 2
- 33
- 34