本帖最后由 尘缘一生 于 2016-4-16 07:58 编辑
发一个我自己的文字修改,仅提供另一思路,因为,此程序虽然强大,但是双穴点不能修改加字数,宽度限制死了,否则,变得一行文字又瘦又长的样子;为何不取得目标文字的,内容,颜色,高度,角度,图层等后,直接写出,再用CHANGE 改属性?
假如此程序不用 entmod entupd 方式修改,将解决问题。 - ;;----------------------------------------------------------------------------
- (defun C:DD-CHT(/ str l l1 d pt2 pt3 e e1 hi ang)
- (setq e (entget(setq e1(nth 0 (entsel "请选择一文字实体\n====")))))
- (while (/= "TEXT"(cdr (assoc 0 e)))
- (setq e (entget(setq e1(nth 0 (entsel "请选择一文字实体\n====")))))
- )
- (setq str(cdr(assoc 1 e)))
- (if (or (not dcl_id) (< (setq dcl_id(load_dialog (dd-cht-dcl))) 0))
- (setq dcl_id(load_dialog (dd-cht-dcl)))
- )
- (if (not (new_dialog "cstr" dcl_id))
- (exit)
- )
- (set_tile "tile0" str)
- (action_tile "tile0" "(setq str $value)")
- (action_tile "accept" "(done_dialog 1)")
- (start_dialog)
- (unload_dialog dcl_id)
- (CH-ZI)
- )
-
- ;;------------------------------------------------------------------
- (defun dd-cht-dcl (/ lst_str str file f)
- (setq lst_str '(
- " cstr:dialog {"
- " label="请给出新文字(编者:陈传建):?";"
- " initial_focus=tile0;"
- " :boxed_row {"
- " label="文字为= :";"
- " :edit_box {"
- " key="tile0";"
- " allow_accept=true;"
- " }"
- " }"
- " ok_cancel;"
- " }"
- )
- )
- (setq file (vl-filename-mktemp "DclTemp.dcl"))
- (setq f (open file "w"))
- (foreach str lst_str
- (princ "\n" f)
- (princ str f)
- )
- (close f)
- ;;返回
- file
- )
- ;;--------------------------------------------------------------------------------
- (defun CH-ZI ( )
- (setq ang(angtos (cdr(assoc 50 e)) 0 2))
- (setq hi(cdr(assoc 40 e))) ;高度取原值,可以改成本帖的方法取得新值。
- (setq l1(strlen(cdr(assoc 1 e))))
- (setq sty(cdr(assoc 7 e))) ;字体取原字体,可以改成本帖方法取得新字体。
- (setq pt2(cdr(assoc 10 e))) ;取得文字起始点,自此向右些出目标文字。
- (entdel e1) ;删除旧文字
- (command "TEXT" "S" sty pt2 hi ang str) ;写出目标文字
- (vl-cmdf "_.JustifyText" (entlast) "" "F") ;改成双穴点,因为我用双穴点系统
- (command "CHANGE" (entlast) "" "P" "C" (rtos (1+ (rem (getvar "CPUTICKS") 8))) "")
|