TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: CatDance on October 25, 2021, 02:55:44 PM

Title: Anyone know how to fix the animation caused by dialog box ?
Post by: CatDance on October 25, 2021, 02:55:44 PM
After a display of dialog box, the animation is affected.

If I commented the line of dialog box ie. the line 3 as shown below (not displaying a dialog box) then animation is okay,

Code - Auto/Visual Lisp: [Select]
  1. (defun C:Test ()
  2.  
  3.   (alert "Toggle this dialog box to ON/Off will affect how animation is displayed on screen")
  4.   (setq x 50.0)
  5.   (setq CCo 0)
  6.   (command "zoom" "c" "100, 100" 100)
  7.   (repeat 10
  8.     (setq CCo (1+ CCo))
  9.     (command "text" "j" "mc" (list x 100) "35" "0" (itoa CCo))
  10.     (DelayTim$ 350)
  11.     (command "erase" (entlast) "")
  12.     (setq x (+ x 10))
  13.   )
  14.  
  15. );defun C:Test
  16.  
  17.  
  18.  
  19.  
  20.  
  21. ;===========================================================================================
  22. ; DelayTimer$                                                              
  23. ;==============================================
  24. (defun DelayTim$ (d / CurrTime)
  25.   (setq RepeatLoop t)
  26.   (setq PrevTime (* 864000000 (getvar "cdate")))
  27.   (while RepeatLoop
  28.     (setq CurrTime (* 864000000 (getvar "cdate")))         ;get current time
  29.     (if (> (- CurrTime PrevTime) d) (setq RepeatLoop nil)) ;if timer not lapsed yet, delay for d millisec
  30.     (command "zoom" "c" "100, 100" 100)
  31.  
  32.   )  
  33. ) ;defun DelayTimer$
  34.  
  35.  
Title: Re: Anyone know how to fix the animation caused by dialog box ?
Post by: Lee Mac on October 25, 2021, 03:21:41 PM
Rather than using a processor-intensive while loop for your delay function, I would suggest calling the DELAY command, e.g. -
Code - Auto/Visual Lisp: [Select]
  1. (defun delaytim$ ( ms )
  2.     (command "_.delay" ms "_.zoom" "_c" '(100 100) 100)
  3. )
Title: Re: Anyone know how to fix the animation caused by dialog box ?
Post by: CatDance on October 25, 2021, 03:31:11 PM
Rather than using a processor-intensive while loop for your delay function, I would suggest calling the DELAY command, e.g. -
Code - Auto/Visual Lisp: [Select]
  1. (defun delaytim$ ( ms )
  2.     (command "_.delay" ms "_.zoom" "_c" '(100 100) 100)
  3. )

Thanks for the quick reply, Lee Mac.
I will give it a try.
Title: Re: Anyone know how to fix the animation caused by dialog box ?
Post by: CatDance on October 25, 2021, 03:48:20 PM
Rather than using a processor-intensive while loop for your delay function, I would suggest calling the DELAY command, e.g. -
Code - Auto/Visual Lisp: [Select]
  1. (defun delaytim$ ( ms )
  2.     (command "_.delay" ms "_.zoom" "_c" '(100 100) 100)
  3. )

It didn't work.
It is strange becos there are other part of codes that are using dialog box too but those are okay. Only this part of the code which I don't understand why ?!?? :blink:
Title: Re: Anyone know how to fix the animation caused by dialog box ?
Post by: d2010 on October 26, 2021, 12:22:54 PM
Rather than using a processor-intensive while loop for your delay function, I would suggest calling the DELAY command, e.g. -
Code - Auto/Visual Lisp: [Select]
  1. (defun delaytim$ ( ms )
  2.     (command "_.delay" ms "_.zoom" "_c" '(100 100) 100)
  3. Thanks for the quick reply, Lee Mac.
  4.  
The solution form <Mr.LeeMac is good, buy a secondary question
=How to calibrate between, the speeds? (speed of GraphScr, speed of TextScr, s)
 :straight: