Keyboard hotkey that cycles points on and off?

Ideally without using a script…I want to program one of the extra side mouse buttons to toggle points on and off. Thank you.

F10 / F11 should do that be default

1 Like

Id like to specifically create a toggle shortcut so I can assign it to a single button on the mouse.

There is no command available for toggle, but you can create one with a small script.

# using cpython and Rhino to get the selected object in Rhino and determine if control points are on
# Author 'Tay Othman'
import rhinoscriptsyntax as rs
import Rhino
import Rhino.Geometry as rg

def get_selected_object():
    obj = rs.SelectedObjects()
    return obj
def turn_on_control_points(obj):
    rs.EnableObjectGrips(obj)
    return obj

def turn_off_control_points(obj):
    rs.EnableObjectGrips(obj, False)
    return obj

def main():
    objs = get_selected_object()
    if len(objs) > 1:
        first = objs[0]
    else:
        first = objs
    if first:
        if rs.ObjectGripsOn(first):
            for obj in objs:
                turn_off_control_points(obj)
        else:
            for obj in objs:
                turn_on_control_points(obj)
    else: print("No object selected")
    return

if __name__ == "__main__":
    main()

Animation (6)

2 Likes

Thank you. This looks like the solution. I made a py file and saved it to my python scripts folder. Now trying to make a keyboard command macro and this code is not working…it just opens the folder with the scripts and stops there. I want it to select the file and execute. Ideas?

_runpythonscript _Pause "toggle_points.py" _Enter

You need to add this here.

It already opens the correct file folder but stops there. Id like it to select the file as well and run it so I dont have to do it manually…that way I can get a keyboard command to it or set it to my mouse button.

Basically, what’s wrong with this keyboard shortcut command?

_runpythonscript _Pause "toggle_points.py" _Enter

try the below:
!-_runpythonscript “Toggle_Points.py” _Enter

Note the Excalamation mark + Hyphen on the front.

1 Like

Thank you