yes, good catch. if there's no need to chk for objects selected that may be on layer 0 then you don't need the _get function or change this function:
(setq e (nentsel "\nObject on Layer to assign color to: ")
to:
(ssget "_+.:E:S" '((8 . "~0")))
also i just thought of instead of this cond code to check for being inside pspace vport:
(cond
((equal (getvar"ctab")"Model")(setq sp 0))
((and (zerop(getvar"tilemode"))(= 1 (getvar"cvport")))(setq sp 0))
(t(setq sp 1))
)
it could be as simple as this one liner:
(if
;;; add this to check model or paper vs floating vp
(< (getvar"cvport")3)
;; Model or paperspace
(apply 'command (cons "_.-Layer" lstCommands))
;; Floating vport
(apply 'command-s (append '("_.Vplayer") lstCommands '("")))
);if