- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, all.
I've received some sweet help on a lisp routine yesterday (thanks @SeeMSixty7) and am now trying to apply the concepts to another, similar lisp routine.
What this one is supposed to do is make a selection of all instances of a specific entity type (requested by the user).
Here's the code so far:
(defun C:test (/ steaSelection steaString) ; Prep initget with all possibilities: (initget (strcat "Text MText MLeader")) ; Set *answerSTEA* with user input: (setq *answerSTEA* (cond ( (getkword ; offer user a list of options (strcat "\nChoose [Text/MText/MLeader] <" (setq *answerSTEA* ; define default or previous choice (cond (*answerSTEA*) ("MLeader")) ) ">: " ) ) ) (*answerSTEA*) ; option if user just presses enter ) ) ; Set steaString entity type based on *answerSTEA* variable: (cond ((eq *answerSTEA* "Text") (setq steaString "Text")) ((eq *answerSTEA* "MText") (setq steaString "MText")) ((eq *answerSTEA* "MLeader") (setq steaString "MultiLeader")) ) (if (> "*" "") (setq ss (ssget "_X" '((0 . *answerSTEA*)))) ) (if (zerop (getvar "CMDACTIVE")) (progn (sssetfirst ss ss) (princ "\nAll targeted elements selected (even on frozen layers)") (princ) ) ss ) )
The part in bold is the one that's not cooperating right now (before this point the code works as expected)).
In (setq ss (ssget "_X" '((0 . *answerSTEA*)))) if we replace *answerSTEA* with , say, "Text" then it works - it selects all text elements in the drawing. So, I think that somehow the global variable *answerSTEA* is not working well in the IF conditional statement.
Any thoughts?
Thanks in advance,
Edgar
Solved! Go to Solution.