Clipping plane issue

Hi all,

I was trying to automatise the creation of clipping plane with a simple script where:

  • a cube will be selected
  • the script would add a clipping plane at every face of the cube so to exclude everything which is outside from it
    The idea was that the user could then run the script again on another cube and add further clipping planes.

However, it happens to me that sometimes the clipping planes generated for a second cube do not work: they show up in the view, they are active, they don’t exclude geometries. If I save and close the file then when I open it again they seem to work. Any idea on how this could be solved without opening and closing the file?

This issue is present both in Rhino 5 and Rhino 6.

This is how I generate the clipping planes via script

    bounding = rs.BoundingBox(box)
    
    [pt1,pt2,pt3,pt4,pt5,pt6,pt7,pt8] = bounding
    
    plane1 = rs.PlaneFromPoints(pt1,pt2,pt3)
    plane2 = rs.PlaneFromPoints(pt1,pt4,pt8)
    plane3 = rs.PlaneFromPoints(pt1,pt5,pt2)
    plane4 = rs.PlaneFromPoints(pt4,pt3,pt8)
    plane5 = rs.PlaneFromPoints(pt6,pt5,pt7)
    plane6 = rs.PlaneFromPoints(pt2,pt6,pt7)
    
    rs.CurrentLayer(clipplanelayer)
    clip1 = rs.AddClippingPlane(plane1,5,5)
    clip2 = rs.AddClippingPlane(plane2,5,5)
    clip3 = rs.AddClippingPlane(plane3,5,5)
    clip4 = rs.AddClippingPlane(plane4,5,5)
    clip5 = rs.AddClippingPlane(plane5,5,5)
    clip6 = rs.AddClippingPlane(plane6,5,5)

attached an image of what I see when I run the script twice and a file with the issue (it generates an issue if the box on clip 2 is used before the box on clip 1 and not vice-versa)

clipping issue 2.3dm (527.4 KB)

I actually just realised that it is not only a visualisation issue, even if I re-open the file some of the clipping planes are still not working.

Is it an issue for rhino to deal with more than a set number of clipping planes?