开发者

Are there any libraries for parsing AutoCAD files?

开发者 https://www.devze.com 2022-12-26 20:02 出处:网络
Are there any libraries (preferably open-source) for parsi开发者_开发问答ng AutoCAD files (DWG or DXF)?Well,

Are there any libraries (preferably open-source) for parsi开发者_开发问答ng AutoCAD files (DWG or DXF)?


Well, For the DXF file format the specification is available online so you can write your own parser for this file format the document can be found here: http://images.autodesk.com/adsk/files/acad_dxf0.pdf

But if you don't want to you can use libdxf an open source library to parse dxf files but according to the developer it's a “Work in progress” you can find it here: https://github.com/bert/libdxf or you can install it in ubuntu using command:

sudo apt-get install libdxflib-dev

Also another library that is provided by coin3d (can be used separately) is named dime and is probably the one used by freecad can be found here: https://bitbucket.org/Coin3D/dime It also can be installed in ubuntu using the following command:

sudo apt-get install libdime-dev 

For the DWG format you can use libredwg library it's from opensource foundation and you can find it here: http://www.gnu.org/software/libredwg/

But please note that according to Wikipedia it has licensing issues of its own. http://en.wikipedia.org/wiki/LibreDWG

A fork of libredwg is available under the name libDWG it is able to read DWG file formats R13, R14, R2000 and R2004 and can be found at : http://libdwg.sourceforge.net/en/ I tested the library and the problem is that most of the sample files online have a newer version than the library can load which is not very practical.

Another good page (with some code samples) of how to read autocad files can be found at ibm website here: http://www.ibm.com/developerworks/opensource/library/os-autocad/

Bottom line is using dxf is the better option since it's open and can be supported the dwg support can't be easily done.


Duplicate of (or at least related to) Open source cad drawing (dwg) library in C# & .Net CAD component that can read/write dxf/ dwg files

There isn't anything available for parsing DWG for free that I would regard as reliable. The Open Design Alliance tends to be cheaper & runs on more OS's than AutoDesk's RealDWG offering. The ODA has a price-tier for startups who aren't yet shipping code - RealDWG doesn't. Both the ODA and AutoDesk offer support in forums - you have to be a member of the ODA but AutoDesk's forums are at http://discussion.autodesk.com/forums/ where you can join for free.

DXF is a text-file format (similar to XML) which you can parse with anything you like - if you know what you're looking for. You may have more luck with finding a library for that (I haven't looked into it) but that would involve conversion from DWG format. Note that there are various releases of the DXF format

You can try Autodesk's DWG Trueview (free) but it is an end-user viewer - it doesn't officially offer an API. Some people have had varying degree of success in the past automating it. I haven't tried myself & I strongly suspect the latest versions have been hardened against that.

Ultimately, if you are working for high-profile clients who are likely to insist on, or at least balk at the absence of 'official' AutoCAD libraries and the "Trusted DWG" BS that goes with it then you may need to invest in a membership of the Autodesk Developer Network.

As a long-time end user I can tell you the devs at the ODA are more responsive to bug reports than AutoCAD.


The Ivan CAD Library works very well with DWG R15, R18, R21 and R24. I found it at www.ivancad.com

0

精彩评论

暂无评论...
验证码 换一张
取 消