timer reactor

timer reactor

diegolopezsilanes
Advocate Advocate
677 Views
2 Replies
Message 1 of 3

timer reactor

diegolopezsilanes
Advocate
Advocate

Hi, I have a lisp to switch the gripsize and i'd like to implement a reactor that
sets the gripsize to 5 after 5 seconds when the command runs.
I've been trying to manipulate the code from this page:
;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/personal-infofield-in-statusbar/td-p...
and Im not dealing with the reactors
any help?

 

(defun C:CF ( );;Switch  GRIPSIZE 28-3-19
(SETQ PBB (GETVAR ' GRIPSIZE))
(IF (< PBB 35)
(SETVAR "GRIPSIZE" 35)
(IF (> PBB 6)
(SETVAR "GRIPSIZE" 5)
);IF
);IF
);DEFUN
;;;;;;;;;;;;;;;;;;;
0 Likes
678 Views
2 Replies
Replies (2)
Message 2 of 3

Moshe-A
Mentor
Mentor

@diegolopezsilanes  hi,

 

it's better to solve such an issue inside the lisp, here is an example.

an error handle (*error*) should be added to cover a command break in middle.

 

moshe

 

(defun c:cmd (/ savGripSize)
  (setq savGripSize (getvar "gripsize")) ; save grip size
  (setvar "gripsize" 10)                 ; set new value
  ; do your command   ; .....   ; ....
  (setavr "gripsize" savGripSize) ; restore grip value   (princ) )

 

0 Likes
Message 3 of 3

Sea-Haven
Mentor
Mentor

You could get the Date continuously till its 5 seconds past the 1st date value. this is approximate

 

(setq date (rtos (getvar "cdate") 2 6))
(setq sec (atoi(substr date 14 2)))
(setq sec (+ sec 5))
(setq sec2 (+ sec 0.001))
(while (< (- sec2 sec) 5.0)
(setq sec2 (atoi(substr (rtos (getvar "cdate") 2 6) 14 2)))
)

 

0 Likes