jarekw90 Posted February 12, 2018 Report Posted February 12, 2018 Witam, Poniżej fragment kodu. Próbuję wykonać pętlę repeat do momentu wskazania przez użytkownika przerwanie przez N lub Esc, chciałbym aby enter było traktowane jako domyślnie T. Niestety w każdym przypadku przerywa wykonywanie programu. Proszę o pomoc. (defun ...... (setq aaa "T") (repeat (if (= aaa "T") (progn ... );end progn );end if (progn (initget "T N") (setq aaa (getkword "Kontynuowac? [T/N] <T>:") ) (if (not aaa) (setq aaa "T")) ) );end repeat ) ;end program Quote
kruszynski Posted February 12, 2018 Report Posted February 12, 2018 Proponuję tak: (defun ZWCAD:GetKWord (init Prompt DefVal / ans OutVal *error*) (defun *error* ( msg / ) (if (not (null msg ) ) (progn (princ "\n ZWCAD:GetKWord : *error*: " ) (princ msg ) (princ "\n") ) ) ) (initget 2 init) (setq ans(vl-catch-all-apply 'getkword (list Prompt))) (if (not(vl-catch-all-error-p ans)) (if ans (progn (if (equal ans "") (setq OutVal DefVal) (setq OutVal ans) ) ) (setq OutVal DefVal) ) ) OutVal ) (setq wybrane (ZWCAD:GetKWord "T N" "Kontynuowac? [T/N] <T>" "T" ) ) jarekw90 1 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.