Specifies the control points of a spline.
Supported platforms: Windows only
Read-only: No
Type: Variant (array of doubles)
An array of 3D WCS control points for the spline.
You can find out how many control points a spline has by using the NumberOfControlPoints property.
VBA:
Sub Example_ControlPoints() ' This example creates a Spline object in model space, reads the control points ' of the Spline and then modifies the control points of the Spline. Dim splineObj As AcadSpline Dim startTan(0 To 2) As Double, endTan(0 To 2) As Double Dim fitPoints(0 To 8) As Double Dim UserMessage As String Dim ControlPoints As Variant Dim iCount As Long, iPoint As Integer ' Define the Spline object startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0 endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0 fitPoints(0) = 0: fitPoints(1) = 0: fitPoints(2) = 0 fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0 fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0 ' Create new Spline object Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan) ThisDrawing.Application.ZoomAll ' Display control points for this Spline GoSub DISPLAYPOINTS ' Modify control points for this Spline ControlPoints(0) = 3 splineObj.ControlPoints = ControlPoints ThisDrawing.Application.ZoomAll ' Display new control points for this Spline GoSub DISPLAYPOINTS Exit Sub DISPLAYPOINTS: ControlPoints = splineObj.ControlPoints ' Display in groups of three UserMessage = "" iPoint = 0 For iCount = 0 To UBound(ControlPoints) Step 3 iPoint = iPoint + 1 UserMessage = UserMessage & iPoint & ")" & vbTab UserMessage = UserMessage & ControlPoints(iCount) UserMessage = UserMessage & ", " & ControlPoints(iCount + 1) UserMessage = UserMessage & ", " & ControlPoints(iCount + 2) UserMessage = UserMessage & vbCrLf Next MsgBox "The " & splineObj.NumberOfControlPoints & " Spline control points are: " & vbCrLf & vbCrLf & UserMessage Return End Sub
Visual LISP:
(vl-load-com) (defun c:Example_ControlPoints() ;; This example creates a Spline object in model space, reads the control points ;; of the Spline and then modifies the control points of the Spline. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Define the Spline object (setq startTan (vlax-3d-point 0.5 0.5 0) endTan (vlax-3d-point 0.5 0.5 0) fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8))) (vlax-safearray-fill fitPoints '(0 0 0 5 5 0 10 0 0 ) ) ;; Create new Spline object (setq modelSpace (vla-get-ModelSpace doc)) (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan)) (vla-ZoomAll acadObj) ;; Display control points for this Spline (setq ControlPoints (vlax-variant-value (vla-get-ControlPoints splineObj))) ;; Display in groups of three (setq UserMessage "" iPoint 0 iCount 0) (while (>= (vlax-safearray-get-u-bound ControlPoints 1) iCount) (setq iPoint (1+ iPoint)) (setq UserMessage (strcat UserMessage (itoa iPoint) ") " (rtos (nth iCount (vlax-safearray->list ControlPoints)) 2) ", " (rtos (nth (+ iCount 1) (vlax-safearray->list ControlPoints)) 2) ", " (rtos (nth (+ iCount 2) (vlax-safearray->list ControlPoints)) 2) "\n" ) ) (setq iCount (+ iCount 3)) ) (alert (strcat "The " (itoa (vla-get-NumberOfControlPoints splineObj)) " Spline control points are: " "\n\n" UserMessage)) ;; Modify control points for this Spline (setq newFitPoint (vlax-3d-point 8 2 0)) (vla-AddFitPoint splineObj 3 newFitPoint) (setq ControlPoints (vlax-variant-value (vla-get-ControlPoints splineObj))) (vla-ZoomAll acadObj) ;; Display new control points for this Spline (setq UserMessage "" iPoint 0 iCount 0) (while (>= (vlax-safearray-get-u-bound ControlPoints 1) iCount) (setq iPoint (1+ iPoint)) (setq UserMessage (strcat UserMessage (itoa iPoint) ") " (rtos (nth iCount (vlax-safearray->list ControlPoints)) 2) ", " (rtos (nth (+ iCount 1) (vlax-safearray->list ControlPoints)) 2) ", " (rtos (nth (+ iCount 2) (vlax-safearray->list ControlPoints)) 2) "\n" ) ) (setq iCount (+ iCount 3)) ) (alert (strcat "The " (itoa (vla-get-NumberOfControlPoints splineObj)) " Spline control points are: " "\n\n" UserMessage)) )