For what it is worth, here is my version (similar to efernal's)
But I pass one Master List to the the nudge functions so it only has to be changed in one place is scales are added or removed.
Of course, it needs testing, error catching, localized variable, etc.
(defun c:Paul()
(initget "1 2 5 10 20 25 50 100 U D") ;set key words
(setq input (getkword "Enter Dimscale or Nudge up/down [1/2/5/10/20/25/50/100 U/D]: ")
scaleList (list 1 2 5 10 20 25 50 100)
);setq
(setq dimsc (atoi input))
(cond
((member dimsc scaleList)
(progn
(setq ModeMacroString (strcat "DIMSCALE 1:" input));setq
(setvar "DIMSCALE" dimsc)
(setvar "ModeMacro" ModeMacroString)
);progn
);
((= input "U")
(nudgeUp (getvar "DIMSCALE") scaleList)
);
((= input "D")
(nudgeDn (getvar "DIMSCALE") scaleList)
);
); cond
)
(defun nudgeUp (pCurr pScaleList)
(setq currPos (vl-position (fix pCurr) pScaleList)
newPos (min (+ currPos 1) (- (length pScaleList) 1)) ;; don't run over the end of the list
currScale (nth newPos pScaleList)
ModeMacroString (strcat "DIMSCALE 1:" (rtos currScale 2 0))
)
(setvar "DIMSCALE" currScale)
(setvar "ModeMacro" ModeMacroString)
);nudgeUp
(defun nudgeDn (pCurr pScaleList)
(setq currPos (vl-position (fix pCurr) pScaleList)
newPos (max (- currPos 1) 0) ;; don't run over the end of the list
currScale (nth newPos pScaleList)
ModeMacroString (strcat "DIMSCALE 1:" (rtos currScale 2 0))
)
(setvar "DIMSCALE" currScale)
(setvar "ModeMacro" ModeMacroString)
);nudgeUp