- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, all.
I've been working on a routine that allows the user to create a selection (like a window selection) that contains only the desired entity type. For example, if the user would like to make a window selection and select only MTexts, he would call this command, choose "MText" (or type "MT"), do a window selection, and end up with only the MText objects caught in that window.
I've tested the portion that filters the selection without the user input and it works. For example, if in "(setq filter '((0 . seString)))" I change the variable seString to, say, "Text", then I could select only text objects.
However, this routine as it is does not work. I think it can't set the variable seString to the same variable as *answers*, but am not sure.
I'd totally appreciate it if anyone could help me finish this task...
Here's my code so far (keep in mind I'm still sort of a newbie in Lisp):
(defun C:test (/ seSelection seString) ; Prep initget with all possibilities: (initget "MLeader MText Text") ; Set *answerSE* with user input: (setq *answerSE* (cond ( (getkword ; offer user a list of options (strcat "\nChoose [MLeader/MText/Text] <" (setq *answerSE* ; define default or previous choice (cond (*answerSE*) ("MLeader")) ) ">: " ) ) ) (*answerSE*) ; option if user just presses enter ) ) ; Set seString entity type based on *answerSE* variable: (cond ((eq *answerSE* "Text") (setq seString "Text")) ((eq *answerSE* "MText") (setq seString "MText")) ((eq *answerSE* "MLeader") (setq seString "MultiLeader")) ) ; Set filter based on requested entity type: (setq filter '((0 . seString))) ; Prep filtered selection: (setq seSelection (ssget "_:L" filter)) ; Maintains selection: (sssetfirst nil seSelection) (princ) )
By the way, I have to thank Lee Mac for his beautiful explanation on how to get user input (Thanks, Lee Mac 🙂 )
Edgar
Solved! Go to Solution.