Re: VBA and ObjectDbx - AutoCAD to Excel Attribute Extraction Tool
Sorry about the delay in reply; Rob I could loop through the layouts successfully however when I use the Set attributes function nothing changes. I looked into the code and its because of the row count for the dwg name and the rowcount for the attribs are different any ideas to work around. I hope you understand what I mean. If you want I can attach the modified excel spreadsheet
Re: VBA and ObjectDbx - AutoCAD to Excel Attribute Extraction Tool
I have to thank Katrina for the spreadsheet it helped me to discover the power of ObjectDBX .
Re: VBA and ObjectDbx - AutoCAD to Excel Attribute Extraction Tool
Quote:
Originally Posted by
sujit.subramaniam
Sorry about the delay in reply; Rob I could loop through the layouts successfully however when I use the Set attributes function nothing changes. I looked into the code and its because of the row count for the dwg name and the rowcount for the attribs are different any ideas to work around. I hope you understand what I mean. If you want I can attach the modified excel spreadsheet
I don't think posting the spreadsheet will help. You need to post your code. Please use the code tags in the advanced editor (the # button).
Re: VBA and ObjectDbx - AutoCAD to Excel Attribute Extraction Tool
I know this thread is several months old.. but I'm trying to do the exact same thing.. except I'm doing it through stand-alone VB.NET app instead of through excel. I've been trying to use ObjectDBX, but I can't figure out how to do it. I was using selectionsets, but those don't work with odbx.
How do you iterate through the layouts collection? I know how to do a For... next loop.. that's not what I'm having trouble with. This is my first time automating AutoCAD and I'm not sure what the layouts collection, or how you access it to loop through it.
Re: VBA and ObjectDbx - AutoCAD to Excel Attribute Extraction Tool
Any collection object can be iterated using:
For Each CollectionObjectType In Collection
'perform tasks
Next
Where CollectionObjectType is a variable of the type the collection holds and Collection is an instance of the collection being iterated.
In the case of layouts, the Layout object is a special object that acts as a wrapper for a block of the pattern *PAPER_SPACE#, where # is the number of the block. Blocks starting with an asterisk are called anonymous blocks. Layout blocks store the entities in the layout. You access them using the Layout object's Block property. The block items can be accessed using it's Items collection.
Re: VBA and ObjectDbx - AutoCAD to Excel Attribute Extraction Tool
Ok think that I understand what you're saying... I tried this code.. and it works... sort of... but it's only returning one block when there are two in the file... any idea why?
Dim Block As AXAUTO15Lib.AcadBlock
For Each Block In V_AutoCadInterfaceObject.Blocks
If Block.Name.ToString = "START" Then
MsgBox(Block.Name.ToString)
End If
Next Block
Re: VBA and ObjectDbx - AutoCAD to Excel Attribute Extraction Tool
You are searching the Blocks table for the definition. You need to search paperspace for AcadBlockRef objects, the block insertions.
Re: VBA and ObjectDbx - AutoCAD to Excel Attribute Extraction Tool
Wow... that went right over my head! I'm sorry.. this is my first time ever trying to work with AutoCAD with a program other than very simple AutoLisp programming, and I still haven't quite wrapped my head around it yet.
Any chance you could give some more detail about how you search paperspace for AcadBlockRef objects?
Re: VBA and ObjectDbx - AutoCAD to Excel Attribute Extraction Tool
In case I don't get a chance to get you some code quickly, search this forum for "acadblockref".
Re: VBA and ObjectDbx - AutoCAD to Excel Attribute Extraction Tool
Ok.. I'll try a search and see what I come up with... I'll post back if I find something... thank-you!