In testing a recent script to split curves with a plane, I ran across what appears to be a bug when a curve overlaps the plane. Below is the script, and a test file…
I am using the world ZX plane to test here. On the “Bad” layer, note that the curves are split by the script only at the start of the overlap, not at the end. I checked and the two parameters for each overlap are indeed being passed to the SplitCurve() function. However, the one or the other is always 0. (The non-overlapping curves on the “Good” layer work fine)
To check, I (painfully) duplicated the script in vb Rhinoscript and it works perfectly.
Seems like you need to append the UV params of the plane parameter where the overlapping occurs, instead of the curve parameters, like such:
for event in insec:
#add U parameter of plane intersection
params.append(event[7]) #instead of [5]
if event[0]==2:
#add V parameter of plane intersection
params.append(event[8]) #instead of [6]
Is that what you are after? RhinoScriptSyntax uses RhinoCommon Plane Curve Intersection in the background, so perhaps looking at the IntersectionEvent class will shed some light on how this works. That said, why the previous script works in vb and not in python is beyond me.
The vb Rhinoscript help concurs on this. So does the comment section under the PlaneCurveIntersection() method in the file plane.py (which the function calls)
The rhinoscriptsyntax method PlaneCurveIntersection() calls the RhinoCommon Intersection.CurvePlane method. The API guide has this:
So what we’re looking for is the OverlapA output, which is an interval of 2 numbers:
This is the way the rhinoscriptsyntax function is hooked up:
So yes, indices 7 and 8 hold the correct info as you found. HOWEVER, that is not the way any of the various help docs shown/linked above say it is supposed to be…
Lots of stuff to fix either in the help docs here, or the method itself. If the method itself is not changed then the vb Rhinoscript and python rhinoscriptsyntax outputs will not correspond for this method.