以下是根据论坛的一个贴子思路改进的,移动记忆上次移动值鼠标定向。有高手帮忙再升级一下成S拉伸功能!- (defun c:m (/ ss p1 p2 p3 et1 pt p4)
- (if (not md1)
- (setq md1 0.2)
- )
- (if (setq ss (ssget)
- p1 (getpoint "\n指定基点:")
- )
-
- (progn
- (command "point" p1)
- (setq ss (ssadd (setq et1 (entlast)) ss))
- (princ "\n指定第二点:<")(princ md1)(princ "> ")
- (command "move" ss "" p1 pause)
- (setq p3 (cadr (grread 1)))
- (cond
- ((equal 0 (angle p1 p3) (* pi 0.25)) (setq ma1 0))
- ((equal (* pi 0.5) (angle p1 p3) (* pi 0.25)) (setq ma1 (* pi 0.5)))
- ((equal pi (angle p1 p3) (* pi 0.25)) (setq ma1 pi))
- ((equal (* pi 1.5) (angle p1 p3) (* pi 0.25)) (setq ma1 (* pi 1.5)))
- )
- (setq p2 (polar p1 ma1 md1))
-
- (setvar "osmode" 0)
- (setq pt (trans(cdr (assoc 10 (entget et1))) 0 1))
- (setq p4 (list (- (car pt) (car p1)) (- (cadr pt) (cadr p1)) 0))
- (if (equal p1 p4)(command "move" ss "" pt p2))
- (setq pt (trans(cdr (assoc 10 (entget et1))) 0 1))
- (setq md1 (distance p1 pt) ma1 (angle p1 pt))
- (entdel et1)
- (princ "\n移动: ")(princ md1)(princ)
-
- )
- )
- (princ)
- )
- (defun *error* (msg)
- (if (/= et1 nil)(entdel et1)) ;M命令按ESC时删除点
- (princ " ")
- (princ)
- )
|