VBA equivilent for BURST code help needed, sample code provided.

VBA equivilent for BURST code help needed, sample code provided.

Anonymous
Not applicable
549 Views
3 Replies
Message 1 of 4

VBA equivilent for BURST code help needed, sample code provided.

Anonymous
Not applicable
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
0 Likes
550 Views
3 Replies
Replies (3)
Message 2 of 4

RonnieWilkins
Advocate
Advocate
How would you like to handle dynamic blocks that have multiple view representations?

Only *BURST* the active view?
Ronnie Wilkins, Jr.
0 Likes
Message 3 of 4

Anonymous
Not applicable
yes, only burst active visibility state.
wrote in message news:4860961@discussion.autodesk.com...
How would you like to handle dynamic blocks that have multiple view
representations?

Only *BURST* the active view?
0 Likes
Message 4 of 4

Anonymous
Not applicable
I figured out a way....Thanks all.


"Dan" wrote in message
news:4860907@discussion.autodesk.com...
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
0 Likes