Spline from File (Fitcurve Command)

Hello,

I'm trying to create a app that will read a Text file or a Dat File and use the curve fit tool to create a spline around those points.

Looks like something super simple, but I can't figure it out.

my question is how to add the list of 3dpoints to the fitcurve comand?

This is what I have so far, (no point in showing all the script, as everything before this is just cleaning the .dat file)

Function Createcurve(topcurvePoints)

''''create points from list '''''
For Each item As Array In topcurvePoints
lw.WriteLine("X Value = " & item(0))
lw.WriteLine("Y value = " & item(1))

''''create 3dpoint (not a real point)
Dim pointCoord As New Point3d
pointCoord.X = item(0)
pointCoord.Y = item(1)
pointCoord.Z = 0

'''' now create the real point and display it in nx
Dim realPoint As Point
realPoint = workPart.Points.CreatePoint(pointCoord)
realPoint.SetVisibility(SmartObject.VisibilityOption.Visible)

Next

Dim fitCurve As Features.FitCurve = Nothing
Dim curvebuilder As Features.FitCurveBuilder
curvebuilder = workPart.Features.CreateFitCurveBuilder(fitCurve)

curvebuilder.Tolerance = 0.01
curvebuilder.Degree = 9
curvebuilder.Segments = 7

Return Nothing
End Function

Have you recorded a journal while using the fit curve command? It appears that you need to call the .Target.Add method:

curvebuilder.Target.Add(point)

Yes, I forgot to update it here.
the target.add is the way.