Block-Explode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
for years I've used the code down below to explode all blocks in my models - all blocks, regardless whether they are nested or not (a purge in between was not necessary), the last ACAD/ASteel Version we've used was 2019.
Now we've switched to ACAD/ASteel 2023 and the macro isn't working as it should?
It still explode blocks, but does not finish it's job, there are blocks left
I've updated the ACAD Project References to VBA for Applications, AutoCAD 2021 Type Library and OLE Automation?
Did I forget something? The Code still looks fine and should do it's work?
My Test file is a XREF File with ~10 Levels of XRef's which I bind and then the macro should 'kill' all blocks.
It would be nice if someone has an idea and could give me a hint.
kind regards
Code:
Sub block_xplode()
Dim oEnt As AcadEntity
Dim iChoice As Integer
Dim strPrompt As String
Dim strTitle As String
strPrompt = "Entfernt ALLE Bloecke im Modellbereich"
strTitle = "Block-Xplode"
iChoice = MsgBox(strPrompt, vbOKCancel, strTitle)
If iChoice = vbOK Then
For Each oEnt In ThisDrawing.ModelSpace
If TypeOf oEnt Is AcadBlockReference Then
ExpBlock oEnt
End If
On Error Resume Next
Next
Else
Exit Sub
End If
End Sub
Sub ExpBlock(ByRef BR)
Dim varEx As Variant
Dim BRef As AcadBlockReference
Dim i As Double
varEx = BR.Explode
BR.Delete
For i = 0 To UBound(varEx)
If TypeOf varEx(i) Is AcadBlockReference Then
Set BRef = varEx(i)
ExpBlock BRef
End If
Next
End Sub
Moderator edit: Put code in code window. Please read this.