FitPoints プロパティ(ActiveX)

スプラインのフィット点を指定します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.FitPoints
object

タイプ: Spline

このプロパティが適用されるオブジェクト。

プロパティの値

読み込み専用: いいえ

タイプ: バリアント型(倍精度実数の配列)

スプラインのフィット点を表す 3D WCS 座標の配列

注意

フィット点はスプラインのパスを定義します。指定されたフィット点の公差を変更するには、FitTolerance プロパティを使用します。フィット点を追加するには、AddFitPoint メソッドを使用します。フィット点を削除するには、DeleteFitPoint メソッドを使用します。フィット点の位置を取得するには、GetFitPoint メソッドを使用します。指定されたフィット点の位置を変更するには、SetFitPoint メソッドを使用します。

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))  
)