@Kent1Cooper wrote:
.... an association list could probably be incorporated that would let it cycle in this way even with no numerical component to the names, and including the WCS in the cycling if you want that. ....
For example, this does that in limited testing, cycling through UCS names that are not dependent on a number component in them, and with inclusion of the WCS in the cycling:
(defun C:UCSC (/ UCSlist ucsn) ; = UCS Cycler
(setq
UCSlist '(("Peter" 0) ("Paul" 1) ("Mary" 2) ("Manny" 3) ("Moe" 4) ("Jack" 5) ("" 6)); ["" is WCS]
ucsn (getvar 'ucsname)
); setq
(command "_.ucs"); [can' use (setvar) -- it's read-only]
(if
(and
(assoc ucsn UCSlist); currently one that's in the list
(/= (setq ucsn (car (nth (rem (1+ (cadr (assoc ucsn UCSlist))) (length UCSlist)) UCSlist))) "")
); next one is not World [can't set that under Restore option]
(command "_restore" ucsn); then
(command "_world") ; else -- to WCS if next in list, or if currently not one in list
); if
(prin1)
)
If you omit the ("" 6) entry in the list, to omit the WCS in the cycling, as currently written you must in a UCS in the list to be able to cycle through others in the list. If desired, it could be edited to instead go into a UCS in the list [presumably to start with "Peter"] if either you're currently in the WCS or the current non-World UCS is not in the list [such as any unnamed UCS setting]. But keeping it as it is has the advantage that you can have multiple groups of UCS's, and you could make a command for cycling through each group independently of any other group(s). It could all be in one command, if there's a User input somehow about which list to use.
You can add as many UCS's as you like into the list, in sublists pairing them with the next integer, or remove any as long as the remaining numbers paired with them start with 0 and increase one at a time. Nothing else needs to be changed in the code, regardless of how many are in the list.
Kent Cooper, AIA