Read and Write Nudge Key Option via Python


#1

Hi all,

is there a possibility to access and change the Nudge Key Options via Python? There are methods in the Rhino SDK for C# and VisualBasic. I like to try a toolbox/script for immediate change during modelling.

Thank you in advance,
fishermans.


How to read/modify Document Property (Grid Snap interval, Grid thin interval)
#2

Yes.

import Rhino
#get current setting
nudge_step=Rhino.ApplicationSettings.ModelAidSettings.NudgeKeyStep

#set new value
Rhino.ApplicationSettings.ModelAidSettings.NudgeKeyStep=value

There are also

ModelAidSettings.CtrlNudgeKeyStep
ModelAidSettings.ShiftNudgeKeyStep

for the other two settings.

HTH,
–Mitch


(Menno Deij - van Rijswijk) #3

Basically, anything that you find in RhinoCommon can be done in Python.


#4

Mitch,
great! You were much to fast for me.
Thank you,
Norbert.


Advanced Surfacing
#5

So here I am now. Next would be, to make it - like object snap - persistent and usable same time with other commands. Is there any advice for that? I guess this is going to be much harder.
Thank you in advance,
Norbert.

import rhinoscriptsyntax as rs
import Rhino

#get current setting
nudge_step=Rhino.ApplicationSettings.ModelAidSettings.NudgeKeyStep
ctrl_nudge_step=Rhino.ApplicationSettings.ModelAidSettings.CtrlNudgeKeyStep
shift_nudge_step=Rhino.ApplicationSettings.ModelAidSettings.ShiftNudgeKeyStep

arr_value_text=[]
arr_value_text.append("Arrow Value")
arr_value_text.append("Ctrl+Arrow Value")
arr_value_text.append("Shift+Arrow Value")
arr_nudge_step=[]
arr_nudge_step.append(nudge_step)
arr_nudge_step.append(ctrl_nudge_step)
arr_nudge_step.append(shift_nudge_step)

arr_nudge_step = rs.PropertyListBox(arr_value_text,arr_nudge_step,"Nudge Key Values"," ")


nudge_step=float(arr_nudge_step [0])
ctrl_nudge_step=float(arr_nudge_step[1])
shift_nudge_step=float(arr_nudge_step[2])

#set new value
Rhino.ApplicationSettings.ModelAidSettings.NudgeKeyStep=nudge_step
Rhino.ApplicationSettings.ModelAidSettings.CtrlNudgeKeyStep=ctrl_nudge_step
Rhino.ApplicationSettings.ModelAidSettings.ShiftNudgeKeyStep=shift_nudge_step

print "Arrow Nudge: ",nudge_step,"  Ctrl+Arrow: ", ctrl_nudge_step,"  Shift+Arrow: ", shift_nudge_step