FitPoints Property (ActiveX)

Specifies the fit points of a spline.

Supported platforms: Windows only

Signature

VBA:

object.FitPoints
object

Type: Spline

The object this property applies to.

Property Value

Read-only: No

Type: Variant (array of doubles)

An array of 3D WCS coordinates representing the fit points of the spline.

Remarks

The fit points define the path of the spline. You can change the tolerance of a given fit point by using the FitTolerance property. You can add a fit point by using the AddFitPoint method. You can delete a fit point by using the DeleteFitPoint method. You can query the location of a fit point by using the GetFitPoint method. You can change the location of a given fit point by using the SetFitPoint method.

Examples

VBA:

Sub Example_FitPoints()
    ' This example creates a Spline object in model space, reads the fit points
    ' of the Spline and then modifies the fit points of the Spline.

    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double, endTan(0 To 2) As Double
    Dim FPoints(0 To 8) As Double
    Dim UserMessage As String
    Dim fitPoints As Variant
    Dim iCount As Long, iPoint As Integer
    Dim NewFP(0 To 2) As Double
    
    ' 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
    FPoints(0) = 0: FPoints(1) = 0: FPoints(2) = 0
    FPoints(3) = 5:   FPoints(4) = 5: FPoints(5) = 0
    FPoints(6) = 10: FPoints(7) = 0: FPoints(8) = 0
    
    ' Create new Spline object
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(FPoints, startTan, endTan)
    ThisDrawing.Application.ZoomAll
    
    ' Display fit points for this Spline
    GoSub DISPLAYPOINTS
    
    ' Modify an existing fit point for this Spline
    fitPoints(0) = 3
    splineObj.fitPoints = fitPoints
    
    ' Now add a new fit point
    NewFP(0) = 15: NewFP(1) = 4: NewFP(2) = 0
    splineObj.AddFitPoint splineObj.NumberOfFitPoints + 1, NewFP
        
    ThisDrawing.Application.ZoomAll
            
    ' Display new fit points for this Spline
    GoSub DISPLAYPOINTS
        
    Exit Sub
    
DISPLAYPOINTS:
    fitPoints = splineObj.fitPoints
    
    ' Display in groups of three
    UserMessage = ""
    iPoint = 0
    For iCount = 0 To UBound(fitPoints) Step 3
        iPoint = iPoint + 1
        UserMessage = UserMessage & iPoint & ")" & vbTab
        UserMessage = UserMessage & fitPoints(iCount)
        UserMessage = UserMessage & ", " & fitPoints(iCount + 1)
        UserMessage = UserMessage & ", " & fitPoints(iCount + 2)
        UserMessage = UserMessage & vbCrLf
    Next
    
    MsgBox "The " & splineObj.NumberOfFitPoints & " Spline fit points are: " & vbCrLf & vbCrLf & UserMessage
    
    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FitPoints()
    ;; This example creates a Spline object in model space, reads the fit points
    ;; of the Spline and then modifies the fit 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 fit points for this Spline
    (setq fitPoints (vlax-variant-value (vla-get-FitPoints splineObj)))
    
    ;; Display in groups of three
    (setq UserMessage ""
          iPoint 0
	         iCount 0)

    (while (>= (vlax-safearray-get-u-bound fitPoints 1) iCount)
        (setq iPoint (1+ iPoint))
        (setq UserMessage (strcat UserMessage (itoa iPoint) ")  "
                                  (rtos (vlax-safearray-get-element fitPoints iCount) 2) ",  "
                                  (rtos (vlax-safearray-get-element fitPoints (+ iCount 1)) 2) ",  "
                                  (rtos (vlax-safearray-get-element fitPoints (+ iCount 2)) 2) "\n"))
        (setq iCount (+ iCount 3))
    )
    
    (alert (strcat "The " (itoa (vla-get-NumberOfFitPoints splineObj)) " Spline fit points are: \n\n" UserMessage))
    
    ;; Modify an existing fit point for this Spline
    (vlax-safearray-put-element fitPoints 0 3)
    (vla-put-FitPoints splineObj fitPoints)
    
    ;; Now add a new fit point
    (setq NewFP (vlax-3d-point 15 4 0))
  
    (vla-AddFitPoint splineObj (+ (vla-get-NumberOfFitPoints splineObj) 1) NewFP)
        
    (vla-ZoomAll acadObj)
            
    ;; Display new fit points for this Spline
    (setq fitPoints (vlax-variant-value (vla-get-FitPoints splineObj)))

    (setq UserMessage ""
          iPoint 0
	         iCount 0)

    (while (>= (vlax-safearray-get-u-bound fitPoints 1) iCount)
        (setq iPoint (1+ iPoint))
        (setq UserMessage (strcat UserMessage (itoa iPoint) ")  "
                                  (rtos (vlax-safearray-get-element fitPoints iCount) 2) ",  "
                                  (rtos (vlax-safearray-get-element fitPoints (+ iCount 1)) 2) ",  "
                                  (rtos (vlax-safearray-get-element fitPoints (+ iCount 2)) 2) "\n"))
        (setq iCount (+ iCount 3))
    )

    (alert (strcat "The " (itoa (vla-get-NumberOfFitPoints splineObj)) " Spline fit points are: \n\n" UserMessage))  
)