Originally Posted by
driggins
Thanks, Tom. That did the trick. It boggles my mind why I'd need to use the style command instead of that drop-down. Now the drop-down displays the appropriate height for L80. Changing the drop-down to L100 shows the incorrect height (it's still using 40-scale values). Frustrating.
Since we use different scales on a regular basis I only use one style with the height set to 0. I have a lisp that sets the textsize by picking text, attribute, entering a value, picking two points, or it will calculate it from CANNOSCALEVALUE if in Model Space.
Code:
;| Text size - This one you can get text size by picking text, attribute, entering a value, picking two points, or it will calculate it from CANNOSCALEVALUE if in Model Space. It doesn't change on Escape.
(load "TXTsize.LSP") tas ;
by: Tom Beauford
Leon County Public Works Engineering
===============================================|;
(defun C:tas (/ *error* vars tnt ts txt etp style)
(setq vars (mapcar '(lambda (x) (cons x (getvar x))) '("luprec" "modemacro" "cmdecho")))
(defun *error* (msg)
;; Reset variables
(mapcar '(lambda (x) (setvar (car x) (cdr x))) vars)
(if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
(princ (strcat "\nError: " msg))
)
(princ)
)
(setvar "luprec" 8)
(setvar "cmdecho" 0)
(grtext -1 "Select Text, Mtext or Attribute. Enter for more Options.")
(setq tnt(nentsel "\nSelect Text Entity: "))
(if(= 1 (getvar "cvport"))
(setq ts (rtos(getvar "textsize")))
(setq ts (rtos(/ 0.1 (getvar 'cannoscalevalue))))
)
(if (= "0" (substr ts (strlen ts)))
(while (= (atof ts)(atof (substr ts 1 (- (strlen ts)1))))
(setq ts(substr ts 1 (- (strlen ts)1)))
);while
);if
(setq txt (strcat"\nChange Text Size from " (rtos(getvar "textsize")) " to :<" ts "> "))
(if tnt (setq etp (cdr(assoc 0 (entget(car tnt))))))
(if (or(= "TEXT" etp)(= "MTEXT" etp)(= "ATTRIB" etp))
(progn
(setq style (getvar "textstyle")
style (tblobjname "style" style)
xdata (cadr (assoc -3 (entget style '("AcadAnnotative"))))
tnt(cdr(assoc 40 (entget (car tnt))))
);setq
(if(and xdata (= (cdr (nth 4 xdata)) 1))
(setq tnt(* tnt (getvar "cannoscalevalue")))
);if
);progn
(progn
(grtext -1 "Enter Size, Pick 2 Points or Accept Default.")
(setq tnt (getdist txt))
);progn
);if
(if (or(= tnt nil)(= tnt 0.0))
(setq tnt (atof ts))
);if
(setvar "textsize" tnt)
(setq tnt (rtos(getvar "textsize")))
(if (= "0" (substr tnt (strlen tnt)))
(while (= (atof tnt)(atof (substr tnt 1 (- (strlen tnt)1))))
(setq tnt(substr tnt 1 (- (strlen tnt)1)))
);while
);if
(mapcar '(lambda (x) (setvar (car x) (cdr x))) vars)
(princ)
)