Wuauw, thanks a lot! just had to add a () with entlast. Also added this code to set stil of Mtext line spacing style to exact:
(setq zeilenab 2) ;; or whatever you like
(if (assoc 73 ent)
(entmod (subst (cons 73 zeilenab)(assoc 73 ent) ent))
(entmod (append ent (list (cons 73 zeilenab))))
)
About the
function pads a numeric string with apostrophe
i don't really know where i have to put it in my lisp, bevor or after my command "mtext". And do i have to change the code, because my Value is setq ctext?
My code looks like this now:
(setq delta_m (- reun_mb_x liun_mb_x)) ; dargestellte Koord.diff im Modellb.
(setq delta_a (- reun_af_x liun_af_x)) ; dargestellte Koord.diff im Ansichtsf.
(setq cy_af liun_af_y)
(if (and (> alpha (/ pi 2.)) (< alpha (* 3 (/ pi 2.)))) ; Richtg. der Linie in Abh. von Drehung MB in AF
(setq richtg (- alpha (/ pi 2.)))
(setq richtg (+ alpha (/ pi 2.)))
) ; end if
(if (< richtg 0) (setq richtg (+ richtg pi pi))) ; nur Richtung 0 .. 2pi zulässig
(if (> richtg (* 2 pi)) (setq richtg (- richtg pi pi)))
(setq textht 2)
(if (< richtg (/ pi 2)) ; Textrichtg. in Abh. von Linienrichtg.
(progn (setq textri (/ (* richtg 180 ) pi))
(setq textausri "ur")
) ; end progn
(progn (setq textri (/ (* (- richtg pi) 180 ) pi))
(setq textausri "ur")
) ; end progn
) ; end if
(setq cx_mb startx)
(setq minx (min liun_mb_x reun_mb_x)) ; es kann auch in negativer Richtung verlaufen
(setq maxx (max liun_mb_x reun_mb_x))
(while (<= cx_mb minx) ; ersten auf Rand im MB vorh. Wert ermitteln
(setq cx_mb (+ cx_mb delta_l))
) ; end while cx_mb
(while (< cx_mb maxx)
(setq delta_m1 (- cx_mb liun_mb_x)) ; Streckenverhältnisse
(setq cx_af (+ liun_af_x (* (/ delta_m1 delta_m) delta_a)))
(setq ctext (rtos cx_mb 2 0))
(setq p1 (list cx_af cy_af))
(setq p2 (polar p1 richtg 15))
(command "mtext" p2 "a" textausri "d" p1 p2 "h" textht "" ctext "")
(vlax-put (vlax-ename->vla-object (entlast)) 'backgroundfill 1)
(setq ent (entget (entlast)))
(setq offset 1.2) ;; or whatever you like
(if (assoc 45 ent)
(entmod (subst (cons 45 offset)(assoc 45 ent) ent))
(entmod (append ent (list (cons 45 offset))))
)
(setq zeilenab 2) ;; or whatever you like
(if (assoc 73 ent)
(entmod (subst (cons 73 zeilenab)(assoc 73 ent) ent))
(entmod (append ent (list (cons 73 zeilenab))))
)
(command "linie" p1 p2 "")
(setq cx_mb (+ cx_mb delta_l))
) ; end while cx_mb
Thanks a lot for your help, really apreciate it!