GNU LibreDWG is a free C library to handle DWG files. It aims to be a free replacement for the OpenDWG libraries. DWG is the native file format of AutoCAD. GNU LibreDWG is based on LibDWG, originally written by Felipe Castro.
Requirements :-
git, autoconf, gcc, libtool, swig2.0, python-dev, texinfo, build-essentials
Installation:-
For debian based distros ( like ubuntu ) :-
$ sudo apt-get install git autoconf libtool swig python-dev texinfo build-essential gcc
#this will check if all dependencies are present other wise will download required ones.
Now clone LibreDWG using git :-
git clone git://git.sv.gnu.org/libredwg.git
Now change dir to libredwg folder created by git ( cd libredwg ) and issue following commands in terminal :-
$ sh autogen.sh
$ ./configure --enable-trace # (this will enable debugging messages)
$ make
$ sudo make install
$ make check
This will install LibreDWG on your system.
Testing:-
LibreDWG comes with several examples (under the examples folder) that can be used for testing purposes. The most advanced example is testSVG.
export LIBREDWG_TRACE=3 cd examples ./testSVG yourdwgfile.dwg > yourconverteddwgfile.svg
This will output a svg format file, containing the dwg data. Note that SVG doesn’t support 3D entities.