samifox Posted November 14, 2015 Posted November 14, 2015 ;; ssget - Lee Mac ;; A wrapper for the ssget function to permit the use of a custom selection prompt ;; msg - [str] selection prompt ;; arg - [lst] list of ssget arguments (defun LM:ssget ( msg arg / sel ) (princ msg) (setvar 'nomutt 1) (setq sel (vl-catch-all-apply 'ssget arg)) (setvar 'nomutt 0) (if (not (vl-catch-all-error-p sel)) sel) ) why ssget needs a wrapper? Quote
BlackBox Posted November 14, 2015 Posted November 14, 2015 why ssget needs a wrapper? This 'wrapper' allows you to quickly provide a custom Selection Filter, and user prompt, without duplicating the code in each-and-ever-single routine; the wrapper is merely a sub-function. Cheers [Edit] - Quick examples: (defun c:SelectCircles (/ ss) (if (setq ss (LM:ssget "\nSelect circles: " '(((0 . "CIRCLE"))))) (prompt (strcat "\nYou selected " (itoa (setq ss (sslength ss))) " circle" (if (= 1 ss) "" "s " ) ) ) ) (prompt "\nNothing selected ") (princ) ) (defun c:SelectLines (/ ss) (if (setq ss (LM:ssget "\nSelect lines: " '(((0 . "LINE"))))) (prompt (strcat "\nYou selected " (itoa (setq ss (sslength ss))) " line" (if (= 1 ss) "" "s " ) ) ) ) (prompt "\nNothing selected ") (princ) ) Quote
Lee Mac Posted November 14, 2015 Posted November 14, 2015 why ssget needs a wrapper? Because the standard AutoLISP function does not permit the use of a custom selection prompt, as explained in the code header. Quote
samifox Posted November 14, 2015 Author Posted November 14, 2015 i see... 1.trying to learn how nomutt effect the prompt...but cant really stage a senario when its actually makes a different. 2.what this code is actually saying in plain english? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.