AddLightWeightPolyline Method (ActiveX)

Creates a lightweight polyline from a list of vertices.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddLightWeightPolyline(VerticesList)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

VerticesList

Access: Input-only

Type: Variant (array of doubles)

The array of 2D OCS coordinates specifying the vertices of the polyline. At least two points (four elements) are required for constructing a lightweight polyline. The array size must be a multiple of 2.

Return Value (RetVal)

Type: LightweightPolyline

The newly created LightweightPolyline object.

Remarks

The vertices specify the endpoints for the line segments that make up the polyline. To add an arc segment, first create the polyline with all line segments, and then add a bulge to the individual segments you want to be arcs. To add a bulge value to a segment, use the SetBulge method.

The elevation for the polyline will be set at the current elevation for the layout. Use the ElevationModelspace or ElevationPaperspace property to determine the elevation for the polyline.

Coordinates can be converted to and from the OCS using the TranslateCoordinates method.

Examples

VBA:

Sub Example_AddLightWeightPolyline()
    ' This example creates a lightweight polyline in model space.
    
    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
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddLightWeightPolyline()
    ;; This example creates a lightweight 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 . 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)
)