mtaussie Posted January 15, 2011 Posted January 15, 2011 I am looking for a way to prompt the user for a choice of Line/Circle/Options. If the user chooses options, I would like to be able to go back to the main choice of Line/Circle/Options until they choose Line or Circle. In the options I would have Layer/Linetype... Im lost and not sure if I should use booleans or a while or what to choose. Any thoughts, matt worland Quote
Tharwat Posted January 15, 2011 Posted January 15, 2011 Check this out ....... (initget "Line Circle Options") (setq reply (getkword "\n Specify your way [ Line,Circle,Options ]:")) Regards, Tharwat Quote
Lee Mac Posted January 15, 2011 Posted January 15, 2011 Here's a simple example of what I undestand you are trying to achieve: (defun c:test ( / flag ans1 ans2 ) (while (not flag) (initget 1 "Line Circle Options") (setq ans1 (getkword "\nChoose Option [Line/Circle/Options]: ")) (if (eq "Options" ans1) (progn (initget 1 "Layer lineType") (setq ans2 (getkword "\nChoose Secondary Option [Layer/lineType]: ")) (alert (strcat "You chose: " ans2)) ) (setq flag T) ) ) (princ) ) Here's a more complicated example: (defun c:test ( / layer ltype ) (while (progn (initget "Line Circle Options") (setq *ans* (cond ( (getkword (strcat "\nChoose Option [Line/Circle/Options] <" (setq *ans* (cond ( *ans* ) ( "Line" )) ) "> : " ) ) ) ( *ans* ) ) ) (cond ( (member *ans* '("Line" "Circle")) (command (strcat "_." *ans*)) (while (= 1 (logand 1 (getvar 'CMDACTIVE))) (command pause)) ) (t (initget "Layer lineType") (if (eq "Layer" (getkword "\nChoose Secondary Option [Layer/lineType] <lineType> : ")) (progn (while (not (or (eq "" (setq layer (getstring t "\nSpecify Layer <Exit> : "))) (tblsearch "LAYER" layer) ) ) (princ "\n** Layer Doesn't Exist **") ) (if (not (eq "" layer)) (setvar 'CLAYER layer)) ) (progn (while (not (or (eq "" (setq ltype (getstring "\nSpecify Linetype <Exit> : "))) (tblsearch "LTYPE" ltype) ) ) (princ "\n** Linetype not Found **") ) (if (not (eq "" ltype)) (setvar 'CELTYPE ltype)) ) ) t ) ) ) ) (princ) ) Got a bit carried away with that one... This might also help you: http://lee-mac.com/promptwithdefault.html Quote
mtaussie Posted January 21, 2011 Author Posted January 21, 2011 Sorry for the delayed response, these are exactly what I was after. Thank-you 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.