How I can merge a command into a script?

Hi all.

I do have a certain workflow that require to see the direction of the curves and also occasionally I do need to relocate the starting point of some of the curves. For this purpose I do use a command: Dir one that shows me the direction of the curves and allows me to change the direction of the curves and also I am using a script borrowed from here somewhere but I don’t remember the author, script that allows me to quickly relocate the starting point.

My issue it is that I want to be able to relocate the starting point of the curves without getting in and out all the time from the Dir command.

It is possible somehow to incorporate this two tools together into a single script that can change the starting point by Left click and change the curve direction by Right click without the need to switch all the time between these two commands? It is quite time consuming to reselect all my curves and switching all the time between this two tools.

Best regards.

# ===== change starting point of a closed curve
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))

# Select created POINTS and DELETE them = 2023.02.01
#rs.ObjectsByType(1 | 0, True) ### https://developer.rhino3d.com/api/RhinoScriptSyntax/#selection-ObjectsByType
rs.ObjectsByType(1, True) ###
object_ids = rs.ObjectsByType(1, True)
rs.DeleteObjects(object_ids) # https://developer.rhino3d.com/api/RhinoScriptSyntax/#object-DeleteObjects


Curves_Direction.3dm (70.3 KB)

P.S: It is also possible to configure the Dir command to only show one arrow at the start of the curves instead of two (to get rid of the arrow on the opposite side of the starting point?)

You might want to look at the CrvSeam command, it allows you to change the closed curve seam and flip the direction in the same command.

no, not possible, but what might help a little is to use _ShowEnds to make the start points a little more clear:

1 Like

It is possible to create a macro to start this command to show only the Closed curve seams ? Looks like at every Rhino restart, this command just resets to the default settings?

Yes:

_-ShowEnds _Multipause _ClosedCurveSeams=Yes _OpenCurveStarts=No OpenCurveEnds=No _PolycurveJoints=No