; ssel presents option to select if more than one object is in aperture area emulates selection cycling but on the command line ; OP: ; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/selectioncycling-with-given-point/td-p/13421381 (defun c:ssel (/ dynmode en enamlst i selectioncycling selopt selstr ss sslst stropt) (setq selectioncycling (getvar "selectioncycling")) ; save current setting (sssetfirst nil nil) ; clear any current selections (setvar "selectioncycling" 0) ; disable setting (if (setq ss (ssget "_+.:E:S")) ; chk if select objects within aperture (progn (if (> (sslength ss) 1) ; chk if multiple objects selected (progn ; then (setq sslst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))) ; convert selectionset to list of entities (setq enamlst (mapcar '(lambda (x) (getpropertyvalue x "LocalizedName")) sslst)) ; create list of the entity type (setq selopt "1") ; setup default (setq i 0) (repeat (length enamlst) (if(zerop i) (setq selstr "" stropt "") ; on first loop initialize strings (setq selstr (strcat selstr ", ") ; thereafter following item string add a comma separator stropt (strcat stropt (itoa i) " ") ; & add space to # selection option ) ) ; if (setq selstr (strcat selstr "(" (itoa (1+ i)) ")" (nth i enamlst))) ; include count index followed by item from list (setq i (1+ i)) ) ; repeat ; modified from get keyword on screen input by Ronjonp Jan 2018 ; https://www.cadtutor.net/forum/topic/64736-getstring-a-default-value-without-print/?do=findComment&comment=533439 ; dynmode needs to be 1 or 3 to display cursor popup (if(<= (rem (getvar "dynmode") 2) 0) ; if even # chks negative value as well (progn (setq dynmode (getvar "dynmode")) ; save current setting (setvar "dynmode" 1) ; enable dynmode ) ) ; if (initget (setq stropt (strcat stropt (itoa i)))) ; include last count index in # selection option (setq selopt ; get selection (cond ; display in popup # selection option as cursor hovers over graphics area & highlite # selection options at command line ((getkword (strcat selstr " [" (vl-string-translate " " "/" stropt) "] <" selopt ">: "))) (selopt) ; use default ) ; cond ) (if dynmode (setvar "dynmode" dynmode)) ; restore original dynmode setting (setq en (nth (1- (atoi selopt)) sslst)) ; return index from list of entities ) ; progn (setq en (ssname ss 0)) ; else return single entity selected ) (if en (sssetfirst nil (ssadd en))) ; highlight entity ) ; progn (princ "\nNothing selected.") ) ; if (setvar "selectioncycling" selectioncycling) ; restore setting (princ) ; clean exit )