TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: whdjr on October 13, 2004, 09:13:39 AM

Title: Spinners
Post by: whdjr on October 13, 2004, 09:13:39 AM
I have seen a few references made to spinners(progress indicators / percentage complete) around here, but I can't find any code.  Is there a good one someone could post or are there no good spinners?  Are spinners a good thing or a bad thing?  When you have a program that looks like it is hung up the user gets finger-happy on the escape key.  What is the best way to give them a progress indicator?
Title: Spinners
Post by: M-dub on October 13, 2004, 09:22:28 AM
:lol:  :obsessed:
The spinners I know of are a really good thing, but I don't think Mark would like it if I talked about them here!  :razz: ;)

Of course, there's also the spinners in my fishin' tackle box, but I don't know of any spinners in the coding world...Over my head (among many other things)...
Title: Spinners
Post by: whdjr on October 13, 2004, 09:35:12 AM
Quote from: M-dub
Of course, there's also the spinners in my fishin' tackle box

Just because we're in the swamp you always gotta bring up that fishin thing eh? :D
Title: Spinners
Post by: Columbia on October 13, 2004, 09:56:05 AM
There's actually a couple of cool ways to do what you want.  Here is one way...

Place this snippet within your looping function...
Code: [Select]

(defun SPIN ()
  (setq a_s (if a_s a_s 4))
  (princ
    (strcat
      "\r"
      (cadr
        (member
          (rem (setq a_s (1+ a_s)) 4)
          '(0 "|" 1 "/" 2 "-"3 "\\")
        )
      )
    )
  )
)


But the way I prefer is to use DOSLib (from McNeel) and the (Dos_Progress) function located within that library.
Title: Spinners
Post by: whdjr on October 13, 2004, 01:47:11 PM
Anyone got one that shows a percent complete?
Title: Spinners
Post by: V-Man on October 13, 2004, 02:57:04 PM
Here is quick and dirty snip..

Code: [Select]

(setq filterlist '(
                    (-4 . "<OR")
                      (-4 . "<AND")
                        (0 . "LWPOLYLINE")
                        (8 . "ROADS")
                      (-4 . "AND>")
                    (-4 . "OR>")
                  )
)
(setq allpoly (ssget "x" filterlist))
(setq plinect 0)
(repeat (sslength allpoly)
(command "regen")
(setq plinect (+ plinect 1))
(princ (strcat "\nPercent complete: " (rtos (* (/ (float plinect) (float (sslength allpoly))) 100) 2 1) "%"))
)