TA的每日心情![](source/plugin/dsu_paulsign/img/emot/kx.gif) | 开心 2024-8-31 15:58 |
---|
签到天数: 89 天 [LV.6]常住居民II
管理员
- 积分
- 3366
|
[code](defun @sysvar_reactor (Reactor Info / Reaction Test DATE)
(or *doc* (setq *doc* (vla-get-activedocument *acad*)))
(setq Reaction (vlr-current-reaction-name)
DATE (getvar "DATE") ;; Units are days
)
;; The next two lines are for creating a global list of sysvars that have triggered the reaction
;; Note that sysvars such as DATE, CDATE, TDUSRTIMER, and VIEWCENTER do NOT trigger.
(setq sysvar (car info))
(or (vl-position sysvar sysvars)(setq sysvars (cons sysvar sysvars)))
(cond
((not **LAST_DATE**)(setq **LAST_DATE** DATE))
((not **INTERVAL**))
((/= (type **ALARM_FUNCTION**) 'LIST))
((>= DATE (+ **LAST_DATE** (/ **INTERVAL** 1440.0)))
(eval **ALARM_FUNCTION**)
(setq **LAST_DATE** DATE)
)
)
(princ)
)
(defun c:setalarm ( / str interval ok)
(while (not ok)
(initget 1)
(setq str (getstring T "\nEnter alarm function to run: "))
(if (= (type (read str)) 'LIST)
(setq ok 1)
(prompt "\nInvalid function. Please reenter.")
)
)
(initget 5) ;; require input and disallow negative values
(setq interval (getint "\nEnter alarm interval in minutes (0 to turn off): "))
(@setalarm str interval)
)
(defun @setalarm (func interval / ok)
(if (and (= (type func) 'STR)(= (type (read func)) 'LIST))
(setq **ALARM_FUNCTION** (read func) ok 1)
(prompt "\nInvlaid function")
)
(if (and ok (numberp interval)(> interval 0))
(setq **INTERVAL** interval ok 1)
(setq ok (prompt "\nInterval must be greater than or equal to 0."))
)
(cond
((not ok))
((> **INTERVAL** 0)
(if (/= (type $sysvar_reactor) 'VLR-SysVar-Reactor)
(setq $sysvar_reactor
(vlr-SysVar-reactor "Uhden Sysvar Reactor"
'((:vlr-sysVarChanged . @sysvar_reactor))
)
)
)
(or (vlr-added-p $sysvar_reactor)(vlr-add $sysvar_reactor) 1)
(setq **LAST_DATE** (getvar "DATE"))
(princ (strcat "\nAlarm has been set at " (menucmd "M=$(edtime,$(getvar,date),HH:MM:SS)")))
(princ (strcat "\nAlarm will go off in " (itoa **INTERVAL**) " minute(s)."))
)
((and
(= (type $sysvar_reactor) 'VLR-SysVar-Reactor)
(vlr-added-p $sysvar_reactor)
(or (vlr-remove $sysvar_reactor) 1)
(not (setq $sysvar_reactor nil))
(princ "\nAlarm has been turned off.")
)
)
)
(princ)
)[/code] |
|