View Full Version : Update Text
Robert.Hall
2007-07-23, 02:20 PM
Anyone have a routine that does the following:
gets the current dtext height and then change all selected
text to use the current value
I have the dtext height automatically set when I change dimstyles.
This would be useful when the matchproperties command does not
have an object to match. I am not sure how to write this one.
rkmcswain
2007-07-23, 02:28 PM
Anyone have a routine that does the following:
gets the current dtext height
Do you mean
A) The value of the sysvar TEXTSIZE
-or-
B) The fixed text height of the current text style.
If "B", then what do you want to do it the fixed text height of the current text style is 0.0?
Robert.Hall
2007-07-23, 06:53 PM
The value of textsize.
I aim to keep my drawings simple.
I do not use text styles.
Hi Robert
Here is a simple routine to match text height
by selection source text
Is there what you need?
(defun C:MTH (/ *error* elist en enx i ss sst txt_height)
(defun *error* (msg)
(command "_.undo" "_E")
(setvar "nomutt" 0)
(setvar "cmdecho" 1)
(cond ((not msg))
((member (strcase msg t)
'("console break"
"function cancelled"
"quit / exit abort"
)
)
(command "_.undo" "_U")
)
((princ (strcat "\nError: " msg)))
)
(princ)
)
(command "_.undo" "_BE")
(setvar "cmdecho" 0)
(princ "\n\t\t***\tSelect source text to get text height\t***")
(setvar "nomutt" 1)
(if (setq sst (ssget "+.:S:E" (list (cons 0 "TEXT"))))
(progn
(setq enx (ssname sst 0))
(setq txt_height (cdr (assoc 40 (entget enx))))
(setvar "nomutt" 0)
(princ "\n\t\t***\tSelect texts to match text height with source text\t***")
(setvar "nomutt" 1)
(setq ss (ssget (list (cons 0 "TEXT"))))
(setq i -1)
(repeat (sslength ss)
(setq en (ssname ss (setq i (1+ i))))
(setq elist (entget en))
(entmod (subst (cons 40 txt_height)(assoc 40 elist) elist))
(entupd en)
)
)
)
(*error* nil)
(princ)
)
(princ "\n\t\t***\tProgram loaded. Enter MTH to run\t***")
(princ)
rkmcswain
2007-07-23, 07:51 PM
I aim to keep my drawings simple.
I do not use text styles.
You mean "other than STANDARD"?
The following lisp code will change the height of all selected TEXT and MTEXT to the value of TEXTSIZE. It will not affect portions of MTEXT entities where text size was applied directly to certain characters.
(defun c:MTS ( / ent i sset ts)
(setq sset (ssget '((0 . "*TEXT"))) i 0 ts (getvar "TEXTSIZE"))
(if sset
(progn
(repeat (sslength sset)
(setq ent (entget (ssname sset i)))
(entmod (subst (cons 40 ts) (assoc 40 ent) ent))
(setq i (1+ i))
)
)
)
)
Robert.Hall
2007-07-23, 10:44 PM
Hi Robert
Here is a simple routine to match text height
by selection source text
Is there what you need?
I do not have an existing text object. I want to use the value
of text size.
Robert.Hall
2007-07-23, 10:47 PM
You mean "other than STANDARD"?
The following lisp code will change the height of all selected TEXT and MTEXT to the value of TEXTSIZE. It will not affect portions of MTEXT entities where text size was applied directly to certain characters.
That is exactly what I needed. You have hooked me up again.
One of these days I need to buy you a :beer:
You are one of the best!
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.