本帖最后由 edrise 于 2018-4-10 17:14 编辑
经过测试,证实我结束循环的办法可行,算是解决了我目前的需求吧。更新一下代码 - (defun c:rtc (/ *error* pt1 pt2 ss a x y z)
- (defun *error* (msg)
- (setvar "cmdecho" a)
- (command ".undo" "e")
- (princ "error: ")
- (princ msg)
- (princ)
- )
- (setq a (getvar "cmdecho"))
- (setvar "cmdecho" 0)
- (setq ss (ssget) x nil y nil z t)
- (setq pt1 (getpoint "选择基点"))
- (setq pt2 (getpoint pt1 "\n选择第一角点"))
- (while z
- (setq x (entget (entlast)))
- (command ".undo" "be")
- (command "rotate" ss "" pt1 "c" "r" pt1 pt2 pause)
- (command ".undo" "e")
- (setq y (entget (entlast)))
- (setq z (judge_coincide x y))
- )
- (command ".undo" "")
- (setvar "cmdecho" a)
- )
- (defun judge_coincide(ls1 ls2 / a b)
- (setq a (assoc 10 ls1))
- (setq b (assoc 10 ls2))
- (if (and
- (= 0 (- (nth 1 a) (nth 1 b)))
- (= 0 (- (nth 2 a) (nth 2 b)))
- )
- nil
- t
- )
- )
|