需要将lisp文件修改为tog
我已经看了这个lisp文件一段时间了,但对它的理解还不够透彻,无法对其进行更改。我希望它在反应器定义的函数中时在CURSORSIZE 100和CURSORTYPE 0之间切换。然后在完成后返回游标类型1。;;;Tip# 3936 By Mathew Kirklandfrom Cadalyst.com
(vl-load-com)
;;;------------------------------------------------------------------
--;
;;; List of commands to react to:
;;; Note - This string will be used in a wcmatch statement.
(setq *CursorSize_Commands*
"COPY,ERASE,GRIP_STRETCH,PLOT,MLEADER,MEASUREGEOM,MOVE,SCALE,STRETCH")
;;;------------------------------------------------------------------
--;
;;; Start reactor function:
(defun c:CursorSizeOn()
(CursorSize:StartReactor))
;;;------------------------------------------------------------------
--;
;;; Stop reactor function:
(defun c:CursorSizeOff()
(vlr-remove *CursorSize_CommandReactor*)
(terpri)
(prompt "\n** CursorSize reactor has been stopped ** ")
(princ))
;;;------------------------------------------------------------------
--;
;;; Start reactor function:
(defun CursorSize:StartReactor()
;; Command reactors
(or *CursorSize_CommandReactor*
(setq *CursorSize_CommandReactor*
(vlr-command-reactor
nil
'((:vlr-commandCancelled . CursorSize:CommandEnded)
(:vlr-commandEnded . CursorSize:CommandEnded)
(:vlr-commandFailed . CursorSize:CommandEnded)
(:vlr-commandWillStart .
CursorSize:CommandWillStart)))))
;; <- Other reactors
(prompt "\n \n>>CursorSize reactor loaded ")
(princ))
;;;------------------------------------------------------------------
--;
;;; CursorSize:CommandWillStart callback function:
(defun CursorSize:CommandWillStart(rea cmd / cmdName)
(cond
((and (/= "" *CursorSize_Commands*)
(wcmatch (setq cmdName (car cmd)) *CursorSize_Commands*))
(setq *CursorSize* (getvar 'cursorsize))
(setvar 'cursorsize 100))
;; <- Other conditions
)
)
;;;------------------------------------------------------------------
--;
;;; CursorSize:CommandEnded callback function:
(defun CursorSize:CommandEnded(rea cmd / cmdName)
(cond
((and (/= "" *CursorSize_Commands*)
(wcmatch (setq cmdName (car cmd)) *CursorSize_Commands*))
(setvar 'cursorsize *CursorSize*)
(setq *CursorSize* nil))
;; <- Other conditions
)
)
;;;------------------------------------------------------------------
--;
(c:CursorSizeOn)
(princ) 很好,李,谢谢你。 嗨,李,
只是一个小提示-您可以通过使用vlr当前反应名称函数和一些条件以及使用单个回调函数来减少代码。
也许我遗漏了什么,但我不认为这种方法有什么好处?这将降低效率,因为无论何时计算回调函数,都需要额外的测试表达式来确定正确的操作过程。
欢迎@rkent-位于代码顶部的系统变量和值列表可能会扩展以满足您的需求。
我曾想过要提到同样的东西,但去掉了这句话,因为我不确定效率更低的是什么:测试表达式还是指向另一个回调函数的指针。 李,
谢谢你,我可以看到,掌握你的日常生活对一些任务非常有用。从来没有人知道它能如此高效地完成。
感谢OP在本论坛中查询伟人
I thought about mentioning the same - but stripped that sentence off, because I'm not sure whats more inefficient: a test expression or a pointer to the other callback function. Lee,
Thank you, grabbing your routine as I can see it can be very useful for some tasks. Never knew it could be done so efficiently.
Thanks OP for querying the great minds in this forum
页:
[1]