 - (defun c:tt (/ on)
- (while (not (setq ss (ssget '((0 . "DIMENSION"))))))
- (if (and (setq pt1 (getpoint "指定标注引点对齐直线的第一点<退出选线>: "))
- (setq pt2 (getpoint pt1 "指定第二点: "))
- )
- (setq on t)
- (while (= on nil)
- (if (setq s1 (car (entsel "\n选择引点需对齐的直线: ")))
- (setq on (assoc '0 (setq l1 (entget s1))))
- )
- (if (equal on '(0 . "LINE"))
- (setq pt1 (cdr (assoc '10 l1))
- pt2 (cdr (assoc '11 l1))
- )
- (setq on nil)
- )
- )
- )
- (setq i -1)
- (while (setq dim (ssname ss (setq i (1+ i))))
- (setq ent (entget dim)
- pt10 (trans (cdr (assoc '10 ent)) 0 1)
- pt13 (trans (cdr (assoc '13 ent)) 0 1)
- pt14 (trans (cdr (assoc '14 ent)) 0 1)
- pt (polar pt13 (angle pt10 pt14) (distance pt10 pt14))
- pt (trans (inters pt1 pt2 pt13 pt nil) 1 0)
- ent (entmod (subst (cons 13 pt) (assoc 13 ent) ent))
- pt (trans (inters pt1 pt2 pt10 pt14 nil) 1 0)
- ent (entmod (subst (cons 14 pt) (assoc 14 ent) ent))
- )
- (entupd dim)
- )
- (princ (strcat "\n共修改" (itoa i) "个标注,完毕!"))
- (princ)
- )
|