- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, experts,
It is a 3D spline in a sweep which has non-evenly distributed sketch points in it. I want to extract parameter values (in parameter space) of these sketch points. I try to use "CurveEvaluator.GetParamAtPoint Method". But It does not work through. See the code below and the part is attached.
Please help! Thank you very much!
Public Sub Curve_evaluator()
'On Error Resume Next
Dim oSpline3D As SketchSpline3D
Set oSpline3D = ThisApplication.CommandManager.Pick(kSketch3DCurveSplineFilter, "Select a sketch 3D Spline. Esc to quit.")
'----go through each point and get its parameter
Dim oFitPoint_Count As Integer
oFitPoint_Count = oSpline3D.FitPointCount
Dim oParam() As Double
ReDim oParam(1 To oFitPoint_Count) As Double
' Get the evaluator from the curve.
Dim oCurveEval As CurveEvaluator
'Set oCurveEval = oEdge.evaluator
Set oCurveEval = oSpline3D.Geometry.evaluator
' Get the parametric range of the curve.
Dim dMinParam As Double
Dim dMaxParam As Double
Call oCurveEval.GetParamExtents(dMinParam, dMaxParam)
Debug.Print vbCr & "dMinParam : " & dMinParam & vbCr & "dMaxParam : " & dMaxParam
Dim currentParam As Double
Dim i As Integer
For i = 1 To oFitPoint_Count
currentParam = dMinParam + ((dMaxParam - dMinParam) / oFitPoint_Count) * (i - 1)
Dim fst_point(2) As Double
Dim fst_param(0) As Double
Dim deviate_param(0) As Double
Dim sec_param(0) As Double
Dim sol_param(0) As SolutionNatureEnum
fst_param(0) = currentParam - 0.2
fst_point(0) = oSpline3D.FitPoint(i).Geometry.x
fst_point(1) = oSpline3D.FitPoint(i).Geometry.y
fst_point(2) = oSpline3D.FitPoint(i).Geometry.Z
'----There is problem with this line when runing---
Call oCurveEval.GetParamAtPoint(fst_point, fst_param, deviate_param, sec_param, sol_param)
oParam(i) = fst_param(0)
Debug.Print "currentParam: " & Format(currentParam, "0.00") & _
" first_param: " & Format(fst_param(0), "0.00") & _
" first_point: " & Format(fst_point(0), "0.00") & "," & _
Format(fst_point(1), "0.00") & "," & _
Format(fst_point(2), "0.00") & _
" second_param: " & Format(sec_param(0), "0.00") & _
" solution_no: " & Format(sol_param(0), "0.00")
Next i
End Sub
Limin
Inventor pro 2023 64 bit update 5.3; Windows 11 pro 64 bit version 24H2; Office 2013 64 bit
Solved! Go to Solution.