Code Red > AutoLISP (Vanilla / Visual)
Force prompt user to select an entity with SSGE even if there is already selecte
(1/1)
V@no:
I'd like to use SSGET to prompt user to select certain entities (let's say only lines). However if there is already a selection but doesn't pass the filter (a circle selected) SSGET returns nil instead of prompt user to select.
Is there a way force to prompt user without clearing the selection?
Basically, what I'm trying to accomplish is: prompt user so select a single entity (using ":S"). Highlight that entity, prompt user to select second entity but don't allow select first one.
During these prompts I also allow user change options, therefor I'm running SSGET in a loop, however on second "prompt" it automatically returns nil instead of prompting user.
Any ideas how to achieve this?
Thank you.
--- Code - Auto/Visual Lisp: ---(DEFUN c:test (/ loop num filter str ss sss ent1 ent2) (SETQ loop T num 0 filter nil str "first" sss (SSADD) ) (WHILE loop (PRINC (STRCAT "\nSelect " str " item: ")) (SETQ ss (SSGET "_:S" filter)) (print ss) (IF (AND ss (> (SSLENGTH ss) 0) (= num 0)) (PROGN (SETQ ent1 (ENTGET (SSNAME ss 0)) filter (LIST (CONS -4 "!=") (CAR ent1)) num (1+ num) str "second" sss (SSADD (SSNAME ss 0) sss) ) ) (PROGN (SETQ loop nil) (IF ss (SETQ ent2 (SSNAME ss 0) sss (SSADD ss sss) ) ) ) ) (SSSETFIRST nil sss) ) (PRINC "\nfirst item: ") (PRINC ent1) (PRINC "\nsecond item: ") (PRINC ent2) (PRINC))
ribarm:
Try this mod... But selection of grips were not preserved when selected the same entity and because of that added (GETSTRING) after (SSSETFIRST)...
--- Code - Auto/Visual Lisp: ---(DEFUN c:seltst ( / *error* loop num str hgl sss ss ent1 ent2 ) (DEFUN *error* ( m ) (IF hgl (SETVAR (QUOTE highlight) hgl) ) (IF m (PROMPT m) ) (PRINC) ) (SETQ loop T) (SETQ num 0) (SETQ str "first") (SETQ hgl (GETVAR (QUOTE highlight))) (SETVAR (QUOTE highlight) 1) (SETQ sss (SSADD)) (WHILE loop (PRINC (STRCAT "\nSelect " str " item : ")) (IF (AND ent1 (SSMEMB ent1 ss)) (SSDEL ent1 ss) ) (WHILE (OR (NOT ss) (AND ss (= (SSLENGTH ss) 0))) (SETQ ss (SSGET "_+.:E:S")) ) (COND ( (AND ss (= (SSLENGTH ss) 1) (= num 0)) (SETQ ent1 (SSNAME ss 0)) (SETQ num (1+ num)) (SETQ str "second") (SSADD ent1 sss) ) ( T (SETQ loop nil) (IF (AND ss (= (SSLENGTH ss) 1) (EQ ent1 (SETQ ent2 (SSNAME ss 0)))) (PROGN (SETQ loop T) (SSDEL ent1 ss) ) (IF (OR (NOT ss) (AND ss (= (SSLENGTH ss) 0))) (SETQ loop T) ) ) (IF (AND ent2 (NOT (EQ ent1 ent2))) (SSADD ent2 sss) ) ) ) (SSSETFIRST nil sss) (IF (OR (AND ent1 (NOT ent2)) (AND ent1 ent2 (EQ ent1 ent2))) (PROGN (GETSTRING "\nENTER TO CONTINUE...") (SSSETFIRST) ) ) ) (PRINC "\nFirst item : ") (PRINC ent1) (PRINC "\nSecond item : ") (PRINC ent2) (*error* nil))
M.R.
ribarm:
Just to add note...
I tested my mod. in BricsCAD and it behaves good, but in AutoCAD it's very buggy...
Sorry, but I may not find apropriate solution for both environments...
Regards...
ribarm:
Test it now...
I think that now is good for both and BricsCAD and AutoCAD...
Regards, M.R.
Navigation
[0] Message Index
Go to full version