Issue
Parameterization is not uniform, a linear sequence in parameter space would not necessarily correspond to a uniform spacing in model space (in general it is not).If you want even spacing in model space, use GetParamAtLength (iteratively).
Solution
The sample VBA code shown below demonstrates the same. The sample code assumes that you have a spline in part sketch.
Sub geteqdistptAss() ' assume we have had Inventor application Dim oDoc As PartDocument oDoc = _InvApplication.ActiveDocument Dim oTG As TransientGeometry oTG = _InvApplication.TransientGeometry Dim oDef As PartComponentDefinition oDef = oDoc.ComponentDefinition Dim oSketch As PlanarSketch oSketch = oDef.Sketches(1) ' Get the spline on a planar sketch Dim oSpline As SketchSpline oSpline = oSketch.SketchSplines(1) Dim oEval As Curve2dEvaluator oEval = oSpline.Geometry.Evaluator Dim dmin As Double Dim dmax As Double oEval.GetParamExtents(dmin, dmax) ' Get the curve length Dim dLen As Double Call oEval.GetLengthAtParam(dmin, dmax, dLen) Dim dInc As Double dInc = dLen / 100 'consider 100 points Dim dLenInc As Double dLenInc = 0 Dim dparams(0) As Double dparams(0) = dmin Dim iCnt As Integer
For iCnt = 0 To 100 Dim dParam As Double Call oEval.GetParamAtLength(dmin, dLenInc, dParam) ' a spline in planar sketch is 2d. its points are ‘ 2d (x,y) Dim dPts(1) As Double dparams(0) = dParam Call oEval.GetPointAtParam(dparams, dPts) dmin = dParam Dim oPt2d As Point2d oPt2d = oTG.CreatePoint2d(dPts(0), dPts(1)) Dim oPt3d As Point oPt3d = oSketch.SketchToModelSpace(oPt2d) 'add the point as a work point oDef.WorkPoints.AddFixed(oPt3d, False) dLenInc = dLenInc + dInc Next End Sub

Leave a Reply