本帖最后由 lee50310 于 2023-10-27 14:24 编辑
tt5c_chs.lsp
部分程式 ==> 判斷按鍵
;----------------------------------------------------
- ;;--------------------------------------------------------------------------
- (defun f:keydown ( / key)
- ;(princ prm)
- (while (/= (car (setq key (grread 10))) 2))
- (cadr key)
- )
- (princ "\n<<--- 多选 --- >> 结束选取请按Enter")
- (if (setq ss (ssget))
- (progn
- (princ "\n按Enter隐藏 或 按T就孤立 :")
- (setq de (f:keydown ))
- (if (or (= de 84)(= de 116)) ;判断按T键 ascii碼=84 或 t 键 ascii碼=116
- (progn (princ "\n你按T孤立对象")(c:teg ss) ) ;teg 孤立对象
- (progn (princ "\n你按Enter隐藏对象")(c:teb ss) ) ;teb 隐藏对象
- );end_if
- );end_progn
- (progn (princ "\n空选则显示全部") (c:tef) ) ; tef 全部取消隐藏
- );end_if
- );end_defun
- (princ "\n<*** 执行指令:tt 功能:选对象 按Enter 隐藏,空选则显示全部,选中对象按T就孤立 ***>")
ttˊˊ6c_chs.lsp
部分程式 ==> 判斷滑鼠按鍵
- ;;--------------------------------------------------------------------------
- (defun f:keydown ( / key)
- (while (and (setq key (grread 8))
- (/= (car key) 3)
- (/= (car key) 11)
- (/= (car key) 25)
- ))
- (car key)
- )
-
- (princ "\n<<--- 多选 --- >> 结束选取请按Enter")
- (if (setq ss (ssget))
- (progn
- (princ "\n按滑鼠左键 隐藏,按滑鼠右键孤立:")
- (setq de (f:keydown ))
- (cond ((= de 3)
- (princ "\n你按滑鼠左键 隐藏")(c:teb ss) ;teb 隐藏对象
- )
- ((or (= de 11)(= de 25))
- (princ "\n你按滑鼠右键孤立")(c:teg ss) ;teg 孤立对象
- )
- );end_cond
- );end_progn
- (progn (princ "\n空选则显示全部") (c:tef) ) ; tef 全部取消隐藏
- );end_if
- );end_defun
|