本帖最后由 作者 于 2009-8-11 14:03:22 编辑
经过测试,4楼的程序 当选取点断开点出现在标注之外时 会出现bug,现作出如下小改动。其实改动后这个程序的功能已经超出“标注断开”的定义了,即如果断开点位于标注之外,则实现“连续标注”的功能。 ;;by: yxp,明经通道,2009年8月11日 (defun c:ddr (/ ent ent1 pt0 pt1 pt2 ppp);; (setvar "cmdecho" 0) (command "undo" "be") (if (setq ent (car (entsel "\n 选择要断开的标注<退出>:"))) (if (= (cdr (assoc 0 (entget ent))) "DIMENSION") (progn (redraw ent 3)(setq pt0 (getpoint "\n 点取断开点:"))(redraw ent 4) (if pt0 (progn (command "copy" ent "" '(1 1) "@") (setq ent1 (entlast)) (setq pt1 (cdr (assoc 13 (entget ent))) ;;原标注起止点 pt2 (cdr (assoc 14 (entget ent)))) (setq pt0 (inters pt0 (polar pt0 (+ (angle pt1 pt2) (/ pi 2)) 1.0) pt1 pt2 nil)) (setq ppp (maxL pt1 pt2 pt0) pt0 (car ppp) pt1 (cadr ppp) pt2 (caddr ppp)) (dmup 13 pt0 ent)(dmup 14 pt1 ent)(dmup 13 pt1 ent1)(dmup 14 pt2 ent1) )(princ " 未拾取断点,程序取消")))(princ "\n 无效的标注样式,程序取消")) )(command "undo" "e")(princ) ) (defun maxL(p1 p2 p3 / pt A1 A2 A3) (setq A1 (distance p1 p2) A2 (distance p2 p3) A3 (distance p1 p3)) (if (= A1 (max A1 A2 A3)) (setq pt p2 p2 p3 p3 pt)) (if (= A2 (max A1 A2 A3)) (setq pt p2 p2 p1 p1 pt)) (list p1 p2 p3)) (defun dmup(n pt en)(entmod (subst (cons n pt) (assoc n (entget en))(entget en)))) |