Shortcuts for hiding objects

Hello,

is it possible to create shortcuts to hide certain of these:

I would like to be able to hide/unhide clipping planes using a shortcut … Is it somehow possible to access those ?

Thanks
/Erik

Hi @erik6
The display of the clipping planes is a display mode property, and those can’t, IIRC, be accessed via the prompt. You can, however, easily set up a copy of your prefered display mode(s) with the clipping planes off, and then use shortcuts/aliases to switch between them. Or you could macro selecting the clipping planes and hiding/unhiding them.
HTH, Jakob

Mmm,

I have 20 custom Display Modes already and many shortcuts. Would be great to have a way of doing that separately.

Thanks
/Erik

You can use the following commands:

Select clipping planes:
_SelClippingPlane

Enable clipping plane:
! _EnableClippingPlane

Disable clipping plane:
! _DisableClippingPlane

I’m trying to hide/unhide the clipping plane symbols on the screen…

you could script this with https://developer.rhino3d.com/api/rhinocommon/rhino.display.displaypipelineattributes/showclippingplanes

and chatGPT wrote a script that works:

import Rhino
import scriptcontext as sc

def ToggleClippingPlanesInCurrentDisplayMode():
    # Get active viewport
    view = sc.doc.Views.ActiveView
    if not view:
        print("No active view found.")
        return

    viewport = view.ActiveViewport

    # Get current display mode id
    mode_id = viewport.DisplayMode.Id

    # Find the display mode description
    mode = Rhino.Display.DisplayModeDescription.GetDisplayMode(mode_id)
    if not mode:
        print("Could not get display mode.")
        return

    # Access display attributes
    attrs = mode.DisplayAttributes

    # Toggle the flag
    current = attrs.ShowClippingPlanes
    attrs.ShowClippingPlanes = not current

    # Commit changes back to Rhino
    Rhino.Display.DisplayModeDescription.UpdateDisplayMode(mode)

    # Redraw
    sc.doc.Views.Redraw()

    print("ShowClippingPlanes:", not current)


if __name__ == "__main__":
    ToggleClippingPlanesInCurrentDisplayMode()

This script is working great, with a minimal lag in Rhino 7.

If a clipping plane was selected while running that script, it remains selected and visible as a semi-transparent plane. It can be still moved around after it’s hidden. I find this useful, because it remembers that last selected clipping plane prior running the script. Of course, the selection is lost as soon as something else is selected or the user clicks in an empty space.

In case that someone wants to assign the script to a custom icon:
Show or hide clipping planes.py (956 Bytes)

Text to include inside the icon’s command:
_-RunPythonScript “Full path to your file directory\Show or hide clipping planes.py”

Mine looks like this:
_-RunPythonScript “D:\PROGRAMI\Rhinoceros 7\Добавки\Show or hide clipping planes\Show or hide clipping planes.py”