I started a thread in the script forum because a script i’ve used for a while doesn’t work in v6, after some testing I traced the problem to join. In v5 if I join 2 curves into a closed curve the start point will be at the end of the first curve selected but in V6 it’s moved to a random place. See attached screencast and file. Any workarounds will be appreciated.
Mark, that clip is impossible to follow - but looking at your files and running Join I see the difference - looks like running SimplifyCrv first helps in V6.
At what point are you running simplify? If you look at the thread in the script forum you’ll see I’m trying to split a closed curve and set a start point. The script works fine in V5 but the start point is moved to random places.
The screencast was supposed to show that joining in V6 moves the startpoint to a point not where either curve started or ended, in V5 the start is always at the end of the first curve selected.
Hi Mark - I do see the difference in Join - for now, I’d say your script could check the version of Rhino running and direct the flow to one or the other accordingly.
The reverse trick doesn’t work on the curve in this post. I tried simplify but it still moves the start to the wrong place.
I can get the start in either of the black circles below but not the red one where I need it. I need to set where the start point is needed then a pause point just before it so can’t really pick the points in the opposite order.
Sorry didn’t explain very well.
You start with a closed curve and need to move start to a more convenient place so the first pick is where the start is needed then the second in a pause point just before. The script can handle one or 2 closed curves, if only one just hit enter after the first selection. I’ve attached the original curve and a screencast done in V5. I’ve experimented with simplify and reversing the list of curves but can’t get the start of the curve correct in V6. I’ve attached my original script and one for V6 I’ll look at combining when the V6 one works.temp.3dm (33.5 KB) SplitCurveV6.py (3.4 KB) SplitCurve.py (3.1 KB)
Hi Mark - I’d force the issue and set the seam point explicitly, then you don’t have to care what Rhino does.
param = rs.CurveClosestPoint(curve2, point[1])
newCurve += rs.SplitCurve( curve2, param )
rs.AddPoint(point[1])
if newCurve:
joinedCrv = rs.JoinCurves(newCurve, True)[0]
if joinedCrv:
if rs.IsCurveClosed(joinedCrv):
crvGeo = sc.doc.Objects.Find(joinedCrv).Geometry #<<< Import scriptcontext as sc at the top of the script
crvGeo.ChangeClosedCurveSeam(point[1]) #<<< or whatever point works for the process
sc.doc.Objects.Replace(joinedCrv,crvGeo)
Hi Pascal
Not sure if I’m missing something. Just testing on a single closed curve with the script below and getting an error from ChangeClosedCurveSeam, I think it’s expecting a domain not a point but not sure?
import rhinoscriptsyntax as rs
import scriptcontext as sc
def SetStartStop(curve):
if curve and rs.IsCurve(curve):
if rs.IsCurveClosed(curve):
rs.Command('_CrvSeam _selid ' + str(curve) + ' _Enter')
else:
rs.Command('_dir _selid ' + str(curve) + ' _Enter')
stpoint = rs.CurveStartPoint(curve)
stpointid = rs.AddPoint(stpoint)
point = rs.GetPointOnCurve(curve, "Pick stop point")
if point:
#rs.AddPoint(point)
param = rs.CurveClosestPoint(curve, point)
#print "Curve parameter:", param
newCurve = rs.SplitCurve( curve, param )
if newCurve:
joinedCrv = rs.JoinCurves(newCurve, True)[0]
if joinedCrv:
if rs.IsCurveClosed(joinedCrv):
crvGeo = sc.doc.Objects.Find(joinedCrv).Geometry #<<< Import scriptcontext as sc at the top of the script
crvGeo.ChangeClosedCurveSeam(stpoint) #<<< or whatever point works for the process
sc.doc.Objects.Replace(joinedCrv,crvGeo)
rs.DeleteObject(stpointid)
return(joinedCrv)