
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Long time reader first time poster.
I have this program that pulls all Layers, Text, and Blocks (including attribute values) from a set dwgs into Access. I used to use AcadDocument method (keeping the app hidden in the background) and everything worked great. However, out of speed complaints, I switched over to ObjectDBX. Everything, is working great until I try to pull blocks that are embedded in MLeaders. It seems to me that the ContentBlockName property of the MLeader does not work in ObjectDBX. Can anyone else confirm this? If so, does anyone have and clever ideas to get around it?
A short code sample is below. I am using late binding. The code is running in Access 2013 (32-bit) and hitting AutoCAD 2015 (64-bit) on a Win 8.1 machine.
Any help is much appreciated so that I can stop banging my head against the wall.
Dim acadApp As Object 'AcadApplication Dim acadDBX As Object 'AxDbDocument Dim acadEnt As Object 'AcadEntity Dim sBlock As String Dim O As Object 'AcadEntity Set acadApp = CreateObject("AutoCAD.Application") For Each vFile In colFiles 'This was the old method of opening the document (which worked) Set acadDoc = acadApp.Documents.Open(vFile, False) Set acadDBX = acadApp.GetInterfaceObject("ObjectDBX.AxDbDocument." & Left(acadApp.Version, 2)) acadDBX.Open vFile For Each acadEnt In acadDBX.ModelSpace Select Case acadEnt.EntityType Case 21, 32 'Do Stuff Case 7 'Do Stuff Case 48 sBlock = acadEnt.ContentBlockName '<<<< This is the line where the error occurs For Each O In acadDBX.Blocks(sBlock) If O.ObjectName = "AcDbAttributeDefinition" Then MsgBox acadEnt.GetBlockAttributeValue(O.ObjectID) End If Next End Select Next Next vFile
Solved! Go to Solution.