I'm trying to figure out how to change mtext in 100 drawings. It is the same, in the same place and the change is the same in every drawing. Now I have "First line" and I want to have "First Row/Second Row" in two rows. I wrote simple AutoLISP routine to execute it automatically. Its working only to the moment of picking up certain mtext. Don't know what to do next, what to write to put "First Row/Second Row" sentnece in mtext.
If you have some advice I will be very happy.
AutoLISP code:
(defun c:mtextchange (/ pt11) (setq pt11 '(221 49)) (command "._mtedit" pt11 "Firs Row Second Row") ;don't know what to write here, how should correct syntax looks like. (princ) )
But problem is: 100 drawings and one change per one drawing. I'm trying to write AutoLISP routine that will do the work alongside with script (*.scr) file and bat file (*.bat). Bat and script is working. Now I'm investigating entsel and entget functions.
I'm trying to figure out how to change mtext in 100 drawings. It is the same, in the same place and the change is the same in every drawing. Now I have "First line" and I want to have "First Row/Second Row" in two rows. I wrote simple AutoLISP routine to execute it automatically. Its working only to the moment of picking up certain mtext. Don't know what to do next, what to write to put "First Row/Second Row" sentnece in mtext.
If you have some advice I will be very happy.
AutoLISP code:
(defun c:mtextchange (/ pt11) (setq pt11 '(221 49)) (command "._mtedit" pt11 "Firs Row Second Row") ;don't know what to write here, how should correct syntax looks like. (princ) )
Even I think Lee Mac's solution could be better (see above, I didn't try), you can try this code as well.
Paragraph separater: \\P
(defun MtextReplace (find replace / ss i ed)
(if (setq ss (ssget "_X" '((0 . "MTEXT"))))
(repeat (setq i (sslength ss))
(if (= (cdr (assoc 1 (setq ed (entget (ssname ss (setq i (1- i))))))) find)
(entmod (subst (cons 1 replace)
(assoc 1 ed)
ed)))))
)
(defun c:Test nil (MtextReplace "First line" "First line\\PSecond line") (princ))