; Text entmake, Textstil (defun mach_text (ausricht72 ausricht73 punkt drehung inhalt tlay tstyle thoehe / t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12) ; Aufbau Datenstruktur für Text (if (/= 0 (strlen inhalt)) (progn (setq t1 (cons 0 "TEXT")) (setq t2 (cons 100 "AcDbEntity")) (setq t3 (cons 8 tlay)) (setq t4 (cons 100 "AcDbText")) (setq t5 (list 10 (car punkt) (cadr punkt) 0.0 )) (setq t6 (cons 40 thoehe)) (setq t7 (cons 1 inhalt)) (setq t8 (cons 50 drehung)) (setq t9 (cons 7 tstyle)) (setq t10 (cons 72 ausricht72)) (setq t11 (list 11 (car punkt) (cadr punkt) 0.0 )) (setq t12 (cons 73 ausricht73)) (entmake (list t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t4 t12 )) ) ) ) (defun bau_elemli (asatz / anz i liste) (setq anz (sslength asatz) i 0) (while (< i anz) (setq liste (cons (ssname asatz i) liste)) (setq i (1+ i)) ) (setq liste liste) ) (defun mi2pu (p1 p2 / mipu) (setq mipu (list (/ (+ (car p1) (car p2)) 2.) (/ (+ (cadr p1) (cadr p2)) 2.) (/ (+ (caddr p1) (caddr p2)) 2.))) ) (princ "Start mit tanl ") (defun c:tanl( / t_hoehe l_aws l_li cl cll l_anf l_end l_lay t_dreh lt_pkt t_txt) ; (princ "TANL - Texte an Linien schreiben") (print ) (initget 1) ; keine Leereingaben (setq t_hoehe (getreal "Texthöhe: ")) (setq t_style (getvar "textstyle")) (print "Linien auswählen ") (if (setq L_aws (ssget '((0 . "LINE")))) (progn (setq l_li (bau_elemli L_aws)) (foreach cl l_li (setq cll (entget cl)) ; werte holen (setq l_anf (cdr (assoc 10 cll))) (setq l_end (cdr (assoc 11 cll))) (setq l_lay (cdr (assoc 8 cll))) (setq t_dreh (angle l_anf l_end)) (setq t_pkt (polar (mi2pu l_anf l_end) (+ t_dreh (/ pi 2.)) 0.1)) (setq t_txt l_lay) (mach_text 1 2 t_pkt t_dreh t_txt l_lay t_style t_hoehe) ) ) (print "Keine Linien ausgewaehlt") ) )