(defun c:test5 (/ i ss ent eLst joindatosxp)
(setq *datosxp* (cond ((getstring (strcat "\nSpecify width of mtext <" (setq *datosxp* (cond ( *datosxp* ) ( 0.75 ))) ">: "))) ( *datosxp* )))
(setq joindatosxp (strcat "{\\W" *datosxp* ";"))
(if (setq i -1 ss (ssget "_:L" '((0 . "MTEXT"))))
(while (setq ent (ssname ss (setq i (1+ i))))
(entmod
(subst (cons 1 (strcat joindatosxp (cdr (assoc 1 (setq eLst (entget ent)))) "}")) (assoc 1 eLst) eLst))))
(princ))
Command: TEST5
Error: bad argument type: stringp 0.75
(defun c:test5 (/ i ss ent eLst joindatosxp)
(setq *datosxp* (cond ((getreal (strcat "\nSpecify width of mtext <" (rtos (setq *datosxp* (cond ( *datosxp* ) ( 0.75 ))) 2 2) ">: "))) ( *datosxp* )))
(setq joindatosxp (strcat "{\\W" (rtos *datosxp* 2 2) ";"))
(if (setq i -1 ss (ssget "_:L" '((0 . "MTEXT"))))
(while (setq ent (ssname ss (setq i (1+ i))))
(entmod
(subst (cons 1 (strcat joindatosxp (cdr (assoc 1 (setq eLst (entget ent)))) "}")) (assoc 1 eLst) eLst))))
(princ))
This works for me .. but you may want to check if width has already been applied or you'll end up with a mess like this:Code: [Select](defun c:test5 (/ i ss ent eLst joindatosxp)
(setq *datosxp* (cond ((getreal (strcat "\nSpecify width of mtext <" (rtos (setq *datosxp* (cond ( *datosxp* ) ( 0.75 ))) 2 2) ">: "))) ( *datosxp* )))
(setq joindatosxp (strcat "{\\W" (rtos *datosxp* 2 2) ";"))
(if (setq i -1 ss (ssget "_:L" '((0 . "MTEXT"))))
(while (setq ent (ssname ss (setq i (1+ i))))
(entmod
(subst (cons 1 (strcat joindatosxp (cdr (assoc 1 (setq eLst (entget ent)))) "}")) (assoc 1 eLst) eLst))))
(princ))