オブジェクトを分解すると、オブジェクトは単一オブジェクトからその構成要素に変換されますが、視覚的には変化ありません。
分解すると、たとえば 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