Add3DPoly Method (ActiveX)

Creates a 3D polyline from the given array of coordinates.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.Add3Dpoly(PointsArray)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

PointsArray

Access: Input-only

Type: Variant (array of doubles)

An array of 3D WCS coordinates. The polyline will be created according to the order of the coordinates in the array. The number of elements in the array must be a multiple of three. (Three elements define a single coordinate.)

Return Value (RetVal)

Type: 3DPolyline

The newly created 3DPolyline object.

Remarks

To close the polyline, use the Closed property on the 3DPolyline object.

Examples

VBA:

Sub Example_Add3DPoly()
    
    Dim polyObj As Acad3DPolyline
    Dim points(0 To 8) As Double
    
    ' Create the array of points
    points(0) = 0: points(1) = 0: points(2) = 0
    points(3) = 10: points(4) = 10: points(5) = 10
    points(6) = 30: points(7) = 20: points(8) = 30
    
    ' Create a 3DPolyline in model space
    Set polyObj = ThisDrawing.ModelSpace.Add3DPoly(points)
    ZoomAll
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Add3DPoly()
    ;; This example creates a 3 segment 3D polyline in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Create the array of points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(0 0 0
                                  10 10 10
                                  30 20 30
                                 )
    )  
    
    ;; Create a 3D polyline in model space
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq polyObj (vla-Add3DPoly modelSpace points))
    (vla-ZoomAll acadObj)
)