VBA can’t explode non-uniformly scaled blocks

As of AutoCAD 2004, VBA can no longer be used to explode non-uniformly scaled blocks although this could easily be done with earlier releases.

Test with the following snippet:

Sub ExplodeNonUniform()
Dim oLine As AcadLine
Dim oBlock As AcadBlock
Dim oBlockRef As AcadBlockReference
Dim StartPoint(2) As Double, EndPoint(2) As Double
StartPoint(0) = 0#: StartPoint(1) = 0#: StartPoint(2) = 0#
EndPoint(0) = 1#: EndPoint(1) = 1#: EndPoint(2) = 1#
Set oBlock = ThisDrawing.Blocks.Add(StartPoint, "widget")
Set oLine = oBlock.AddLine(StartPoint, EndPoint)
Set oBlockRef = ThisDrawing.ModelSpace.InsertBlock(StartPoint, oBlock.Name, 1, 2, 1, 0)
oBlockRef.Explode
'*** above line works in AutoCAD 2002, but not in 2004,5,6,7
oBlockRef.DeleteEnd Sub

Workarounds: Assuming oBlkRef is the reference that you want to explode (and keeping in mind sendcommands own limitations):

thisdrawing.sendcommand ("explode" & vbcr & "(handent " _  & Chr(34) & oBlkRef.Handle & Chr(34) & ")" & vbcr & vbcr)

First Appeared: AutoCAD 2004
Status as of 2008: Still reproducible
Status as of 2009: (unknown)

Leave a Reply