How to disable clipping plane via script (RemoveViewportId) method

I’m can’t figure out how to make RemoveClipViewportId method to work. I couldn’t find any example on the forum yet. ClippingPlanes seem to have the same ViewportIds property after running this method :thinking:

Rhino 8 WIP

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

def DisableAllClippingPlanes():
    clipping_planes = [i for i in sc.doc.Objects if type(i) == Rhino.DocObjects.ClippingPlaneObject]
    
    for clipping_plane in clipping_planes:
clipping_plane.ClippingPlaneGeometry.RemoveClipViewportId(sc.doc.Views.ActiveView.ActiveViewportID)
        rs.EnableRedraw()
        rs.Redraw()

DisableAllClippingPlanes()

Works, but using RemoveClipViewport method. (at first I got confused by the difference between RhinoView and RhinoViewport). Still not sure how RemoveViewportId on ClippingPlaneGeometry was meant to work though:

import scriptcontext as sc
import Rhino

def DisableAllClippingPlanes():
    
    clipping_planes = [i for i in sc.doc.Objects if type(i) == Rhino.DocObjects.ClippingPlaneObject]
    
    for clipping_plane in clipping_planes:
        clipping_plane.RemoveClipViewport(sc.doc.Views.ActiveView.ActiveViewport, True)

DisableAllClippingPlanes()
1 Like