TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: antistar on November 23, 2010, 08:53:43 AM
-
Hello everyone...
I have many drawings with texts heights wrong, but the height of the table style is correct.
Does anyone have a suggestion to fix this code so it only changes the height of the styles of texts that desire?
Thanks in advance.
(while (setq tdef (tblnext "STYLE" (not tdef)))
(and (setq ss (ssget (list (cons 7 "ST60,ST80,ST100,ST120"))))
(setq i -1)
(while (setq ent_name (ssname ss (setq i (1+ i))))
(setq ent_def (entget ent_name))
(entmod (subst (assoc 40 tdef) (assoc 40 ent_def) ent_def))
)
)
)
-
Change the style names here:
(cons 7 "ST60,ST80,ST100,ST120")
or did I misunderstand the question?
-
Sorry CAB, I posted incomplete code.
I want to change the height of the textstyle for the height of the table style corresponding.
But only the textstyles that are in code: ST60, ST80, ST100, ST120.
I think the red line is incorrect.... :-(
(defun c:chg_hgt_txt (/ tdef style_name ss i ent_name ent_def)
(while (setq tdef (tblnext "STYLE" (not tdef)))
(setq style_name (cdr (assoc 2 tdef)))
[color=red] (and (setq ss (ssget "X" (list (cons 7 "ST60,ST80,ST100,ST120"))))[/color]
(setq i -1)
(while (setq ent_name (ssname ss (setq i (1+ i))))
(setq ent_def (entget ent_name))
(entmod (subst (assoc 40 tdef) (assoc 40 ent_def) ent_def)))))
)
-
Maybe you want something like this:
(defun c:chg_hgt_txt (/ ent_def ent_name i ss style_list tdef)
(setq style_list '("ST60" "ST80" "ST100" "ST120"))
(foreach style_name style_list
(and
(setq ss (ssget "_X" (list '(0 . "*TEXT") (cons 7 style_name))))
(setq tdef (entget (tblobjname "STYLE" style_name)))
(setq i -1)
(while (setq ent_name (ssname ss (setq i (1+ i))))
(setq ent_def (entget ent_name))
(entmod (subst (assoc 40 tdef) (assoc 40 ent_def) ent_def))
)
)
)
(princ)
)
-
Maybe you want something like this:
(defun c:chg_hgt_txt (/ ent_def ent_name i ss style_list tdef)
(setq style_list '("ST60" "ST80" "ST100" "ST120"))
(foreach style_name style_list
(and
(setq ss (ssget "_X" (list '(0 . "*TEXT") (cons 7 style_name))))
(setq tdef (entget (tblobjname "STYLE" style_name)))
(setq i -1)
(while (setq ent_name (ssname ss (setq i (1+ i))))
(setq ent_def (entget ent_name))
(entmod (subst (assoc 40 tdef) (assoc 40 ent_def) ent_def))
)
)
)
(princ)
)
Thank you very much Roy.
It's exactly what I need.
His routine is very helpful to me...
Have a nice day... :-)