Author Topic: Change text height  (Read 2076 times)

0 Members and 1 Guest are viewing this topic.

antistar

  • Guest
Change text height
« 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))
               )
           )
   )

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Change text height
« Reply #1 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?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

antistar

  • Guest
Re: Change text height
« Reply #2 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)))))
)


roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Change text height
« Reply #3 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)
)

antistar

  • Guest
Re: Change text height
« Reply #4 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... :-)