wjfling 发表于 2003-10-31 11:22:00

VBA中,如何炸开Mline

如何炸开Mlind 为 line
object.Explode不支持呀

zeng29 发表于 2003-11-1 10:05:00

确实如此,希望以的版本能提供这样的方法;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

mccad 发表于 2003-11-1 07:25:00

ActiveX(VBA)对多线的支持太少了,只能通过SendCommand方法来打散。
页: [1]
查看完整版本: VBA中,如何炸开Mline