wholin 发表于 2006-9-14 21:37:00

块打散后的图元如何取得?

可不可以打散一个块后将其中的图元添加到一个选择集中/
用vba如何能实现呢?

wyj7485 发表于 2006-9-26 08:53:00

块打散后本身就在数组中

chman 发表于 2006-9-28 17:50:00

Sub Ch4_ExplodePolyline()
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 11) As Double
   
    ' 定义二维多段线的点
    points(0) = 1:points(1) = 1
    points(2) = 1:points(3) = 2
    points(4) = 2:points(5) = 2
    points(6) = 3:points(7) = 2
    points(8) = 4:points(9) = 4
    points(10) = 4:points(11) = 1
      
    ' 创建优化多段线对象
    Set plineObj = ThisDrawing.ModelSpace. _
                  AddLightWeightPolyline(points)
   
    ' 在某个线段上设置凸度以改变
    ' 多段线中的对象类型
    plineObj.SetBulge 3, -0.5
    plineObj.Update
   
    ' 分解多段线
    Dim explodedObjects As Variant
    explodedObjects = plineObj.Explode
   
    ' 遍历分解的对象
    ' 并以消息框来显示
    ' 每个对象的类型
    Dim I As Integer
    For I = 0 To UBound(explodedObjects)
    explodedObjects(I).Update
      MsgBox "Exploded Object " & I & ": " & _
                  explodedObjects(I).ObjectName
      explodedObjects(I).Update
    Next
End Sub
vba帮助里面的东东如果块很多就用数组来存储explodedObjects
页: [1]
查看完整版本: 块打散后的图元如何取得?