PDA

View Full Version : Data extraction with Excel, VBA and...TrueView?



rigoletto
2009-01-15, 03:50 PM
Excel-VBA-data extraction questions…

The business group I work for need to be able to extract data from .dwg files using Excel. They do not have licenses to AutoCad Architecture, and have no budget to purchase them. That is not an option. They do own licenses to TrueView 2008. They need to be able to launch and run the Excel file themselves and cannot rely on anyone else to do the retrieval for them.

The following VBA code should, I think, allow me to retrieve the data the users need from within Excel and present it in the Excel spreadsheet, essentially as AutoCad Architecture data extract process does:

‘-----------------------------
Dim DwgName As String
Dim AcadDbx As AxDbDocument
Dim DwgFile As String

On Error GoTo Error_Control
DwgFile = "<target filespec>"
Set AcadDbx = GetInterfaceObject("ObjectDBX.AxDbDocument.17")
AcadDbx.Open DwgFile
For Each …
…<code to retrieve block data from the open dwg file>
Next
‘-----------------------------

However this results in AutoCad Architecture being launched to open the file. My questions are:

Can TrueView 2008 be used to reveal the object model of a dwg file?

If so, what type library should be included in the Excel file to do so

and…

what VBA code should be substituted for the Set AcadDBX statement above?

I’d be appreciative of any advice on this, and any suggestions for alternatives within the constraints mentioned in the first paragraph.

Thanks!

LB

dgorsman
2009-01-15, 04:00 PM
No, you need AutoCAD to do this unless you get a RealDWG license (if you don't have a budget for AutoCAD then that is definitely out of the question). Oh, and TrueView is free - its not licensed.

The only option I can see is having somebody else generate the Excel files you need in a useable format.

kerbocad
2009-01-15, 08:25 PM
I agree with Dgorsman... The only other option I see is extremely ugly!

it is possible to buy a standalone Dwg to Dxf converter and then write a program to read the raw Dxf file and pull the attributes out.