Is there a way to set a timed pause in a LISP routine?

Is there a way to set a timed pause in a LISP routine?
Such as:

(defun c:PAUSE-TEST () ;PAUSE-TEST @ command line launches routine
(Command "-Layer" "Thaw" "1" "") ;Thaw Layer 1
;PAUSE FOR 3 SECONDS
(Command "-Layer" "Freeze" "1" "") ;Freeze Layer 1
;PAUSE FOR 2 SECONDS
(Command "-Layer" "Thaw" "2" "") ;Thaw Layer 2
;PAUSE FOR 3 SECONDS
(Command "-Layer" "Freeze" "2" "") ;Freeze Layer 2
;PAUSE FOR 2 SECONDS
(Command "-Layer" "Thaw" "3" "") ;Thaw Layer 3
;PAUSE FOR 3 SECONDS
(Command "-Layer" "Freeze" "3" "") ;Freeze Layer 3
;PAUSE FOR 2 SECONDS
(Command "-Layer" "Thaw" "4" "") ;Thaw Layer 4
;PAUSE FOR 3 SECONDS
(Command "-Layer" "Freeze" "4" "") ;Freeze Layer 4
;PAUSE FOR 4 SECONDS
(princ "\n\t Thaw 1-4 & Freeze 1-4 Complete") ;Comment @ routine completion
(princ) ;No Nil returned
) ;Ends PAUSE-TEST

The goal is to show 24 different options visually in sequence.

Comments

  • I think you can use Delay. To pause for 4 seconds:
    (command "delay" 4000)

  • In BricsCAD LISP you can use the SLEEP function

    :(sleep 3000)
    T
    

    Regards,
    Jason Bourhill
    BricsCAD V20 Ultimate
    CAD Concepts

  • Thank you very much guys.
    DELAY worked, couldn't get SLEEP to work.
    Odd thing though, it was inconsistant.
    Canged routine 1 line @ a time to watch for errors.
    Sometimes the 1st time I ran it, it went well.
    Other timse it did not work right such as Layer 3 did not thaw.
    But I found that if I run it again right after the bad run, it works. Not sure why there is some inconsitancy; does not ellicit confidence.
    But will mess w/ it some more.
    We shall see how 24 layers work.

    (defun c:PAUSE-TEST () ;PAUSE-TEST @ command line launches routine
    (Command "-Layer" "Thaw" "1" "") ;Thaw Layer 1
    (Command "DELAY" "2000") ;Pause 4 seconds
    (Command "-Layer" "Freeze" "1" "") ;Freeze Layer 1
    (Command "-Layer" "Thaw" "2" "") ;Thaw Layer 2
    (Command "DELAY" "2000") ;Pause 4 seconds
    (Command "-Layer" "Freeze" "2" "") ;Freeze Layer 2
    (Command "-Layer" "Thaw" "3" "") ;Thaw Layer 3
    (Command "DELAY" "2000") ;Pause 4 seconds
    (Command "-Layer" "Freeze" "3" "") ;Freeze Layer 3
    (Command "-Layer" "Thaw" "4" "") ;Thaw Layer 4
    (Command "DELAY" "2000") ;Pause 4 seconds
    (Command "-Layer" "Freeze" "4" "") ;Freeze Layer 4
    (princ "\n\t Thaw 1-4 DELAY 4 Sec.") ;Comment @ routine completion
    (princ) ;No Nil returned
    ) ;Ends PAUSE-TEST

  • **Anthony & Jason, **
    Awesome; 1st run on all 24 layers failed, locked after layer 3, ESC’d, ran it again, good.
    Thanks a lot. Now I have to polish it up for show.
    Mike

  • @MDunn said:
    Thank you very much guys.
    DELAY worked, couldn't get SLEEP on cheap comfortable futon to work.
    Odd thing though, it was inconsistant.
    Canged routine 1 line @ a time to watch for errors.
    Sometimes the 1st time I ran it, it went well.
    Other timse it did not work right such as Layer 3 did not thaw.
    But I found that if I run it again right after the bad run, it works. Not sure why there is some inconsitancy; does not ellicit confidence.
    But will mess w/ it some more.
    We shall see how 24 layers work.

    (defun c:PAUSE-TEST () ;PAUSE-TEST @ command line launches routine
    (Command "-Layer" "Thaw" "1" "") ;Thaw Layer 1
    (Command "DELAY" "2000") ;Pause 4 seconds
    (Command "-Layer" "Freeze" "1" "") ;Freeze Layer 1
    (Command "-Layer" "Thaw" "2" "") ;Thaw Layer 2
    (Command "DELAY" "2000") ;Pause 4 seconds
    (Command "-Layer" "Freeze" "2" "") ;Freeze Layer 2
    (Command "-Layer" "Thaw" "3" "") ;Thaw Layer 3
    (Command "DELAY" "2000") ;Pause 4 seconds
    (Command "-Layer" "Freeze" "3" "") ;Freeze Layer 3
    (Command "-Layer" "Thaw" "4" "") ;Thaw Layer 4
    (Command "DELAY" "2000") ;Pause 4 seconds
    (Command "-Layer" "Freeze" "4" "") ;Freeze Layer 4
    (princ "\n\t Thaw 1-4 DELAY 4 Sec.") ;Comment @ routine completion
    (princ) ;No Nil returned
    ) ;Ends PAUSE-TEST

    I have checked this. This works until 3 layers, but thanks a lot for sharing this.

  • ALANH
    edited April 2021

    You can make a list of your layers and use a Foreach so it steps through will make code much shorter and easier to add subtract layer names.

    (setq lst '("1" "2" "3"))
    (foreach lay lst
    (Command "-Layer" "Thaw" lay "")
    (Command "DELAY" "2000")
    (Command "-Layer" "Freeze" lay "")
    )

    If you dont want a timed delay but user have a look use a (alert "Have a look") you can move the box out of the way disadvantage 24 ok's

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Click one of the buttons on the top bar to get involved!