AutoCAD library in Java for reading .dwg files?

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

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

The AutoCAD developer community seems to prefer .NET and C / C ++ over JAVA.

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

+3


source to share


4 answers


Credits to everyone who replied, I tested all your suggestions and this is what I found, as of 2015:

There is currently no free and reliable solution for reading and processing .dwg and .dxf files. This is especially true for the latest versions of AutoCAD, for example: Autocad 2010, Autocad 2013, etc., RF 2013, RF 2010.

Reliable (and expensive) solutions would be Teigha ODA ($ 2000 per year) and RealDWG in C # from Autocad ($ 5000 per year) ...

Cheaper alternatives are:



  • AutoCAD I / O for $ 10 per month (as suggested by Augusto Gonclaves), but limited functionality for now.
  • writing LISPS routines and running them with the SCRIPT file in a paid copy of AutoCAD 2015/2016 ..
  • wait for a more complete implementation of CoreCad Core Console ..

Open source libraries like Kabeja and YCad can deal with older versions of AutoCAD, but don't expect much from them as these projects have been inactive since a few years ago. However, Apache Tika is worth checking out as they started writing parsers for .dwg files, but development was slow.

On a personal note, I think AutoDesk has a strong and selfish monopoly in the CAD market right now, and they make it difficult for others to participate. Dwg file format changes so often and I think the source code developers will have to give up at some point and use the official product.

May there be more open source solutions in the coming years.

+8


source


The Teigha library from opendesignaliance has a Java interface . Teigha is an alternative to RealDWG and is widely used by many CAD software vendors. It is stable and has the ability to read / edit / write dwg without any problem. We have over 3 years of experience with it and I can say that it is excellent and much cheaper. When we were able to choose between RealDWG and Teigha, we chose Teigha, and I'm glad we did.



Using SWIG to Build Teigha for Java

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

Java access for the complete Teigha API for .dwg and .dgn files. Supports Windows, Linux and Mac platforms. The API is very similar to Teigha.NET, making it easy to switch between languages.

+9


source


Autodesk developed AutoCAD primarily with C ++ and offers plugin support for C ++, .NET, JavaScript, VBA and LISP, so there is no native Java support. All of these will require AutoCAD to be installed on the machine.

Alternatively, you can use the AutoCAD I / O Web Service, which is basically a running instance in the cloud, to run your own code and retrieve data, or to create new drawings. This will support all DWG functionality. Check http://developer.autodesk.com

+2


source


As you pointed out, use DXF format instead, there is also an open source Java library, YCAD, which you can use and is very easy to use.

+2


source







All Articles