Typically developers use a library that allows loading the DWG file
into a 'database'. Then your code can query the database and retrieve
the required information. We at CAD & Company (in the Netherlands)
started to use the official RealDWG library by AutoDesk, available
only to selected developers for a yearly fee. Other libraries are
available, but I believe none are free.
An other option to get data from a specific file is to use an IFilter.
Actually IFilters are developed to be used by search indexers such as
Windows Desktop Search or SharePoint, but anyone can use the ifilter
in custom code. The IFilter serves as a translater and would read the
textual contents from the file for you, and you can then
programmatically extract the text from the IFIlter.
We are developing a new version of our DWG IFilter. The new version is
able to read files up to AutoCAD 2007 and 2008 - and is expected to be
released in a couple of weeks. A free trial will be available, also it
is free for non-commercial desktop use. For now, you can start testing
with our 2005 trial DWG IFilter, available at www.cadcompany.nl/ifilter
I have not seen VBA samples to use the IFilter in such a way, I would
be interested in helping you here - especially when this results in
cool code samples I can publisch on my IFilter support site. Some
samples in C# and VB are available. I believe you may be able to use
the code sample from the next article:
additionally, the article seems to point to more code samples.
So, if the information you need is text-based, you can use our IFilter
and go with the IFilter trick. You can try this for free.
Alternatively you would need to purchase a dwg reading library.
Good luck, and please keep us posted!
Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here.
All logos and trade names are the property of their respective owners.