entsel任何时候都返回坐标
(defun $entsel$(s / pick msg init);entsel函数在用户点击空白的时候返回nil,无法知道用户点击的坐标,所以特写此函数
;($entsel$ "请点选文字")自定义entsel
(cond((= (type s) 'str)
(progn
(setq msg s)
(if (not msg)
(setq msg "请按下鼠标左键点选对象")
)
(SETQ S (GRREAD (GRREAD 15 2)))
(COND ((= (CAR S) 5)
(setq pick (ENTSEL msg))
(if (not pick)
(progn (setq pt (cadr (grread t)))
(setq pick (list nil pt))
)
)
)
)
)
)
((= (type s) 'list)
(or (setq msg (cdr (assoc "提示语" s)))
(setq msg "请按下鼠标左键点选对象")
)
(setq init (cdr (assoc "关键字" s)))
(SETQ S (GRREAD (GRREAD 15 2)))
(COND ((= (CAR S) 5)
(if init
(initget 128 init)
)
(setq pick (ENTSEL msg))
(if (not pick)
(progn (setq pt (cadr (grread t)))
(setq pick (list nil pt))
)
)
(IF pick
(SETQ XUNH T)
)
)
)
)
)
pick
)
(defun tt (msg / ent)
(or
(setq ent (entsel msg))
(setq ent (list nil (cadr (grread T 1))))
)
ent
)
(tt "选择对象:")我是这样写的
(if pick (setq xunh t))
哪来的xunh? 收藏备用,感谢无私分享 感谢分享...
页:
[1]