Problem with PlaneCurveIntersection() - overlaps

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… (1 KB)
OverlapSplit.3dm (26.9 KB)

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.

TestSplitCrvsWPlane.rvb (929 Bytes)

So, is the problem something I did wrong with the Python script, or is there a bug in the intersection or split functions?

(BTW, tested this in the WIP and same result)

Thx, --Mitch

Hi Mitch,

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.

Yeah, but that doesn’t make any sense. We’re looking to split the curve, so we need the parameter on the curve, not the plane.

There are a bunch of things that seem to be messed up here.

  1. The rhinoscriptsyntax help (which I based my script on) says:

The vb Rhinoscript help concurs on this. So does the comment section under the PlaneCurveIntersection() method in the file (which the function calls)

  1. The rhinoscriptsyntax method PlaneCurveIntersection() calls the RhinoCommon Intersection.CurvePlane method. The API guide has this:

First, the link to CurveIntersections class at the bottom, is wrong!

It should link to the intersection event class instead:

The above RhinoCommon method returns a list of IntersectionEvents:

Here is the guide entry for IntersectionEvent:

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.

@dale ?