ojacomarket Posted April 13, 2020 Share Posted April 13, 2020 Dear friends, I have an issue. Is it possible somehow to ESTABLISH some kind of condition to EXECUTE some routine only ONCE inside the loop. For example, I have a loop that draws circles, then I want to stop looping and draw one more circle in specific place and then end the loop. Quote Link to comment Share on other sites More sharing options...
Jonathan Handojo Posted April 13, 2020 Share Posted April 13, 2020 (defun c:example ( / pt rad) (setq rad 1) ; <--- Circle radius (while (setq pt (getpoint "\nSpecify center: ")) (entmake (list '(0 . "CIRCLE") (cons 10 pt) (cons 40 rad))) ) (entmake (list '(0 . "CIRCLE") (cons 10 (progn (initget 1) (getpoint "\nSpecify center for last circle: "))) (cons 40 rad) ) ) (princ) ) 1 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 14, 2020 Share Posted April 14, 2020 Johnathon ahs provided an answer but why not just draw the last circle or is there something your not telling us ? (while (setq pt (getpoint "\nSpecify center Enter to exit: ")) 1 Quote Link to comment Share on other sites More sharing options...
pkenewell Posted April 28, 2020 Share Posted April 28, 2020 On 4/13/2020 at 11:16 AM, ojacomarket said: Dear friends, I have an issue. Is it possible somehow to ESTABLISH some kind of condition to EXECUTE some routine only ONCE inside the loop. For example, I have a loop that draws circles, then I want to stop looping and draw one more circle in specific place and then end the loop. @ojacomarket to just answer your question, add a conditional flag within your loop that is set to T after the single execution: (While (/= (getkword "\nEnter 'E' to exit or <ENTER> to continue: ") "E") (if (= flag nil) (progn (alert "Setting Flag!") (setq Flag T) ) (princ "\nFlag Set! ") ) ) Quote Link to comment Share on other sites More sharing options...
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.