Progress Bar in lisp code

Progress Bar in lisp code

mhy3sx
Enthusiast Enthusiast
3,907 Views
42 Replies
Message 1 of 43

Progress Bar in lisp code

mhy3sx
Enthusiast
Enthusiast

Hi, I use this code to insert points in a drawing from a coordinate file. The problem is that when I have a lot of coordinates in the file the code is a little slow, so I want to have a progress bar to look the progress of the insert points. Can anyone help me to update the code ?

 

Thanks

0 Likes
3,908 Views
42 Replies
Replies (42)
Message 41 of 43

Sea-Haven
Mentor
Mentor

For John.

I sort of gave up on progress bar in a recent task changing/adding 3000 objects just zoom out to a guess number based on type of project and watch the fly spec appear, you can see it being made also as it requires 4 individual tasks I do a alert "Stage 1 completed" repeated fro each stage, just to wake up the user, its less than 2 minutes compared to 3 hours. 

 

Again 1 second 400 points imported and made blocks with atts, why a task bar ?

0 Likes
Message 42 of 43

john.uhden
Mentor
Mentor

@Sea-Haven , @mhy3sx , @MrJSmith , @autoid374ceb4990 , @CADaSchtroumpf :

Well, I'm finally happy with my PROGRESS.LSP (attached).

  • Everything is contained in one function (JU:PROGRESS).
  • It uses colored AutoCAD entities to simulate a progress bar.
  • It works with twisted views.
  • It can be used in TILEMODE 0 or 1.
  • It can handle a large number of iterations.
  • Take a look at the included c:TEST function, and run it,
    to see how you can speed it up by increasing the update increment.
    I tested 500,000 iterations with an increment of 20 and it seemed
    reasonable.  The point is that it's controllable.
  • I'm sure that grdraw and/or grvecs would be faster but the entity
    method survives redraws and regens.
    Just don't turn off or freeze or lock the "PROGRESS" layer.
  • I have not and probably will not try to adapt it for zooms and pans
    as rebuilding the bar each time would slow down the process.
    so its location remains static.

John F. Uhden

0 Likes
Message 43 of 43

Sea-Haven
Mentor
Mentor

About as cheap and dirty as you can get, but shows could work.  😎

Replace the delay with some defun that does something like read a file. 

Tested at 123,456

 

(setvar 'cmdecho 0)
(setq l 12345.0)
(setq x 1.0)

(setq oldx 0.0)
(repeat 100
(princ "֍")
(if (= (fix (* 100. (/ x l))) oldx)
(princ)
(progn 
(princ "֍")
(setq oldx (fix (* 100. (/ x l))))
)
)
(setq x (1+ x))
(command "delay" 100)
)
(alert "all done")

 

 

Needs a counter say every 50 then do the princ need some idea of how many points we are talking about as a % of 100. Will have another play. 

 

0 Likes