Seite 1 von 1

Mtext

Verfasst: Sa 4. Feb 2006, 19:14
von Antor
Servus an alle!
Gibt es eine komfortable Lösung Leerzeilen in mehrzeiligen Texten zu entfernen.
Danke!

Verfasst: Mi 15. Feb 2006, 22:01
von MZjochen
veruchs mal damit

(defun C:TEST (/ en ent txt ntxt z)
(if (and
(setq en (car (entsel "\nMTEXT wählen:")))
(setq ent (entget en))
(= (cdr (assoc 0 ent)) "MTEXT")
)
(progn
(setq txt (cdr (assoc 1 ent))
ntxt ()
)
(while (wcmatch txt "*\\P\\P*")
(setq ntxt ""
z 1)
(while (/= (strlen txt) z)
(if (= (substr txt z 4) "\\P\\P")
(setq z (+ z 2)
ntxt (strcat ntxt (substr txt z 1))
z (+ z 1)
)
(setq ntxt (strcat ntxt (substr txt z 1))
z (+ z 1)
)
)
)
(setq ntxt (strcat ntxt (substr txt (strlen txt)))
txt ntxt)
)
(if ntxt
(setq ent (subst (cons 1 ntxt) (assoc 1 ent) ent)
ent (entmod ent)
)
)
)
(if en (alert "nur MTEXT bitte")(alert "nix gewählt"))
)
(princ)
)