EGoldberg Posted June 1, 2010 Share Posted June 1, 2010 I am trying to finish up my program in VBA and I have one final problem. When I update a block's attribute tag (not text) because we have two attributes with the same tag name and they need to be redefined, I can update it but as soon as it is exploded it goes back to the old name. That is, I've updated the tag successfully, I can see that I have in properties and the Enhanced Attribute Editor, but when I use -battman, it still says the old tag and when I use explode, it goes from my new tag name to the old. Is there anyway to sync this up in VBA? The code for editing my tag is as follows attList = blk.GetAttributes attList(3).TagString = "ASB2" attList(3).Update What am I missing? I'm not much of an AutoCAD user so I'm not sure. Thanks for your help in advance. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 1, 2010 Share Posted June 1, 2010 When exploding / syncing, the block definition as found in the block table will be used I believe. Quote Link to comment Share on other sites More sharing options...
EGoldberg Posted June 1, 2010 Author Share Posted June 1, 2010 Is there any way to access the block table in VBA? If you do not know about VBA what about LISP? Is there a particular definition that is accessed to alter the data via a programming language? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 1, 2010 Share Posted June 1, 2010 Yes, just use the item method on the blocks collection and then you can iterate through the objects that make up the block. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 1, 2010 Share Posted June 1, 2010 in LISP it would be: (vlax-for SubObj (vla-item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object) ) ) "BlockName" ) ... ) Quote Link to comment Share on other sites More sharing options...
EGoldberg Posted June 1, 2010 Author Share Posted June 1, 2010 Lee, thank you so much. I was able to translate the LISP heirarchy to VBA and figure it out. For those who might run into the same problem, to step through the blocks rather than their references, see the following code. For Each ent In ThisDrawing.Blocks If TypeOf ent Is AcadBlock Then ... end if next Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 1, 2010 Share Posted June 1, 2010 Glad I could help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.