Creates a polyline from a list of vertices.
Supported platforms: Windows only
VBA:
RetVal = object.AddPolyline(VerticesList)
Type: Block, ModelSpace, PaperSpace
The objects this method applies to.
Access: Input-only
Type: Variant (array of doubles)
An array of OCS coordinates used to create the polyline vertices. Each vertex is represented with three elements, with the first two being the X and Y coordinates in OCS; the third element is ignored. At least two points (six elements) are required for constructing a polyline object. The array size must be a multiple of three.
To create a polyline containing arcs, first create the straight polyline, and then set the bulge at specific vertices using the SetBulge method.
This method exists for backward compatibility only. Use the AddLightweightPolyline method to create polylines with an optimized format that saves memory and disk space.
Coordinates can be converted to and from the OCS using the TranslateCoordinates method.
VBA:
Sub Example_AddPolyline() ' This example creates a polyline in model space. 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 End Sub
Visual LISP:
(vl-load-com) (defun c:Example_AddPolyline() ;; This example creates a polyline in model space. (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 . 14))) (vlax-safearray-fill points '(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) )