ライトウェイト ポリラインまたは断面に頂点を追加します。
サポートされているプラットフォーム: Windows のみ
VBA:
object.AddVertex Index, Point
タイプ: LWPolyline、Section
このメソッドが適用されるオブジェクト。
アクセス: 入力のみ
タイプ: 長整数型
頂点を追加する頂点配列のインデックス。インデックスは正の整数。配列の最初の要素は、インデックス 0。
アクセス: 入力のみ
タイプ: バリアント型(3 要素の倍精度浮動小数点数型配列)
新しい頂点を作成する位置を示す 3D OCS 座標。
戻り値はありません。
LWPolyline: 頂点は新しい線分セグメントの終点を指定します。ライトウェイト ポリラインに円弧セグメントを追加するには、まず線分セグメントを作成し、次に、円弧となるセグメントにふくらみ値を追加します。セグメントにふくらみ値を追加するには SetBulge メソッドを使用します。
Section: 頂点は、断面線上の点を指定します。
座標値は、TranslateCoordinates メソッドを使用して OCS との相互変換が可能です。
VBA:
Sub Example_AddVertex()
' This example creates a lightweight polyline in model space.
' It then adds a vertex to the polyline.
Dim plineObj As AcadLWPolyline
Dim points(0 To 9) 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
' Create a lightweight Polyline object in model space
Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
ZoomAll
MsgBox "Add a vertex to the end of the polyline.", , "AddVertex Example"
' Define the new vertex
Dim newVertex(0 To 1) As Double
newVertex(0) = 4: newVertex(1) = 1
' Add the vertex to the polyline
plineObj.AddVertex 5, newVertex
plineObj.Update
MsgBox "Vertex added.", , "AddVertex Example"
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_AddVertex()
;; This example creates a lightweight polyline in model space.
;; It then adds a vertex to the polyline.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Define the 2D polyline points
(setq points (vlax-make-safearray vlax-vbDouble '(0 . 9)))
(vlax-safearray-fill points '(1 1
1 2
2 2
3 2
4 4
)
)
;; Create a lightweight Polyline object in model space
(setq modelSpace (vla-get-ModelSpace doc))
(setq plineObj (vla-AddLightWeightPolyline modelSpace points))
(vla-ZoomAll acadObj)
(alert "Add a vertex to the end of the polyline.")
;; Define the new vertex
(setq newVertex (vlax-make-safearray vlax-vbDouble '(0 . 1)))
(vlax-safearray-fill newVertex '(4 1))
;; Add the vertex to the polyline
(vla-AddVertex plineObj 5 newVertex)
(vla-Update plineObj)
(alert "Vertex added.")
)