How to change start point of closed curve

I want to change start point of curve by rhino python but not. Please help me solution
I try make code

import rhinoscriptsyntax as rs
#Get Curve
cur=rs.GetObject("Select Cur:",4)
sp=rs.CurveStartPoint(cur)
rs.AddPoint(sp)
point =rs.GetPointOnCurve(cur)
point =rs.coerce3dpoint(point)
cur=rs.coercecurve(cur,-1,True)
cur.SetStartPoint(point)
#cur.SetStartPoint(point)
sp=rs.CurveStartPoint(cur)
rs.AddPoint(sp)

Help me!

I don’t know script, but manually use ‘crvseam’

1 Like

Curve.ChangeClosedCurveSeam

1 Like

You first need to understand the difference between using RhinoCommon “virtual geometry”, and using rhinoscriptsyntax methods, which generally creates/modifies objects that exist in the Rhino file.

The two are not interchangeable. In your script above you are mixing the two without really knowing what you are doing.

RhinoCommon “virtual geometry” does not exist in the document and is not automatically added to the document, you need to specifically do that in another step.

rhinoscriptsyntax generally references objects already in the document and also adds new ones automatically to the document.

I would suggest you stick to rhinoscriptsyntax for now (until such time as RhinoCommon becomes clearer via experience, manuals, tutorials, etc).

import rhinoscriptsyntax as rs

#get Curve
curveID=rs.GetObject("Select Curve",4)
sp=rs.CurveStartPoint(curveID)
rs.AddPoint(sp)
#get new point to change seam to
point=rs.GetPointOnCurve(curveID)
#point=rs.coerce3dpoint(point) - you do not need this

#you need to get the *parameter* of the point on the curve to adjust the seam
param=rs.CurveClosestPoint(curveID,point)
#now change the curve seam
rs.CurveSeam(curveID,param)
#check the result by adding a point
rs.AddPoint(rs.CurveStartPoint(curveID))
2 Likes

Thank you! i will learn more

There’s that for RhinoCommon? Where?

There’s mainly a documentation here.

Yeah, I was looking more for tutorials and some form of organized code samples.

This is not nearly enough:

It is possible to modify this script to adjust automatically the Starting Point of closed curves to the middle of the longest curve segment from Top or Right Side without any additional click from my side?

Almost anything is possible with a bit of work. There might be some ambiguity involved, for example take a square turned at 45° - there would be two “closest” midpoints from either the Top (max X value) or Right (max Y value) side.

Not sure how to interpret this. There will be one (or more) “longest segments” in any closed curve/polycurve. Can you post some examples of curves and where you think the seam should automatically go?

1 Like

I do need this because the CNC machines are always cutting from the starting point of the curves, and if I set all starting points of the curves will result in better cuts as some parts can move on the table otherwise. Will be great if I can also make all the curves to be Counter Clock Wise oriented in the same process.

P.S: I am using your small script all day long but will be better to do this steps automatically.


StartPoint_Relocated.3dm (94.7 KB)