Author Topic: Forgot how to loop  (Read 1601 times)

0 Members and 1 Guest are viewing this topic.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1128
Forgot how to loop
« on: October 10, 2008, 11:57:52 AM »
I'm a little pressed for time today, and I haven't coded in a while.  I can't remember how to loop this (also, if something better than using (command) will work, I'll take that too!):

Background: Select object, if no object selected, try again, bring selected object to front, repeat until user escapes.
Code: [Select]
(defun c:DF ()
  ;;  next loop until user presses enter or select object
    (while (and (null (setq en (entsel "\nSelect object to Bring to FRONT...")))
(= (getvar "errno") 7)
)
      (prompt "\nMissed, Try again or Enter to exit.")
            ) ; end while
  (command "draworder" en "" "front")
  );end defun

Thanks in advance!

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Forgot how to loop
« Reply #1 on: October 10, 2008, 12:12:55 PM »
Code: [Select]
(setvar 'ErrNo 0)
(while (not (equal (getvar 'Errno) 52))
    (if (ssget)
        .....
    )
)
This will go until enter is pressed.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.