3DPolyline、Polyline、または PolygonMesh オブジェクトの端点に頂点を追加します。
サポートされているプラットフォーム: Windows のみ
VBA:
object.AppendVertex Point
タイプ: 3DPolyline、PolygonMesh、Polyline
このメソッドが適用されるオブジェクト。
アクセス: 入力のみ
タイプ: バリアント型(3 要素の倍精度浮動小数点数型配列)
追加する頂点を指定する座標。
PolygonMesh: 追加する頂点の列を指定する 3D WCS 座標の配列。
3DPolyline: 追加する頂点を指定する 3D WCS 座標の配列。
Polyline: 3D 座標の配列。X および Y 座標は OCS で指定され、Z 座標は無視されます。
戻り値はありません。
PolygonMesh: PolygonMesh オブジェクトの端点に頂点を追加すると、頂点の列を追加することになります。たとえば、4 x 3 の PolygonMesh の場合、12 の頂点を定義します。頂点を追加すると 5 x 3 のマトリックスになりますから、3 つの頂点を新たに追加する必要があります。4 x 3 マトリックスの最後の頂点を次のように仮定します。
この場合、追加される頂点は次のようになります。
Polyline オブジェクトの OCS 座標は、TranslateCoordinates メソッドを使用して他の座標系との相互変換が可能です。
VBA:
Sub Example_AppendVertex()
' This example creates a polyline in model space.
' It then appends a vertex to the polyline.
Dim plineObj As AcadPolyline
Dim points(0 To 14) As Double
' Define the 2D polyline points
points(0) = 1: points(1) = 1: points(2) = 0
points(3) = 1: points(4) = 2: points(5) = 0
points(6) = 2: points(7) = 2: points(8) = 0
points(9) = 3: points(10) = 2: points(11) = 0
points(12) = 4: points(13) = 4: points(14) = 0
' Create a lightweight Polyline object in model space
Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
ZoomAll
MsgBox "Append the vertex 4, 1, 0.", , "AppendVertex Example"
Dim newVertex(0 To 2) As Double
newVertex(0) = 4: newVertex(1) = 1: newVertex(2) = 0
plineObj.AppendVertex newVertex
ZoomAll
MsgBox "The vertex 4, 1, 0 as been appended.", , "AppendVertex Example"
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_AppendVertex()
;; This example creates a polyline in model space.
;; It then appends a vertex to the polyline.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Define the 2D polyline points
(setq center (vlax-make-safearray vlax-vbDouble '(0 . 14)))
(vlax-safearray-fill center '(1 1 0
1 2 0
2 2 0
3 2 0
4 4 0
)
)
;; Create a lightweight Polyline object in model space
(setq modelSpace (vla-get-ModelSpace doc))
(setq plineObj (vla-AddPolyline modelSpace points))
(vla-ZoomAll acadObj)
(alert "Append the vertex 4, 1, 0.")
(setq newVertex (vlax-3d-point 4 1 0))
(vla-AppendVertex plineObj newVertex)
(vla-ZoomAll acadObj)
(alert "The vertex 4, 1, 0 as been appended.")
)