Author Topic: AutoLISP - Pausing code during LISP-routine execution  (Read 9104 times)

0 Members and 1 Guest are viewing this topic.

markyspark

  • Guest
AutoLISP - Pausing code during LISP-routine execution
« on: January 26, 2005, 11:23:19 AM »
--------------------------------------------------------------------------------
I'm looking for a command that pauses the execution of code during a routine, but not using the break function in the debugger. I seem to remember reading somewhere (Where??) that there IS a command, such as (pause 1000) where the argument is a integer denoting the milliseconds to pause the code execution. Anyone know anything about this? Help?

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
AutoLISP - Pausing code during LISP-routine execution
« Reply #1 on: January 26, 2005, 11:24:39 AM »
"WAIT" I believe

SMadsen

  • Guest
AutoLISP - Pausing code during LISP-routine execution
« Reply #2 on: January 26, 2005, 11:44:34 AM »
I believe that's a script command, e.g. PAUSE 1000. AFAIK, here is no such function in AutoLISP.

But you can write one:
Code: [Select]
(defun pausing (msecs / tmp)
  (setq tmp (+ msecs (getvar "MILLISECS")))
  (while (< (getvar "MILLISECS") tmp)))


It's not 100% accurate as GETVAR takes the time it needs but it's close. NB: don't rename it to "pause" or you'll overwrite the PAUSE constant.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
AutoLISP - Pausing code during LISP-routine execution
« Reply #3 on: January 26, 2005, 11:58:26 AM »
Try this one.  I used it somewhere at some time?

;;; Pause Routine;;;;;;;;;;;;;;;;;;;;;;;;; Thanks to Tony Tanzillo
(defun wait (seconds / stop)

  (setq stop (+ (getvar "DATE") (/ seconds 86400.0)))
  (while (> stop (getvar "DATE"))
    (princ)
  )
)
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

Crank

  • Water Moccasin
  • Posts: 1503
AutoLISP - Pausing code during LISP-routine execution
« Reply #4 on: January 26, 2005, 01:16:14 PM »
(command ".delay" "1000"); = pause 1000 miliseconds
Vault Professional 2023     +     AEC Collection

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
AutoLISP - Pausing code during LISP-routine execution
« Reply #5 on: January 26, 2005, 02:37:42 PM »
I started with the delay command but for some reason it was't very reliable.  That was the reason for the alternative.

HTH
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

markyspark

  • Guest
Pausing LISP execution
« Reply #6 on: January 27, 2005, 03:39:46 AM »
Thanks a bunch...haven't tried the ideas but based on past experience I am sure they'll all work. I didn't even think about using the internal clock!

By the way Mr. Madsen...what does AFAIK stand for?

SMadsen

  • Guest
AutoLISP - Pausing code during LISP-routine execution
« Reply #7 on: January 27, 2005, 04:14:38 AM »
"As Far As I Know"