确实如此,希望以的版本能提供这样的方法;- Sub ExampleExplodeMline()
- Dim ssetObj As AcadSelectionSet
- Dim i As Integer
- Dim explodedObjects As Variant
-
- Dim OldCount As Long, NewCount As Long
-
- Set ssetObj = ThisDrawing.PickfirstSelectionSet
- ssetObj.Clear
- ssetObj.SelectOnScreen
- If ssetObj.Count <= 0 Then Exit Sub
- On Error Resume Next
- explodedObjects = ssetObj(0).Explode
- If Err Then
- Err.Clear
- OldCount = ThisDrawing.ModelSpace.Count
- Debug.Print "炸开前的实体:"
- For i = 0 To ThisDrawing.ModelSpace.Count
- Debug.Print i & ":" & ThisDrawing.ModelSpace(i).ObjectName
- Next i
- ThisDrawing.SendCommand "_explode (handent " & Chr(34) & ssetObj(0).Handle & Chr(34) & ") " & vbCr
- If OldCount <> ThisDrawing.ModelSpace.Count Then
- Debug.Print "被炸开形成的实体:"
- For i = OldCount - 1 To ThisDrawing.ModelSpace.Count
- Debug.Print i & ":" & ThisDrawing.ModelSpace(i).ObjectName
- Next i
- End If
- Debug.Print "炸开后的实体:"
- For i = 0 To ThisDrawing.ModelSpace.Count
- Debug.Print i & ":" & ThisDrawing.ModelSpace(i).ObjectName
- Next i
- Exit Sub
- End If
- On Error GoTo 0
- ' Loop through the exploded objects
-
- For i = 0 To UBound(explodedObjects)
- explodedObjects(i).Update
- MsgBox "Exploded Object " & i & ": " & explodedObjects(i).ObjectName, , "Explode Example"
- explodedObjects(i).color = acByLayer
- explodedObjects(i).Update
- Next
-
- End Sub
|