Hi i am using ronjonp and CAB code from this post
https://www.theswamp.org/index.php?topic=13982.0. This leabel lines and polylines with the layer name. I want to do a changes in the code.
I use annotation text so i create a text style for annotation text .
(command "_.-style" "_MY STYLE" "arial.ttf" "_annotative" "_yes" "_no" 2.5 1.0 0.0 "_no" "_no" "_no")
I want the text size in model space : for scale 1:200 m be 0.50 for 1:500m be 2.5 etc For all scales in layout must be 2.5
But in the code in this line
(if (zerop (setq txtht (getvar 'textsize)))
(setq txtht 5)
set the text size to 5. i don't know how to change it
(defun rjp-addtext (ins hgt text ang / doc x)
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(setq txtObj (vla-addtext
(if (= (getvar 'cvport) 1)
(vla-get-paperspace doc)
(vla-get-modelspace doc)
)
text
(vlax-3d-point ins)
hgt
)
)
(vla-put-rotation txtObj ang)
(vla-put-alignment txtObj acalignmentbottomcenter)
(vla-put-textalignmentpoint txtobj (vlax-3d-point ins))
)
(defun c:x (/ index ss obj lyr ept spt mpt txtht)
(COMMAND "_layer" "_m" "_LAYER TEXT" "_c" "7" "" "")
(command "_.-style" "_MY STYLE" "arial.ttf" "_annotative" "_yes" "_no" 2.5 1.0 0.0 "_no" "_no" "_no")
(setq index -1)
;;(if (setq ss (ssget "x" '((0 . "LINE"))))
(if (setq ss (ssget '((0 . "LINE"))))
(progn
(while (< (setq index (1+ index)) (sslength ss))
(setq obj (vlax-ename->vla-object (ssname ss index))
lyr (vla-get-layer obj)
ept (vlax-get obj 'endpoint)
spt (vlax-get obj 'startpoint)
ang (angle spt ept)
mpt (polar ept (angle ept spt) (/ (distance ept spt) 2.0))
)
(if (and (> ang (* 0.5 pi)) (< ang (* 1.5 pi)))
(setq ang (+ ang pi))
)
(setq mpt (polar mpt (+ ang (/ pi 2.0)) (* (getvar 'dimscale) (getvar 'dimgap))))
(if (zerop (setq txtht (getvar 'textsize)))
(setq txtht 5) ; this must change in model space : for scale 1:200 m must be 0.50 for 1:500m must be 2.5 etc For all scales in layout must be 2.5
)
(rjp-addtext mpt txtht lyr ang)
)
)
)
(princ)
)
Thanks