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
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