GNU LibreDWG is a C library to handle DWG files which aims to be a free
replacement for the OpenDWG libraries.
There are command line tools and libraries to read and write DWG files,
with converters for various formats: DXF, DXFB, SVG, PS, JSON, XML, etc.