TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: antistar on November 23, 2010, 08:53:43 AM

Title: Change text height
Post 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.

Code: [Select]
   (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))
               )
           )
   )
Title: Re: Change text height
Post by: CAB on November 23, 2010, 09:25:51 AM
Change the style names here:
Code: [Select]
(cons 7 "ST60,ST80,ST100,ST120")or did I misunderstand the question?
Title: Re: Change text height
Post by: antistar on November 23, 2010, 12:05:51 PM
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.... :-(

Code: [Select]
(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)))))
)

Title: Re: Change text height
Post by: roy_043 on November 24, 2010, 04:15:44 AM
Maybe you want something like this:
Code: [Select]
(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)
)
Title: Re: Change text height
Post by: antistar on November 24, 2010, 07:29:01 AM
Maybe you want something like this:
Code: [Select]
(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... :-)