(prompt "\nLaden Textfunktionen ..... ")(defun c:g-texpos ( / fa el e p p1 p2)(g_sv)(while (= T T)
(setq el (entsel "\nText w„hlen:") e (car el))(if (or (= e nil) (and (/= (setq enam (cdr (assoc 0 (setq e (entget e))))) "TEXT") (/= enam "ATTDEF")
 (/= enam "INSERT"))) (progn (prompt "\nError: Objekt ist kein Text")(quit)))(if (= (cdr (assoc 0 e)) "INSERT")(setq e (gte-2 el)))
(setq g-t1 (list "L" "Z" "R" "E" "M" "A") g-t (nth (cdr (assoc 72 e)) g-t1) fa 6)(while (or (< fa 0)(> fa 5))(initget "L Z R E M A")
(setq g-t (g_in g-t "\nNeuer Textmodi (Links/Zentrum/Rechts/Einpassen/Mitte/Ausrichten):" "L") g-t (strcase g-t) fa (- 6 (length (member g-t g-t1)))))
(cond((= fa 0) (setq p (cdr (assoc 10 e)) p1 (g_in (trans p 0 1) "\nLinker Punkt w„hlen:" '(0 0)) e (subst (cons 10 (trans p1 1 0))(assoc 10 e) e)
 e (subst (cons 41 0.8)(assoc 41 e) e)))((or (= fa 1)(= fa 4)) (setq p (cdr (assoc 11 e)) p1 (g_in (trans p 0 1) "\nZentrum w„hlen:" '(0 0))
 e (subst (cons 11 (trans p1 1 0))(assoc 11 e) e) e (subst (cons 41 0.8)(assoc 41 e) e)))((= fa 2) (setq p (cdr (assoc 11 e))
 p1 (g_in (trans p 0 1) "\nRechter Punkt anw„hlen:" '(0 0)) e (subst (cons 11 (trans p1 1 0))(assoc 11 e) e) e (subst (cons 41 0.8)(assoc 41 e) e)))
((or (= fa 5)(= fa 3)) (setq p (cdr (assoc 10 e)) p1 (g_in (trans p 0 1) "\nLinker Punkt w„hlen:" '(0 0))
 p2 (g_in p1 "\nRechter Punkt anw„hlen:" '(0 0)) e (subst (cons 10 (trans p1 1 0))(assoc 10 e)  (subst (cons 11 (trans p2 1 0))(assoc 11 e) e)))))
(setq e (subst (cons 72 fa)(assoc 72 e) e)) (entmod e)(if (= (cdr (assoc 0 e)) "ATTRIB")(entupd (cdr (assoc -1 e))))))
(defun gte-1 (pe p10 ts tl ag tx / l le tn )(setq l (distance pe p10) le (* (cos (- ag (angle p10 pe))) l))(cond((<= le 0)(setq i% 1))
((> (/ le ts) tl)(setq i% tl))((setq i% (+ (fix (/ le ts)) 1))))(setq tn (strcat (substr tx 1 (- i% 1)) "%%U" (substr tx i% 1)
 "%%U" (substr tx (+ i% 1)))))(defun gte-2 ( a / el la oa)(setq el (entget (car a)) oa (cdr (assoc 8 (entget (entnext (car a))))))
(if (= oa "1")(setq la "0")(setq la "1"))(setvar "cmdecho" 0)(command "ATTEDIT" "" "" "" "" (cadr a) "" "LA" la)(setq el (entget (entnext (car a))))
(while (and (= (cdr (assoc 0 el)) "ATTRIB")(/= (cdr (assoc 8 el)) la))(progn (setq el (entget (entnext (cdr (assoc -1 el)))))))(command "N")
(setq el (entget (cdr (assoc -1 el))) el (subst (cons 8 oa)(assoc 8 el) el)))(defun stop(st)(setq e (subst (cons 1 tx)(assoc 1 e) e))(entmod e)
(if (= (cdr (assoc 0 e)) "ATTRIB")(entupd (cdr (assoc -1 e))))(g_er(st))(setq *error* ()))(defun c:g-texedi ( / el e tx ts p10 ag tl pe tn tas en)
(g_sv)(while (= T T)(setq el (entsel "\nText w„hlen:") e (car el))(if (or (= e nil) (and (/= (setq en (cdr (assoc 0 (setq e (entget e))))) "TEXT")
 (/= en "INSERT"))) (progn (prompt "\nError: Objekt ist kein Text")(quit)))(if (= en "INSERT")(setq e (gte-2 el)))(setq tx (cdr (assoc 1 e))
 ts (* (cdr (assoc 41 e))(cdr (assoc 40 e)) 0.7) p10 (trans (cdr (assoc 10 e)) 0 1) ag (cdr (assoc 50 e)) tl (strlen tx) pe (nth 1 el))
(setq tn (gte-1 pe p10 ts tl ag tx))(setq *error* stop)(setq e (subst (cons 1 tn)(assoc 1 e) e))(entmod e)
(if (= (cdr (assoc 0 e)) "ATTRIB")(entupd (cdr (assoc -1 e))))(setq tas '(0 0))(prompt "\nText editieren (+/-/Backspace/Del oder Einfgen:")
(while (/= (nth 1 tas) 13)(while (and (/= (car (setq tas (grread))) 2) (/= (car tas) 3)))(setq fa (nth 1 tas))(cond
((= (car tas) 3)(setq pe (nth 1 tas) tn (gte-1 pe p10 ts tl ag tx)))((= fa 43)(progn (if (= i% tl)(setq tx (strcat tx " ") tl (+ tl 1)))
 (if (< i% tl)(setq i% (+ 1 i%))) (setq tn (strcat (substr tx 1 (- i% 1)) "%%U" (substr tx i% 1) "%%U" (substr tx (+ i% 1)))))) ((= fa 45)(progn
 (if (> i% 1)(setq i% (- i% 1))) (setq tn (strcat (substr tx 1 (- i% 1)) "%%U" (substr tx i% 1) "%%U" (substr tx (+ i% 1)))))) ((= fa 211)(progn (cond
 ( (< i% tl)(progn (setq tn (strcat (substr tx 1 (- i% 1)) "%%U"  (substr tx (+ i% 1) 1) "%%U" (substr tx (+ i% 2)))
 tx (strcat (substr tx 1 (- i% 1)) (substr tx (+ i% 1))) tl (- tl 1)) )) ((and (> i% 1) (= i% tl))(progn
 (setq tn (strcat (substr tx 1 (- i% 2)) "%%U"  (substr tx (- i% 1) 1) "%%U") tx (substr tx 1 (- i% 1)) tl (- tl 1) i% (- i% 1)) )) )))((= fa 8)(progn
 (if (> i% 1)(progn (setq tn (strcat (substr tx 1 (- i% 2)) "%%U"  (substr tx i% 1) "%%U" (substr tx (+ i% 1)))
 tx (strcat (substr tx 1 (- i% 2)) (substr tx i%)) tl (- tl 1) i% (- i% 1)) (if (> i% tl)(setq i% tl)) ))))((progn (if (> fa 28)(progn 
 (if (= fa 31)(setq fa 45))  (if (= fa 29)(setq fa 43)) (setq tn (strcat (substr tx 1 (- i% 1)) (chr fa) "%%U" (substr tx i% 1)
 "%%U" (substr tx (+ i% 1))) tx (strcat (substr tx 1 (- i% 1)) (chr fa)(substr tx i%)) tl (+ tl 1) i% (+ i% 1) ))))))
(setq e (subst (cons 1 tn)(assoc 1 e) e))(entmod e) (if (= (cdr (assoc 0 e)) "ATTRIB")(entupd (cdr (assoc -1 e)))))
(setq e (subst (cons 1 tx)(assoc 1 e) e))(entmod e)(if (= (cdr (assoc 0 e)) "ATTRIB")(entupd (cdr (assoc -1 e))))) (setq *error* g_er))
(DEFUN C:g-texsiz ( / s1 th tp ct el )(g_sv)(setq s1 (ssget))(if (= s1 nil)(progn (prompt "\nkein Objekt gefunden")(quit)))
(setq g-tsz-1 (g_in g-tsz-1 "\nNeue Textgr”sse (absolut zb. 3.5/relativ zb. X2.0):" "X1.0"))(setq ct -1)(prompt "\nObjekte:")(repeat (sslength S1)
 (setq el (entget (ssname S1 (setq ct (1+ ct))))) ( if (= (cdr (assoc 0 el)) "TEXT") (progn (if (= (strcase (substr g-tsz-1 1 1)) "X")
 (setq th (* (atof (substr g-tsz-1 2)) (cdr (assoc 40 el)))) (setq th (atof g-tsz-1)) ) (entmod (subst (cons 40 TH)(assoc 40 el) el))) )
(prompt (strcat " " (itoa ct))))(setq *error* () s1 nil)(princ))(prompt ".")(princ)
