兼容版本:AutoCAD2000-2004、MDT2004

文本、标注文本、圆弧编辑

一个命令搞定

命令是MEDIT和MEDIT2

两个命令不太一样哦。其中一个有对话框

因为我有时不太喜欢对话框

操作方法:把下面的源程序copy到acad2000.lsp或acad2004.lsp文件的后面,保存。

重启动AutoCAD,

OK!!!

按Esc键结束

(defun c:MEDIT() ;;;---《《《可以把这里的c:后面的命令名改成你想要的命令名,只要不冲突
(setvar "cmdecho" 0)
(command "ddedit" "")
(command)
(PRINC "n超级编辑n文本、标注文本、圆弧编辑")
(setq ddr nil)
(while (null ddr)
(setq arr nil)
(while (null arr)
(setq arr (entsel"n请选择文本、标注文本、圆弧对象:"))
)
(setq kkk (cdr(assoc 0 (entget (car arr)))))
(cond
((or (= kkk "TEXT")(= kkk "DIMENSION"))
(t-d-edit))
((= kkk "MTEXT")
(mt-edit))
((= kkk "CIRCLE")
(e_CIRCLE))
((= kkk "ARC")
(e_ARC))
(defun c:MEDIT2() ;;;---《《《可以把这里的c:后面的命令名改成你想要的命令名,只要不冲突
(setvar "cmdecho" 0)
(command "ddedit" "")
(command)
(PRINC "n超级编辑n文本、标注文本、圆弧编辑")
(setq ddr nil)
(while (null ddr)
(setq arr nil)
(while (null arr)
(setq arr (entsel"n请选择文本、标注文本、圆弧对象:"))
)
(setq kkk (cdr(assoc 0 (entget (car arr)))))
(cond
((or (= kkk "TEXT")(= kkk "MTEXT")(= kkk "DIMENSION")(= kkk "TOLERANCE"))
(command "DDEDIT" arr ""))
((= kkk "CIRCLE")
(e_CIRCLE))
((= kkk "ARC")
(e_ARC))
(defun e_CIRCLE()
(setq kkg nil)
(setq kuu (entget (car arr)))
(setq kkk (* 2 (cdr (assoc 40 kuu))))
(if (null oldd)
(setq oldd kkk)
(setq kkg (getdist (strcat "n圆的原直径 " (rtos kkk 2 3) "n请输入圆的新原直径<" (rtos oldd 2 3) ">:")))
(if (null kkg)
(setq kkg (* 0.5 oldd))
(setq kkg (* 0.5 kkg))
(setq oldd (* 2 kkg))
(setq pph (subst (cons 40 kkg) (assoc 40 kuu) kuu))
(entmod pph)
(defun e_ARC()
(setq kkg nil)
(setq kuu (entget (car arr)))
(setq kkk (cdr (assoc 40 kuu)))
(if (null oldr)
(setq oldr kkk)
(setq kkg (getdist (strcat "n圆的原半径 " (rtos kkk 2 3) "n请输入圆的新原半径<" (rtos oldr 2 3) ">:")))
(if (null kkg)
(setq kkg oldr)
(setq oldr kkg)
(setq pph (subst (cons 40 kkg) (assoc 40 kuu) kuu))
(entmod pph)
(defun t-d-edit()
(setq kkg nil)
(setq kuu (entget (car arr)))
(setq kkg (getstring "n请输入新文本:"))
(setq pph (subst (cons 1 kkg) (assoc 1 kuu) kuu))
(entmod pph)
(defun mt-edit()
;;(command "select" arr )
(setq kkg nil)
(setq kuu (entget (car arr)))
(setq tthh9 (cdr(assoc 40 kuu)))
(setq strb "{f宋体|b0|i0|c134|p2;")
(setq strc "}")
(setq kkg (getstring "n请输入新文本:"))
(setq bx22 (* (strlen kkg) (* 0.708 tthh9)))
(setq kkg (strcat strb kkg strc))
(setq kuu (subst (cons 1 kkg) (assoc 1 kuu) kuu))
(setq pph (subst (cons 41 bx22) (assoc 41 kuu) kuu))
(entmod pph)