Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AutoCAD - Is it possible to analyze .dwg file?

Tags:

autocad

dwg

I want to analyze dwg file. Is it possible?

I'm trying to write a some program that could analyze the content of the .dwg file. for example the program could say if a door in a building model could be opened.

I've found this article that explains how to read autoCAD file. also i've seen some program that can open and view .dwg files, but nothing to analyze the content.

I want to know if there is something similar to that, that analyze the content of the .dwg file, and to know if there are SDK that can help me analyze?

like image 329
No Idea For Name Avatar asked May 14 '16 09:05

No Idea For Name


2 Answers

You could, but it's not easy.

An AutoCAD .DWG file is basically just geometry (lines and arcs). You may have some well organized files with block, let's say a "Door" block, but it's not 100% confident: for instance, you may have "Door1" and "Out Patio Door" as a block name.

For both cases, the way the main problem is to understand the geometry and interpret somehow. Assuming you can, then you have some options of paths:

  • Run an in-process plugin on AutoCAD: this can be accomplished in C++, .NET (C#, VB.NET), LISP or VBA. There are tons of resources, like DevCenter, blog and blog.
  • Use as a library to access the objects, like RealDWG or other open source. This might be tricky and requires programming (like above).
  • Use a webservice, like AutoCAD I/O, to upload a .DWG and a .DLL (.NET) code that will analyse your drawing.

To interpret the geometry (with any of the above), the BRep API is the best way to analyze the geometry, like intersection points and other relations. The the blog you'll find some samples around it, but I don't believe there is something on this area. Check this and this.

Finally, as a summary, with .NET you'll need the Autodesk.AutoCAD.DatabaseServices namespace with Line, Arc, BlockReference and the respective IntersectWith methods to do some basic analysis.

Now if you have an AutoCAD Architecture .DWG drawing, it might be easier as some basic objects are available as part of the APIs, like Walls and Doors. I don't believe that's the case, but if so, check at this link.

like image 66
Augusto Goncalves Avatar answered Oct 10 '22 03:10

Augusto Goncalves


RealDWG costs unreal money. But you can use Teigha. Its cost is less, but its capabilities are great. Also you can read DWG Specification.

like image 29
Andrey Bushman Avatar answered Oct 10 '22 02:10

Andrey Bushman