Appends a vertex to the end of a 3DPolyline, Polyline, or PolygonMesh object.
Supported platforms: Windows only
VBA:
object.AppendVertex Point
Type: 3DPolyline, PolygonMesh, Polyline
The objects this method applies to.
Access: Input-only
Type: Variant (three-element array of doubles)
The coordinates specifying the vertex to be appended.
PolygonMesh: An array of 3D WCS coordinates specifying the appended row of vertices.
3DPolyline: An array of 3D WCS coordinates specifying the vertex to append.
Polyline: An array of 3D coordinates. The X and Y coordinates are given in OCS, the Z coordinate is ignored.
No return value.
PolygonMesh: When you append a vertex to the end of a PolygonMesh object, you are appending a row of vertices. For example, for a 4 x 3 PolygonMesh you define 12 vertices. Appending a vertex would make the matrix 5 x 3, thereby requiring three additional coordinates. If the 4 x 3 matrix had the following as its last vertex:
You would append:
The OCS coordinates for the Polyline object can be converted to and from other coordinate systems using the TranslateCoordinates method.
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.")
)