Creates a 3D polyline
from the given array of coordinates.
Signature
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.
Remarks
To close the polyline,
use the Closed property on the 3DPolyline object.
Example :
(defun c:al-Add3DPoly ( / mspace pt ptlist tmp myobj)
(vl-load-com)
(setq mspace (vla-get-modelspace
(vla-get-activedocument
(vlax-get-acad-object))))
(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))
);while
; "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)
(progn
(setq
tmp (vlax-make-safearray
vlax-vbDouble
(cons 0 (- (length ptlist) 1))
)
)
(vlax-safearray-fill tmp ptlist)
(setq myobj (vla-Add3DPoly mspace tmp))
);progn
(princ "\nError: 3DPoly could not be created")
);if
(princ)
);defun
|
|