AddPolyfaceMesh メソッドを使用して、各面が多数の頂点を持つことができるポリメッシュを作成します。
ポリメッシュの作成は、矩形メッシュの作成に似ています。ポリメッシュを作成するには、すべての頂点の座標を指定し、次に面のすべての頂点に頂点番号を入力してそれぞれの面を定義します。ポリメッシュを作成すると、特定のエッジを非表示としたり、画層に割り当てたり、色を付けたりすることができます。
エッジを非表示にするには、エッジの頂点の番号を負の値にして入力します。
次の例は、モデル空間に PolyfaceMesh オブジェクトを作成します。メッシュの 3 次元的な特質をより明確に表示できるように、アクティブ ビューポートのビュー方向を更新します。
Sub Ch8_CreatePolyfaceMesh()
'Define the mesh vertices
Dim vertex(0 To 17) As Double
vertex(0) = 4: vertex(1) = 7: vertex(2) = 0
vertex(3) = 5: vertex(4) = 7: vertex(5) = 0
vertex(6) = 6: vertex(7) = 7: vertex(8) = 0
vertex(9) = 4: vertex(10) = 6: vertex(11) = 0
vertex(12) = 5: vertex(13) = 6: vertex(14) = 0
vertex(15) = 6: vertex(16) = 6: vertex(17) = 1
' Define the face list
Dim FaceList(0 To 7) As Integer
FaceList(0) = 1
FaceList(1) = 2
FaceList(2) = 5
FaceList(3) = 4
FaceList(4) = 2
FaceList(5) = 3
FaceList(6) = 6
FaceList(7) = 5
' Create the polyface mesh
Dim polyfaceMeshObj As AcadPolyfaceMesh
Set polyfaceMeshObj = ThisDrawing.ModelSpace.AddPolyfaceMesh _
(vertex, FaceList)
' Change the viewing direction of the viewport to
' better see the polyface mesh
Dim NewDirection(0 To 2) As Double
NewDirection(0) = -1
NewDirection(1) = -1
NewDirection(2) = 1
ThisDrawing.ActiveViewport.direction = NewDirection
ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
ZoomAll
End Sub