Bug in SplitCurve creating 3 curves instead of two

Hi,

I have a mesh and I am trying to split the outline of the mesh into two curves. This seems relatively simple using rs.splitcurve however this code:

Curves=rs.SplitCurve(Outline,(CuttingPoint1,CuttingPoint2))

(where CuttingPoint1 & CuttingPoint2 lie in the domain of Outline)

gives me 3 curves. It seems like it is splitting the curve at the two supplied cutting points as well as the seam.

Additionally, if I try to move the seam to one of the cutting points:

rs.CurveSeam(Outline,CuttingPoint1)

and then run the splitcurve as above, the curve does not split at all.

For now I am able to get around this by using the TrimCurve function twice however this seems inefficient, especially when it seems like the splitcurve function should achieve this.

Am I doing something wrong with the SplitCurve function or is this a bug?

Once you have moved the curve seam to one of the split points, all you need to to is use the other parameter for a split point, although it should theoretically work with both as well… works here on my quick test…

rs.CurveSeam(Outline,CuttingPoint1)
Curves=rs.SplitCurve(Outline,CuttingPoint2)

or

Curves=rs.SplitCurve(Outline,[CuttingPoint1,CuttingPoint2])

Note: (I assume you know this) that SplitCurve() requires curve parameter(s) not 3d points. If you have points you need to convert them to parameters using rs.CurveClosestPoint(). Maybe that’s what’s not working?

HTH, --Mitch

Thanks for the help Helvetosaur,

I have played around with my code and I have noticed something odd. If I run the script as is, the curve is not split however if I move the seam to CuttingPoint2 and split at CuttingPoint1 instead, the code runs as intended.

Here is part of a mesh that I am working on (its an stl in the zip):

Test Mesh.zip (384.0 KB)

and the relevant code:

Curve trim.py (894 Bytes)

It would be nice if this function ignored the seam. Maybe the help file should be updated to to include this behavior.

I have run into some problems with the split curve as well. It seems like it does not work with a list of parameters for the splitting location. (All parameters are within the curve domain).

I have attached the script I am trying to execute:

import random
import rhinoscriptsyntax as rs

crvs = rs.GetObjects('pick a curve', rs.filter.curve)


for crv in crvs:
    t = 0
    tList = []
    while True:
        
        t += (random.randint(1,6) * 466)
        if t >= rs.CurveLength(crv): break
        
        tList.append(t)
    print tList
    nCrvs = rs.SplitCurve(crv, tList, True)
    
    for curve in nCrvs:
        rs.ExtrudeCurveStraight(curve, [0,0,0], [0,0,2600])

Hi,

Similar problem here, but it seems to be relative to Rhino 6

From my understanding, this function should output a list of curves. If N is the number of splitting points, the function should output N+1 curves.

Here is an example:
ContourToSplit.3dm (580.5 KB)
And the code to test it:

ToSplit = rs.ObjectsByLayer(“ToSplit”, False)[0] # Domain of that curve is [0, 103.6]
split_param_1 = 5.88876429708
split_param_2 = 11.7775285942
split_param_3 = 57.7234327369
splitted = rs.SplitCurve(ToSplit, [split_param_1, split_param_2, split_param_3], delete_input=False)

In Rhino 5, that works. ‘splitted’ is a list of 4 curves.
In Rhino 6, that gives a list of only 3 curves. Looking at the objects, the missing curve is the first one; which should have [0, 5.88…] as a domain.

Thanks for your help

Yeah, one of the curves remains as a joined polycurve. Don’t know why. If you add 0.0 as a parameter to the list, the split succeeds with 4 pieces. @dale?

@Helvetosaur - thanks for reporting.

https://mcneel.myjetbrains.com/youtrack/issue/RH-60544

– Dale