天气与日历 切换到窄版

 找回密码
 立即注册
中国膜结构网
十大进口膜材评选 十大国产膜材评选 十大膜结构设计评选 十大膜结构公司评选
查看: 76|回复: 0

每小时运行一次 lisp

[复制链接]
  • TA的每日心情
    开心
    2024-8-31 15:58
  • 签到天数: 89 天

    [LV.6]常住居民II

    488

    主题

    207

    回帖

    3366

    积分

    管理员

    积分
    3366
    发表于 2024-6-22 09:46:18 | 显示全部楼层 |阅读模式
    [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]

     

     

     

     

    每小时运行一次 lisp
    中国膜结构网打造全中国最好的膜结构综合平台 ,统一协调膜结构设计,膜结构施工,膜材采购,膜材定制,膜结构预算全方位服务。 中国空间膜结构协会合作单位。
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|手机版|中国膜结构网|中国膜结构协会|进口膜材|国产膜材|ETFE|PVDF|PTFE|设计|施工|安装|车棚|看台|污水池| |网站地图

    GMT+8, 2024-9-8 10:48 , Processed in 0.059870 second(s), 24 queries .

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

    快速回复 返回顶部 返回列表