Exploding blocks

Exploding blocks

Anonymous
Not applicable
1,339 Views
3 Replies
Message 1 of 4

Exploding blocks

Anonymous
Not applicable
I am having a problem that is really starting to irritate me. I am trying to explode a block reference and get the objects in the block back in an array. Here is a very simple version of what I am trying to do:

Public Sub Test()

Dim ent As AcadEntity
Dim block As AcadBlockReference
Dim blockObjects As Variant

For Each ent In ThisDrawing.ModelSpace
If ent.ObjectName = "AcDbBlockReference" Then
Set block = ent
Set blockObjects = block.Explode()
End If
Next

End Sub

But it fails on this line :
Set blockObjects = block.Explode()

I get a Runtime Error '13' : Type Mismatch
I thought explode was supposed to return an array of variants, but maybe I'm mistake. Any help would be greatly appreciated.

Thanks in advance
0 Likes
1,340 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
wrote in message news:[email protected]...
I am having a problem that is really starting to irritate me. I am trying
to explode a block reference and get the objects in the block back in an
array. Here is a very simple version of what I am trying to do:

Public Sub Test()

Dim ent As AcadEntity
Dim block As AcadBlockReference
Dim blockObjects As Variant

For Each ent In ThisDrawing.ModelSpace
If ent.ObjectName = "AcDbBlockReference" Then
Set block = ent

'don't know if this is the problem but you don't "SET" an array,
' Set blockObjects = block.Explode()
'you might try
blockObjects = block.Explode
'hth ????


End If
Next

End Sub

But it fails on this line :
Set blockObjects = block.Explode()

I get a Runtime Error '13' : Type Mismatch
I thought explode was supposed to return an array of variants, but maybe I'm
mistake. Any help would be greatly appreciated.

Thanks in advance
Message 3 of 4

Anonymous
Not applicable
Well don't I feel silly. I could have sworn I tried that, guess not because its working fine now.

Thanks for your help.
0 Likes
Message 4 of 4

jeremye86
Advocate
Advocate

thank you MP,    blockObjects = block.Explode    worked for me as well

0 Likes