problem repeat + getkword


Recommended Posts

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

 

 

Link to comment
Share on other sites

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" ) )

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...