頂点のリストからポリメッシュを作成します。
サポートされているプラットフォーム: Windows のみ
VBA:
RetVal = object.AddPolyfaceMesh(VerticesList, FaceList)
タイプ: Block、ModelSpace、PaperSpace
このメソッドが適用されるオブジェクト。
アクセス: 入力のみ
タイプ: バリアント型(倍精度浮動小数点数型配列)
ポリメッシュの頂点が作成される 3D WCS 座標の配列。ポリメッシュ オブジェクトを構成するには、少なくとも 4 つの点(12 個の倍精度浮動小数点数型)が必要です。配列サイズは、3 の倍数でなければなりません。
アクセス: 入力のみ
タイプ: バリアント型(整数型配列)
各面の頂点の番号を示す整数の配列。面は 4 つの頂点のインデックス値のグループ内で定義されるため、配列サイズは 4 の倍数でなければなりません。
ポリメッシュの作成は、矩形メッシュの作成に似ています。ポリメッシュを作成するには、面を構成するすべての頂点の番号と、その頂点の座標を指定します。
次の図では、面 1 は頂点 1、5、6、2 で定義しています。面 2 は頂点 1、4、3、2 で定義しています。面 3 は頂点 1、4、7、5 で定義しています。面 4 は頂点 3、4、7、8 で定義しています。

エッジを非表示にするには、エッジの頂点番号に負の値を入力します。たとえば下の図で頂点 5 および 7 の間のエッジを非表示にするには、次のように設定します。
面 3、頂点 3: -7

VBA:
Sub Example_AddPolyfaceMesh()
Dim vertexList(0 To 17) As Double
'Data
vertexList(0) = 4: vertexList(1) = 7: vertexList(2) = 0
vertexList(3) = 5: vertexList(4) = 7: vertexList(5) = 0
vertexList(6) = 6: vertexList(7) = 7: vertexList(8) = 0
vertexList(9) = 4: vertexList(10) = 6: vertexList(11) = 0
vertexList(12) = 5: vertexList(13) = 6: vertexList(14) = 0
vertexList(15) = 6: vertexList(16) = 6: vertexList(17) = 1
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
Dim obj As AcadPolyfaceMesh
Set obj = ModelSpace.AddPolyfaceMesh(vertexList, FaceList)
obj.Update
' 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
Visual LISP:
(vl-load-com)
(defun c:Example_AddPolyfaceMesh()
;; This example creates a polyface mesh in model space
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Define the vertices for the polyface mesh
(setq vertexList (vlax-make-safearray vlax-vbDouble '(0 . 17)))
(vlax-safearray-fill vertexList '(4 7 0
5 7 0
6 7 0
4 6 0
5 6 0
6 6 1
)
)
;; Define the face order for the polyface mesh
(setq FaceList (vlax-make-safearray vlax-vbInteger '(0 . 7)))
(vlax-safearray-fill FaceList '(1
2
5
4
2
3
6
5
)
)
(setq modelSpace (vla-get-ModelSpace doc))
(setq obj (vla-AddPolyfaceMesh modelSpace vertexList FaceList))
;; Change the viewing direction of the viewport to
;; better see the polyface mesh
(setq NewDirection (vlax-3d-point -1 -1 1))
(setq activeViewport (vla-get-ActiveViewport doc))
(vla-put-Direction activeViewport NewDirection)
(vla-put-ActiveViewport doc activeViewport)
(vla-ZoomAll acadObj)
)