ScriptSpot

Script

Nudge with Arrow Keys

By Johnathon Horne · 2006-10-21

Version
1.5
Version requirement
7
Date updated
2004-11-14
Votes
7
Download
Download
Description

Allows movement of selected object(s) using arrow keys. This was the behavior in 3dsmax prior to version7.

Additional Info

To Install: Place these files in your UI/Macroscripts folder.

Customize GUI - scripts are located in the 'neverwake' category.
Assign each script to a hotkey. I recommend the following keys:
Right Arrow = X +10
Left Arrow = X -10
Up Arrow = Z +10
Down Arrow = Z-10
Shift + Up Arrow = Y +10
Shift + Down Arrow = Y -10
Add Cntl + All of the above for X/Y/Z + or - 1 unit

Known issues:
1. The macros use the currently selected coordinate system in the max
toolbar pulldown. If mode is set to View - nothing will happen and the
objects will not move. Use something other than View (not a big deal to
me - as I never use View anyway).
2. Moving subobjects in spline objects (ie - spline points or
segments - etc) is not supported... based on the subobject code structure
for splines - don't expect me to add this anytime soon...

Basic error checking - but not torture tested. If you find a major
bug - please let me know and I'll attempt to fix it.

Future possibilities: user-set movement distances instead of 1- and
10-unit presets.

History:
1.5 Added support for sub-object selection (emesh and epoly objects). Confirmed support for max5 - max7.
1.0: Inital release.

Tags: transform

Comments (2)

Hello

PerfectCell · 2013-02-14

A workmate was asking for a script that does what yours does. He tried it out, but had a few requests.

Here's what I did with it:

There are two macro files, nudgeU and nudgeD. nudgeU has a positive nudge amount and nudgeD has a negative nudge amount.
The two macros are mapped to the up and down keys.

macroscript nudgeU category:"oo"
(
global refCoord
global refCoordDo
global nudgeAmount
global subLevel
global refCoordDefault
global currAxis
global x
global y
global z

	try
	(
		refCoord = getRefCoordSys()
		subLevel = subObjectLevel
		nudgeAmount = 0.5
		refCoordDefault = #world
		
		if refCoord == #local then
		(
			refCoordDo = #local
		)
		else
		(
			refCoordDo = refCoordDefault
		)
		
		currAxis = (toolmode.axisconstraints as string)
		
		if currAxis == "x" then
		(
			x = nudgeAmount
			y = 0
			z = 0
		)
		if currAxis == "y" then
		(
			x = 0
			y = nudgeAmount
			z = 0
		)
		if currAxis == "z" then
		(
			x = 0
			y = 0
			z = nudgeAmount
		)
		if currAxis == "XY" then
		(
			x = nudgeAmount
			y = nudgeAmount
			z = 0
		)
		if currAxis == "YZ" then
		(
			x = 0
			y = nudgeAmount
			z = nudgeAmount
		)
		if currAxis == "ZX" then
		(
			x = nudgeAmount
			y = 0
			z = nudgeAmount
		)
		
		fn moveobj =
		(
			if toolmode.commandmode == #move then in coordsys refCoordDo move $ [x,y,z]
			if toolmode.commandmode == #rotate then in coordsys refCoordDo rotate $ (eulerangles x y z)
		)

		fn movepoint =
		(
			if toolmode.commandmode == #move then in coordsys refCoordDo move $.selectedVerts [x,y,z]
			if toolmode.commandmode == #rotate then in coordsys refCoordDo rotate $.selectedVerts (eulerangles x y z)
		)

		fn moveedge =
		(
			if toolmode.commandmode == #move then in coordsys refCoordDo move $.selectedEdges [x,y,z]
			if toolmode.commandmode == #rotate then in coordsys refCoordDo rotate $.selectedEdges (eulerangles x y z)
		)

		fn movepoly =
		(
			if toolmode.commandmode == #move then in coordsys refCoordDo move $.selectedFaces [x,y,z]
			if toolmode.commandmode == #rotate then in coordsys refCoordDo rotate $.selectedFaces (eulerangles x y z)
		)

		if subLevel == 0 then moveobj() else
		if subLevel == 1 then movepoint() else
		if subLevel == 2 then moveedge() else
		if subLevel == 3 then moveedge() else
		if subLevel == 4 then movepoly() else
		if subLevel == 5 then movepoly() else
		if subLevel == undefined then moveobj()

	)

	catch()
 )
)

I can't actually get rotating subselections to work, so someone else might be able to fix that part, but it works well for what we need.

sebashtion H. · 2009-05-09

Hello I am new to scripts.
is there a way to update this to max 2009?

Sebashtion H.