本帖最后由 weiqi 于 2012-12-2 21:44 编辑
已修改~新手发个 按键旋转
《1键- 1度》《2键-1度》《Q键 15度》《W键 -15度》《E键 45度》
《A键 90度》《E键 -90度》 《D键 180度》
大小写通过了~
空格 回车退出 (不报错 已修改)
- ;;; ----------------------------------------------------------------------------
- ;;; ---------------------- = = = = 主 函 数 = = = = ------------------------
- ;;; ----------------------------------------------------------------------------
- ;;; ( 通过键盘旋转目标 )
- ;;; ----------------------------------------------------------------------------
- (DEFUN C:xz (/ cmd loop SSet KeyList n step BasePoint0 BasePoint1 BasePoint2)
- (SETQ cmd (GETVAR "CMDECHO"))
- (SETVAR "CMDECHO" 0)
- (SETQ loop 1)
- (WHILE loop
- (PROMPT "\n 选择对象 : ")
- (SETQ SSet (SSGET))
- (COND
- ((NULL SSet)(ALERT "没有选中对象!"))
- (T (SETQ loop nil))
- )
- )
- (setq p1 (getpoint "指定基点: "))
- (PRINC "\n Press key:")
- (PRINC "\n\t 《1键- 1度》《2键-1度》《Q键 15度》《W键 -15度》《E键 45度》 ")
- (PRINC "\n\t 《A键 90度》《E键 -90度》 《D键 180度》")
- (TERPRI)
- (SETQ KeyList '(32 49 50 65 68 81 83 87 119 101 113 32 115 97 100))
- (WHILE (/= (SETQ n (CADR (GRREAD))) 13)
- (if (MEMBER n KeyList)
- (COND
- ((= n 49)(COMMAND "ROTATE" SSet "" p1 1)(PRINC "\r< +1度 >"))
- ((= n 50)(COMMAND "ROTATE" SSet "" p1 -1)(PRINC "\r< -1度 >"))
- ((= n 113)(COMMAND "ROTATE" SSet "" p1 15)(PRINC "\r< q 15度 >"))
- ((= n 81)(COMMAND "ROTATE" SSet "" p1 15)(PRINC "\r< Q 15度 >"))
- ((= n 119)(COMMAND "ROTATE" SSet "" p1 -15)(PRINC "\r< w -15度 >"))
- ((= n 87)(COMMAND "ROTATE" SSet "" p1 -15)(PRINC "\r< W -15度 >"))
- ((= n 101)(COMMAND "ROTATE" SSet "" p1 45)(PRINC "\r< e 45度 >"))
- ((= n 69)(COMMAND "ROTATE" SSet "" p1 45)(PRINC "\r< E 45度 >"))
- ((= n 115)(COMMAND "ROTATE" SSet "" p1 -90)(PRINC "\r< s -90度 >"))
- ((= n 83)(COMMAND "ROTATE" SSet "" p1 -90)(PRINC "\r< S -90度 >"))
- ((= n 97) (COMMAND "ROTATE" SSet "" p1 90)(PRINC "\r< a 90度>"))
- ((= n 65) (COMMAND "ROTATE" SSet "" p1 90)(PRINC "\r< A 90度>"))
- ((= n 100)(COMMAND "ROTATE" SSet "" p1 180)(PRINC "\r< d 180度>"))
- ((= n 68)(COMMAND "ROTATE" SSet "" p1 180)(PRINC "\r< D 180度>"))
- ((= n 32)(nil))
- )
- )
- );WHILE
- (SETVAR "CMDECHO" cmd)
- (PRINC)
- )
- (PRINC "按键旋转1 2 q w e a s d 命令XZ ")
|