iCAx开思网

标题: 样条曲线 [打印本页]

作者: gladchen    时间: 2006-6-9 10:28
标题: 样条曲线
那位帮着给看看,我写的这个样条曲线错在哪儿了?


Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim boolstatus As Boolean
Dim sketchSpl() As SketchSpline
Dim Px(10) As Double
Dim Py(10) As Double
Dim i As Long

Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID("前视基准面", "LANE", 0, 0, 0, False, 0, Nothing)
Part.ClearSelection2 True

Px(0) = 0
Px(1) = 0.314
Px(2) = 0.628
Px(3) = 0.942
Px(4) = 1.256
Px(5) = 1.57
Px(6) = 1.884
Px(7) = 2.199
Px(8) = 2.513
Px(9) = 2.827
Py(0) = 0
Py(1) = 0.309
Py(1) = 0.587
Py(2) = 0.809
Py(3) = 0.951
Py(4) = 1
Py(5) = 0.951
Py(6) = 0.951
Py(7) = 0.809
Py(8) = 0.587
Py(9) = 0.309

ReDim sketchSpl(10)

For i = 0 To 9
    Set sketchSpl() = Part.SketchSpline(i, Px(i), Py(i), 0)
Next i

Part.ViewZoomtofit2

End Sub




欢迎光临 iCAx开思网 (https://www.icax.org/) Powered by Discuz! X3.3