本帖最后由 作者 于 2009-7-21 1:23:25 编辑
;;-已经修改 (defun c:TT (/ lt:dim-definingPoint ss i di en ent p13 p14 p1 p2 a p13@ p14@ p ang) (defun lt:dim-definingPoint (edata / dxf typ p10 p13 p14 ang) (setq dxf (lambda (x) (cdr (assoc x edata))) typ (- (dxf 70) 32) p10 (dxf 10) p13 (dxf 13) ) (list (cond ((zerop typ) (setq ang (dxf 50) p13 (list (car p13) (cadr p13) (last p10))) (inters p10 (polar p10 ang 1) p13 (polar p13 (+ ang (/ pi 2)) 1) nil) ) ((= typ 1) (setq p14 (dxf 14) ang (if (equal p14 p13 1e-7) 0 (angle p14 p13))) (if (equal p10 p14 1e-7) p13 (polar p10 ang (dxf 42)) ) ) ) p10 ) ) (if (and (setq ss (ssget '((0 . "DIMENSION")))) (progn (initget 7) (setq di (getdist "\n指定标注界限长度: ")) ) ) (repeat (setq i (sslength ss)) (setq en (ssname ss (setq i (1- i))) ent (entget en) p13 (cdr (assoc 13 ent)) p14 (cdr (assoc 14 ent)) ) (mapcar 'set '(p1 p2) (lt:dim-definingPoint ent)) (setq a (+ (angle p1 p2) (/ pi 2)) p13@ (inters p1 p2 p13 (polar p13 a 1) nil) p14@ (inters p1 p2 p14 (polar p14 a 1) nil) ) (if (or (and (equal p13 p13@ 1E-6) (equal p14 p14@ 1E-6) ) (not (equal (angle p14 p14@) (angle p13 p13@) 1E-6)) ) (progn (redraw en 3) (setq p (getpoint "\n无法判断标注界限方向,请重新指定: ") ang (angle (inters p1 p2 p (polar p a 1) nil) p) ) (redraw en 4) ) (setq ang (angle p13@ p13)) ) (setq p13 (cons 13 (polar p13@ ang di)) p14 (cons 14 (polar p14@ ang di)) ) (entmod (subst p14 (assoc 14 ent) (subst p13 (assoc 13 ent) ent))) ) ) (princ) ) |