====== WalkAbout tools for Rhino-for-Mac ====== These are the macros and python scripts needed to build //Walkabout// and //Step size// tool palettes, in Rhino for Mac version 6, that matches the Rhino for Windows Walkabout tools. The macros are all below; instructions for making the new buttons are [[rhino:mac:uniqueui:walkabout:addmacros|here]]. The icons for the buttons can be downloaded {{:rhino:mac:uniqueui:walkabout:walkabout_icon_set.zip|here}}. ==== WalkAbout- ==== **Walk forward:** ! -_RunPythonScript ( import rhinoscriptsyntax as rs import scriptcontext as sc import math StepSize = 0.02 if sc.sticky.has_key('WALKABOUT_STEPSIZE'): StepSize = sc.sticky['WALKABOUT_STEPSIZE'] C = rs.ViewCamera() T = rs.ViewTarget() Cnew = C Tnew = T Dx = T[0] - C[0] Dy = T[1] - C[1] Cnew[0] = Cnew[0] + Dx * StepSize Cnew[1] = Cnew[1] + Dy * StepSize Tnew[0] = Tnew[0] + Dx * StepSize Tnew[1] = Tnew[1] + Dy * StepSize rs.ViewCameraTarget(rs.CurrentView(), Cnew, Tnew) ) **Walk back:** ! -_RunPythonScript ( import rhinoscriptsyntax as rs import scriptcontext as sc import math StepSize = 0.02 if sc.sticky.has_key('WALKABOUT_STEPSIZE'): StepSize = sc.sticky['WALKABOUT_STEPSIZE'] C = rs.ViewCamera() T = rs.ViewTarget() Cnew = C Tnew = T Dx = T[0] - C[0] Dy = T[1] - C[1] Cnew[0] = Cnew[0] - Dx * StepSize Cnew[1] = Cnew[1] - Dy * StepSize Tnew[0] = Tnew[0] - Dx * StepSize Tnew[1] = Tnew[1] - Dy * StepSize rs.ViewCameraTarget(rs.CurrentView(), Cnew, Tnew) ) **Walk left:** ! -_RunPythonScript ( import rhinoscriptsyntax as rs import scriptcontext as sc import math StepSize = 0.05 if sc.sticky.has_key('WALKABOUT_STEPSIZE'): StepSize = sc.sticky['WALKABOUT_STEPSIZE'] C = rs.ViewCamera() T = rs.ViewTarget() Cnew = C Tnew = T Dx = T[0] - C[0] Dy = T[1] - C[1] Cnew[0] = Cnew[0] - Dy * StepSize Cnew[1] = Cnew[1] + Dx * StepSize Tnew[0] = Tnew[0] - Dy * StepSize Tnew[1] = Tnew[1] + Dx * StepSize rs.ViewCameraTarget(rs.CurrentView(), Cnew, Tnew) ) **Walk right:** ! -_RunPythonScript ( import rhinoscriptsyntax as rs import scriptcontext as sc import math StepSize = 0.05 if sc.sticky.has_key('WALKABOUT_STEPSIZE'): StepSize = sc.sticky['WALKABOUT_STEPSIZE'] C = rs.ViewCamera() T = rs.ViewTarget() Cnew = C Tnew = T Dx = T[0] - C[0] Dy = T[1] - C[1] Cnew[0] = Cnew[0] + Dy * StepSize Cnew[1] = Cnew[1] - Dx * StepSize Tnew[0] = Tnew[0] + Dy * StepSize Tnew[1] = Tnew[1] - Dx * StepSize rs.ViewCameraTarget(rs.CurrentView(), Cnew, Tnew) ) **Elevator Up:** -_RunPythonScript ( import rhinoscriptsyntax as rs import scriptcontext as sc import math StepSize = 0.05 if sc.sticky.has_key('WALKABOUT_STEPSIZE'): StepSize = sc.sticky['WALKABOUT_STEPSIZE'] C = rs.ViewCamera() T = rs.ViewTarget() Cnew = C Tnew = T Dx = T[0] - C[0] Dy = T[1] - C[1] Dist = math.sqrt(Dx*Dx + Dy*Dy) Cnew[2] = Cnew[2] - Dist * StepSize Tnew[2] = Tnew[2] - Dist * StepSize rs.ViewCameraTarget (rs.CurrentView(), Cnew, Tnew) ) **Elevator down:** -_RunPythonScript ( import rhinoscriptsyntax as rs import scriptcontext as sc import math StepSize = 0.05 if sc.sticky.has_key('WALKABOUT_STEPSIZE'): StepSize = sc.sticky['WALKABOUT_STEPSIZE'] C = rs.ViewCamera() T = rs.ViewTarget() Cnew = C Tnew = T Dx = T[0] - C[0] Dy = T[1] - C[1] Dist = math.sqrt(Dx*Dx + Dy*Dy) Cnew[2] = Cnew[2] + Dist * StepSize Tnew[2] = Tnew[2] + Dist * StepSize rs.ViewCameraTarget (rs.CurrentView(), Cnew, Tnew) ) ------------- ==== Step size- ==== **Small steps:** -_RunPythonScript ( import scriptcontext as sc sc.sticky['WALKABOUT_STEPSIZE'] = .005 ) **Medium-small steps:** -_RunPythonScript ( import scriptcontext as sc sc.sticky['WALKABOUT_STEPSIZE'] = .01 ) **Medium steps:** -_RunPythonScript ( import scriptcontext as sc sc.sticky['WALKABOUT_STEPSIZE'] = .05 ) **Medium-large steps:** -_RunPythonScript ( import scriptcontext as sc sc.sticky['WALKABOUT_STEPSIZE'] = .1 ) **Large steps:** -_RunPythonScript ( import scriptcontext as sc sc.sticky['WALKABOUT_STEPSIZE'] = .5 ) **Custom steps:** -_RunPythonScript ( import rhinoscriptsyntax as rs import scriptcontext as sc import math StepSize = 0.05 if sc.sticky.has_key('WALKABOUT_STEPSIZE'): StepSize = sc.sticky['WALKABOUT_STEPSIZE'] NewStepSize = rs.RealBox("New step sizefactor", StepSize) if NewStepSize is not None: StepSize = NewStepSize sc.sticky['WALKABOUT_STEPSIZE'] = StepSize )