请问如何用VBA获取样条曲线的拟合点个数
下面是从屏幕上拾取一条样条曲线并显示其有多少个拟合点的代码片段:dim splineObj as AcadEntity
dim pickedPoint as Variant
ThisDrawing.Utility.GetEntity splineObj,pickedPoint
Msgbox "The selected spline has "&splineObj.NumberofFitPoints&" fitpoints"
但是运行时老是提示“类型不匹配”,请问是什么原因?请知道的朋友指导一下,非常感谢!
帮助里有这个例子
Sub Example_NumberOfFitPoints()
' This example creates a spline object in model space.
' It then finds the number of control points for that spline.
' Create the spline
Dim splineObj As AcadSpline
Dim startTan(0 To 2) As Double
Dim endTan(0 To 2) As Double
Dim fitPoints(0 To 8) As Double
startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
ZoomAll
MsgBox "The Spline has " & splineObj.NumberOfFitPoints & " fit points.", , "NumberOfFitPoints Example"
End Sub
页:
[1]