分解对象将对象从单个对象转换为其组成部分,但没有可见效果。 例如,分解从 3D 多边形、折线、多边形网格和区域形成简单的直线和圆弧。它将块引用替换为组成块的简单对象的副本。 分解折线本示例创建一个轻量级折线对象。然后,它将折线分解为单独的对象。然后,该示例循环访问生成的对象,并显示一个消息框,其中包含每个对象的名称及其在分解对象列表中的索引。 Sub Ch4_ExplodePolyline()
Dim plineObj As AcadLWPolyline
Dim points(0 To 11) As Double
' Define the 2D polyline points
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
' Create a light weight Polyline object
Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
' Set the bulge on one segment to vary the
' type of objects in the polyline
plineObj.SetBulge 3, -0.5
plineObj.Update
' Explode the polyline
Dim explodedObjects As Variant
explodedObjects = plineObj.Explode
' Loop through the exploded objects
' and display a message box with
' the type of each object
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
相关概念父主题: |
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 22:43
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.