AutoCAD library in Java to read .dwg files?

user3336544 picture user3336544 · Aug 7, 2015 · Viewed 20.2k times · Source

Is there any open-source Java or JavaScript library available to parse .dwg files and get the objects from it.

I would like to extract data from a table of text for my project.

It seems that the AutoCAD developer community prefers .NET and C/C++ over JAVA.

The only free alternative I found is by converting .dwg to .dxf first and using the Kabeja lib to read from it.

Answer

Ognyan Dimitrov picture Ognyan Dimitrov · Aug 8, 2015

The Teigha library from opendesignaliance has C++, C#, and Java interface. Teigha is the alternative of RealDWG and it is widely used by many CAD software vendors. It is stable and has the power to read/edit/write dwgs without problem. We have more than 3 years of experience with it and I can say it is excellent and a lot cheaper. When we were at the point to choose between RealDWG and Teigha we chose Teigha and I am glad we did it.

Leveraging SWIG to Create Teigha for Java

In 2013, ODA used the Java support provided by SWIG to create "Teigha for Java". Teigha for Java includes the following:

Java access to the full Teigha API for both .dwg and .dgn files. Support for Windows, Linux and Mac platforms. API very similar to Teigha.NET, simplifying the transition between languages.