Curve.Split Method in RhinoCommon broken?
I was just tracking down some bugs in a Python Grasshopper component when I noticed that the RhinoCommon Curve.Split method does not behave as I expected.
Essentially if you have a closed curve and attempt to split it at one or several parameters, it always seems to also be split at 0/1 even if you have not specified this in the list of parameters. I have attached a Grasshopper file exemplifying this behaviour (using Rhino 5, GH 0.8.0066, Python Component 0.5.00).
You will notice that Grasshoppers own "shatter" component does not behave like this. I assume that it uses the same RhinoCommon method. So either I'm not implementing it correctly or something funky is happening!
I just tried out the RhinoScriptSyntax SplitCurve function and it also seems to suffer from the described problem. Please find an updated example file attached. It would be good to know if this is indeed a bug, if not I'll have to substantially rethink my current approach/algorithm.
Last edited by AHD; 10-10-2012 at 08:57 AM.
When you split a curve with a seam (closed curve) in two places, one on either side of the joint, you end up with 3 pieces... My theory is that the native Rhino command - as well as the GH component I assume - are programmed to detect this and add an extra step to merge the two "loose ends" back together into one curve... The Rhinoscript syntax function (which just calls the RhinoCommon function) does not have this extra step built-in... That's my theory at least.
I suspect that your theory is pretty spot on. In any case I came up with a workaround that seems to work pretty consistently. Basically I did exactly what you suggest, find the two loose ends and join them back together. I've attached an example if this.