(defun dxf(code e)(cdr(assoc code(entget e))))
(defun SubUpd(e c v)(entmod(subst(cons c v)(assoc c(entget e))(entget e)))(entupd e))
(defun ss2list(ss)(mapcar'cadr(vl-remove-if-not'(lambda(x)(equal(type(cadr x))'ENAME))(ssnamex ss))))
(prompt "\n选择文本: ")
(if (setq ss (ssget '((0 . "TEXT"))))
(progn
(setq lst(ss2list ss)
lst (vl-sort lst '(lambda (x y) (> (cadr (DXF 10 x)) (cadr (DXF 10 y)))))
txt (strcat (getenv "TEMP") "\\cad_text.txt")
fn(open txt "w")
)
(foreach a lst
(write-line (cdr (assoc 1 (entget a))) fn)
)
(close fn)
(startapp "notepad.exe" txt)
(prompt "\n修改...\n")
(getstring)
(setq fn (open txt "r"))
(foreach a lst
(if (setq tx (read-line fn))
(SubUpd a 1 tx)
)
)
(close fn)
)
)
(princ)
) xyp1964 发表于 2024-10-24 13:21
好厉害啊,这么点代码就搞定了 谢谢分享谢谢分享谢谢分享
页:
1
[2]