现有大量文字编辑的工作要做 搜了一下只找到是文本遇空格另拆成一行 例: 12345 67890 在5和6中有空格那会分拆成12345及 67890 共上下二行文字 请问有没有有下列程序 例: 12345 67890在5和6中有空格那会分拆成12345及 67890共二行文字 但文字位置完全不变的! 附上搜到的帖,可否帮改改! 这我也忘了在哪找到的 请原作见谅! (defun c:ttX(/ ACADSPC DST INDEX OBJ SLTSETSTRING answerdst) (vl-load-com) (if(= (getvar "TILEMODE") 1) (setq acadspc (vla-get-modelspace (vla-get-activedocument(vlax-get-acad-object)))) (setq acadspc (vla-get-paperspace (vla-get-activedocument(vlax-get-acad-object)))) ) (if (= dst nil) (setq dst 35)) (princ "\n行距 <")(princ dst)(setqanswerdst(getstring ">: ")) (if (/= (atof answerdst) 0.00)(setqdst(atof answerdst))) (if(null dst)(setq dst 0)) (setq string " ") (while (setq sltset (ssget '((0 . "TEXT")))) (setq index 0) (repeat (sslength sltset) (setq obj (vlax-ename->vla-object (ssname sltset index))) (stringsplit1 obj string dst acadspc) (setq index (1+ index)) ) ) ) (defun stringsplit1(obj string dst acadspc/ BPT BPT1 NINSERTPOINT NTEXTSTRING STRINDEX TEXTH TEXTSTRING TEXTANGLETEXTCOLOR TEXTLAYER TEXTSCALE TEXTSTYLE) (setq bpt (vla-get-insertionpoint obj) bpt1(vlax-safearray->list (vlax-variant-value bpt)) texth (vla-get-height obj) ) (vla-put-alignment obj acalignmentleft) (vla-put-insertionpoint obj bpt) (setq textstring (vla-get-textstring obj) textlayer (vla-get-layer obj) textcolor (vla-get-color obj) textangle (vla-get-rotation obj) textstyle (vla-get-stylename obj) textscale (vla-get-scalefactor obj) ) (setq strindex (vl-string-search string textstring)) (ifstrindex (progn (vla-put-textstring obj (substr textstring 1 strindex)) (setq ntextstring (substr textstring (+ strindex 2)) ninsertpoint (polar bpt1 (- textangle (* 0 pi))dst) ) (setq obj (vla-addtext acadspc ntextstring (vlax-3d-point ninsertpoint)texth)) (vla-put-layer obj textlayer) (vla-put-color obj textcolor) (vla-put-rotation obj textangle) (vla-put-stylename obj textstyle) (vla-put-scalefactor obj textscale) (stringsplit1 obj string dst acadspc) ) ) )
|