Message 1 of 4
VBA equivilent for BURST code help needed, sample code provided.

Not applicable
05-31-2005
10:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This works, kinda, on regular block, but not Dynamic blocks.
I need this to work on dynamic blocks.
Any ideas?
Thanks, Dan
Dim objHarm As AcadBlockReference
Dim varAttributes As Variant
Dim objAttRef As AcadAttributeReference
Dim intJ As Integer
Dim intAttLoop As Integer
Dim arrayExpBlock As Variant
'ThisDrawing.Utility.GetEntity objHarm, BasePnt, "Select Dynamic Block:"
On Error GoTo ErrorControl
For Each objHarm In ThisDrawing.ModelSpace
If objHarm.ObjectName = "AcDbBlockReference" Then
' get all the attributtes from desired block and put them into
array
varAttributes = objHarm.GetAttributes
' explode the desired block and put all it's objects into an
array
arrayExpBlock = objHarm.Explode
' delete the block because otherwise you would stuck with block
and exploded elements one on another
objHarm.Delete
For intJ = LBound(arrayExpBlock) To UBound(arrayExpBlock)
If arrayExpBlock(intJ).ObjectName = "AcDbAttributeDefinition"
Then
For intAttLoop = LBound(varAttributes) To
UBound(varAttributes)
Set objAttRef = varAttributes(intAttLoop)
If objAttRef.TagString = arrayExpBlock(intJ).TagString
Then
arrayExpBlock(intJ).TagString = objAttRef.TextString
End If
Next intAttLoop
End If
Next intJ
End If
Next
Exit Sub
ErrorControl:
MsgBox "Error No " & Err.Number & " - " & Err.Description
Err.Clear
I need this to work on dynamic blocks.
Any ideas?
Thanks, Dan
Dim objHarm As AcadBlockReference
Dim varAttributes As Variant
Dim objAttRef As AcadAttributeReference
Dim intJ As Integer
Dim intAttLoop As Integer
Dim arrayExpBlock As Variant
'ThisDrawing.Utility.GetEntity objHarm, BasePnt, "Select Dynamic Block:"
On Error GoTo ErrorControl
For Each objHarm In ThisDrawing.ModelSpace
If objHarm.ObjectName = "AcDbBlockReference" Then
' get all the attributtes from desired block and put them into
array
varAttributes = objHarm.GetAttributes
' explode the desired block and put all it's objects into an
array
arrayExpBlock = objHarm.Explode
' delete the block because otherwise you would stuck with block
and exploded elements one on another
objHarm.Delete
For intJ = LBound(arrayExpBlock) To UBound(arrayExpBlock)
If arrayExpBlock(intJ).ObjectName = "AcDbAttributeDefinition"
Then
For intAttLoop = LBound(varAttributes) To
UBound(varAttributes)
Set objAttRef = varAttributes(intAttLoop)
If objAttRef.TagString = arrayExpBlock(intJ).TagString
Then
arrayExpBlock(intJ).TagString = objAttRef.TextString
End If
Next intAttLoop
End If
Next intJ
End If
Next
Exit Sub
ErrorControl:
MsgBox "Error No " & Err.Number & " - " & Err.Description
Err.Clear