Author Topic: Progress Bar  (Read 15165 times)

0 Members and 1 Guest are viewing this topic.

CincyJeff

  • Newt
  • Posts: 89
Progress Bar
« on: January 26, 2016, 01:49:55 PM »
I'm using DOSLib, specifically dos_getprogress, to display a progress bar to the user while blocks are being processed. Unfortunately, Windows keeps breaking in and adding "(Not Responding)" to the progress bar title and halting the bar even though the program is continuing to process. Does anyone know how to keep focus with the progress bar? Or another method?

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Progress Bar
« Reply #1 on: January 26, 2016, 02:02:25 PM »
See here for an explanation of why this happens; as far as I am aware, the only way to avoid this is to obtain some form of user input whilst processing (e.g. include a grread call within your processing loop).

CincyJeff

  • Newt
  • Posts: 89
Re: Progress Bar
« Reply #2 on: January 26, 2016, 02:13:26 PM »
Thanks Lee. That makes sense, but it is annoying. I'll try the dummy (grread) call.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Progress Bar
« Reply #3 on: January 26, 2016, 02:22:58 PM »
Thanks Lee. That makes sense, but it is annoying. I'll try the dummy (grread) call.

Just be aware that the user will need to move the mouse during processing for the program to continue - though, the slightest mouse movement will suffice.

FWIW, here's an example of this technique - the RUNCLOCK command works in this way.

CincyJeff

  • Newt
  • Posts: 89
Re: Progress Bar
« Reply #4 on: January 26, 2016, 03:45:35 PM »
It's a no go. The (grread) seems to prevent the progress bar from progressing. It never updates even if the mouse is moved. Any other ideas?

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Progress Bar
« Reply #5 on: January 26, 2016, 03:50:04 PM »
It's a no go. The (grread) seems to prevent the progress bar from progressing. It never updates even if the mouse is moved. Any other ideas?

Did you include the mouse-tracking argument?

(grread t)

CincyJeff

  • Newt
  • Posts: 89
Re: Progress Bar
« Reply #6 on: January 26, 2016, 03:56:21 PM »
That I did not, however, when I did I found it unacceptable. I don't want to make the users move the mouse just for a progress bar and the program is halted if the mouse is not moved. It can take over a minute to process and it would be nice to inform the user how it is progressing. Thanks any way.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Progress Bar
« Reply #7 on: January 26, 2016, 04:22:09 PM »
That's the best I could suggest, unless you want to abandon AutoLISP for this task.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2139
  • class keyThumper<T>:ILazy<T>
Re: Progress Bar
« Reply #8 on: January 26, 2016, 04:35:33 PM »
I'm using DOSLib, specifically dos_getprogress, to display a progress bar to the user while blocks are being processed. Unfortunately, Windows keeps breaking in and adding "(Not Responding)" to the progress bar title and halting the bar even though the program is continuing to process. Does anyone know how to keep focus with the progress bar? Or another method?

Have you reported this to DosLib and provided sufficient information to allow the issue to be reproduced??
I'm sure Dale and co. would treat it with dispatch.
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Progress Bar
« Reply #9 on: January 26, 2016, 04:39:23 PM »
Progress bars can be difficult in any language as it is hard to measure progress on a running routine without interrupting it or getting some sort of feedback somehow.

What about using a GIF in a popup just to let the user know it's busy? You could also show the steps in text if you want to show a bit more information.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

hmspe

  • Bull Frog
  • Posts: 362
Re: Progress Bar
« Reply #10 on: January 26, 2016, 04:51:04 PM »
I was never able to make progress bars work well so I went to reports on the command line with code similar to:
Code: [Select]
 
  (setq spin  0)

  ;;; get a selection set and convert to a list of enames

  (setq total (strcat " of " (itoa (length set1))))
  (foreach memb set1
 
    ;;; do stuff

    (setq spin (1+ spin))
    (if (= (rem spin 10) 0)
      (cond ( (< spin   100) (princ (strcat "\rProcessing     " (itoa spin) total)))
            ( (< spin  1000) (princ (strcat "\rProcessing    " (itoa spin) total)))
            ( (< spin 10000) (princ (strcat "\rProcessing   " (itoa spin) total)))
            (t               (princ (strcat "\rProcessing  " (itoa spin) total)))
      )
    )
  )
  (princ (strcat "\rTrimming " total " of " total))
"Science is the belief in the ignorance of experts." - Richard Feynman

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Progress Bar
« Reply #11 on: January 26, 2016, 04:54:09 PM »
Regardless of the chosen display method however, AutoCAD will be rendered non-responsive after 5 seconds of continuous processing in AutoLISP.

FWIW, you can verify this using the following simple function -
Code - Auto/Visual Lisp: [Select]
  1. (defun foo ( n / x )
  2.     (setq x (getvar 'millisecs))
  3.     (while (< (- (getvar 'millisecs) x) n))
  4. )
Code - Auto/Visual Lisp: [Select]
  1. (foo 2000) ;; no problem
  2. (foo 6000) ;; non-responsive for 1s
« Last Edit: January 26, 2016, 04:58:03 PM by Lee Mac »

VovKa

  • Water Moccasin
  • Posts: 1631
  • Ukraine

hmspe

  • Bull Frog
  • Posts: 362
Re: Progress Bar
« Reply #13 on: January 26, 2016, 06:10:58 PM »
Lee,

I tested the routine I took the snippet from on a drawing with over 13000 applicable entities.  It ran to completion in about 96 seconds on Bricscad, and the command line was updated as expected.  I ran the same code in Autocad 2010 (after adding the functions necessary to emulate Bricscad's vle-functions) and it also ran to completion in about 4 minutes.  Not sure what I'm doing to avoid the timeout but it works for me.
"Science is the belief in the ignorance of experts." - Richard Feynman

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Progress Bar
« Reply #14 on: January 26, 2016, 06:40:38 PM »
I tested the routine I took the snippet from on a drawing with over 13000 applicable entities.  It ran to completion in about 96 seconds on Bricscad, and the command line was updated as expected.  I ran the same code in Autocad 2010 (after adding the functions necessary to emulate Bricscad's vle-functions) and it also ran to completion in about 4 minutes.  Not sure what I'm doing to avoid the timeout but it works for me.

The program will still run to completion, but Windows will render the AutoCAD application as non-responsive after 5 seconds of processing; note that an application window being marked as non-responsive will not halt the processing, but is simply an automatic Windows response when not receiving any feedback from the application's GUI processor thread for 5 seconds.