- (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
- )
|