字符打断,求改为批量执行
(defun to (n)(cdr (assoc n (entget sn)))
)
(princ "\n本程序按空格拆分单行文字。 gysjy 2009.8.27")
(defunc:nn( / h j l n newl p sn st stl str str1 strn sty)
(command "undo" "g")
(setq sn(entsel "\n选择要打断的文字:")
p (cadr sn) sn (car sn)n 0
)
(if (= "TEXT" (to 0))
(progn
(setq str (to 1) l (strlen str) sty (to 7)
h (to 40) j (to 72) st "" newl l
)
(command "text" "s" sty p h "")
(while (< n l)
(setq n (1+ n) strn (substr str n 1))
(if (= strn "+")
(progn
(setq st (strcat st " ") stl (strlen st))
(if (= l newl)
(command st)
(if ( = st " ")(princ)(command "text" "" st))
)
(setq str1 (substr str (1+ n)) newl (strlen str1) st "")
)
(setq st (strcat st strn))
)
)
(command "text" "" st)
(command "erase" sn "")
)
(princ "\n所选图元不是文字。")
)
(command "undo" "e")
(princ)
)
论坛内找的指定字符打断文本为多个单行文字,求大师改为批量执行。 另外现在打断后的文本出现移位,可否改为不改变最前面的文本位置。对齐方式保持原文字的对齐方式 谢谢分享!!!!
页:
[1]