Message 1 of 4
Edit blocks using ObjectDBX in VBA
Not applicable
08-01-2016
06:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Correct me if I'm wrong, but if I want to edit drawings with a VBA program without opening each one of them in AutoCAD, I need to use objectDBX. I'm having a bit of trouble finding enough examples of objectDBX use with VBA and confused on how use it.
Could anyone help me convert this code snippet (taken from @Anonymous: http://forums.autodesk.com/t5/visual-basic-customization/edit-attributes-for-all-blocks-in-drawing/m... ) to use objectDBX, enabling it to be used in a batch process without opening the specific drawings?
The code is basically checking all the blocks in drawings for attributes with tag "My_String" and setting the text to "New Text":
Dim item As Variant
For Each item In ThisDrawing.ModelSpace
If TypeOf item Is AcadBlockReference Then
Dim att As Variant
For Each att In item.GetAttributes
If att.Visible = False Then
If att.TagString = "My_String" Then
att.TextString = "New Text"
End If
End If
Next
End If
Next
(I am not even sure if I'm using the term objectDBX correctly)
Thank you in advance!