Python - creating a curve through points

I am trying to create a curve which passes through specific point locations.
In Rhino, the command is _curvethroughPt.

What is the Python equivalent? I started out thinking it was rs.AddInterpCurve(points), but this treats the points as control points instead of actually passing through the points.


rs.AddInterpCurve should pass the curve through your points. rs.AddCurve will make a control point curve …

–Mitch

1 Like

Hi Bluekite,

That is exactly what rs.AddInterpCurve() python function does - creates the curve, the way “CurveThroughPt” command does with “CurveType = Interpolated” option. The curve actually passes through initial points.

If you want the same result, as the “CurveThroughPt” command’s option: “CurveType = ControlPoint”, use the rs.AddCurve() function.

OK, I now see that rs.AddInterpCurve did actually pass the curve through my points. The confusion arose when I entered ‘PointsOn’ in Rhino to check the work. The Points which became visible were calculated control points, not the points I had entered as part of my script.

Thanks guys, for your help.

what is a better way of making my points visible as part of the Python script? this is what I have now:

points = (0,0,0),(20,10,0),(50,-10,0),(100,50,0),(200,0,0),(250,10,0)

rs.AddInterpCurve(points)

Which points? Those from your points tuple?
If that is so, try this:

import rhinoscriptsyntax as rs

points = (0,0,0),(20,10,0),(50,-10,0),(100,50,0),(200,0,0),(250,10,0)
rs.AddInterpCurve(points)

pts_ids = rs.AddPoints(points)
rs.ObjectColor(pts_ids, [255,0,0])

Wonderful! thanks so much!