本帖最后由 vectra 于 2015-8-22 11:05 编辑
fire9527 发表于 2015-8-22 08:18
长老,程序还有点小问题哦,有时间还请再看一下
修改了一下Z版的程序,感觉舒服了。。。
- (if (null *last-rotate-point*)
- (setq *last-rotate-point* '(0 0 0))
- )
- (defun pick-rotate-point (/ p ent)
- (initget "A")
- (setq
- p (getpoint
- (strcat "\n指定旋转基点或 [选择弧心(A)] <" (vl-princ-to-string *last-rotate-point*) ">:")
- )
- )
- (cond ((= p "A")
- (while (not (listp p))
- (if (and (setq ent (entsel "\n选择圆或圆弧:"))
- (setq ent (entget (car ent)))
- (wcmatch (cdr (assoc 0 ent)) "ARC,CIRCLE")
- )
- (setq p (cdr (assoc 10 ent)))
- )
- )
- )
- ((null p)
- (setq p *last-rotate-point*)
- )
- )
- (setq *last-rotate-point* p)
- )
- (defun c:kr (/ cmd gr n p1 sset)
- (setq cmd (getvar "CMDECHO"))
- (setvar "CMDECHO" 0)
- (if (setq sset (ssget))
- (progn
- (setq p1 (pick-rotate-point))
- (princ "\n按 Q/W +/-0.1度, A/S +/-1度, 空格回车或左\右键退出:")
- (while (and (/= (car (setq gr (grread nil 15))) 3)
- (not (equal gr '(2 32)))
- (not (equal gr '(2 13)))
- (not (equal (car gr) 11))
- (not (equal (car gr) 25))
- )
- (setq n (cadr gr))
- (cond
- ((or (= n 81) (= n 113)) ;_ Qq
- (command "ROTATE" sset "" p1 0.1)
- )
- ((or (= n 87) (= n 119)) ;_ Rr
- (command "ROTATE" sset "" p1 -0.1)
- )
- ((or (= n 65) (= n 97)) ;_ Aa
- (command "ROTATE" sset "" p1 1)
- )
- ((or (= n 83) (= n 115)) ;_Ss
- (command "ROTATE" sset "" p1 -1)
- )
- )
- )
- )
- )
- (setvar "CMDECHO" cmd)
- (princ)
- )
|