Add3DPoly Method

Back to Methods Reference

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


VBA : RetVal = object.Add3Dpoly(PointsArray)

VL : RetVal = (vla-Add3Dpoly object PointsArray)

(setq myobj (vla-Add3DPoly mspace tmp))

  • Object : ModelSpace Collection, PaperSpace Collection, Block
    The object or objects this method applies to.

  • PointsArray : Variant (array of doubles); input-only
    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.)

  • RetVal : 3DPolyline object
    The newly created 3DPolyline object.


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

Example :

(defun c:al-Add3DPoly ( / mspace pt ptlist tmp myobj)

  (setq mspace (vla-get-modelspace

  (setq pt (getpoint "\nSpecify start point: "))

  ; Start by assembling a list of points
  (setq ptlist (cons pt ptlist))

  (while (setq pt (getpoint "\nSpecify next point: " pt))

    (setq ptlist (cons pt ptlist))


  ; "dissolve" the points into atoms with append:
  (setq ptlist (apply 'append ptlist))

  ; If number of coordinates in point list is not
  ; a multiple of 3 then a lwpolyline can't be made.
  ; If it's a multiple of 3 then put the point
  ; list into an array and pass it on to Add3DPoly:
  (if (= (rem (length ptlist) 3) 0)


        tmp (vlax-make-safearray 
               (cons 0 (- (length ptlist) 1))

      (vlax-safearray-fill tmp ptlist)

      (setq myobj (vla-Add3DPoly mspace tmp))


    (princ "\nError: 3DPoly could not be created")




The AutoLisp/Visual Lisp/VBA Resource Website
Search the WWW Search AfraLisp

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website