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
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()
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
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.
Thank you