指定样条曲线的拟合点。 支持的平台:仅窗口 属性值只读:不 类型:变体(双打数组) 表示样条拟合点的三维 WCS 坐标数组。 言论拟合点定义样条曲线的路径。您可以使用属性更改给定拟合点的公差。您可以使用该方法添加适合点。您可以使用该方法删除适合点。可以使用该方法查询拟合点的位置。您可以使用该方法更改给定拟合点的位置。FitToleranceAddFitPointDeleteFitPointGetFitPointSetFitPoint 例子工 务 局: 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)) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:39
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.