rs.AddCutPlane() bug

In testing something from another thread I stumbled across a bug in the rs.AddCutPlane() method which tracks back to a bug in Rhino.Geometry.PlaneSurface.CreateThroughBox(line, normal, box) where the box (bounding box) is flat (i.e. 0 height in the Z direction).

In the simple file below which contains a single plane surface flat on the WorldXY plane and two points, run the following code and pick first the surface, then the two points in the Top or Perspective views:

import rhinoscriptsyntax as rs

obj = rs.GetObject("Select surface for cut plane",8,preselect=True)
if obj:
    msg1="Pick first point"
    msg2="Pick second point"
    if pts and len(pts)==2:

Plane2Points.3dm (42.6 KB)

You will see that the cut plane added does not cut through the surface as it should, it remains at the level of the first picked point (above the surface). If you “thicken” the surface a bit by extruding or even just moving a corner point vertically so it’s no longer planar, the method succeeds, because the bounding box then has some volume.

Therefore I conclude that Rhino.Geometry.PlaneSurface.CreateThroughBox(line, normal, box) - which is the basis method called to generate the cut plane - fails to create the correct geometry when the box has 0 height in the normal direction…

I filed a bug report on this: