Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Attribute Width Change

25 REPLIES 25
Reply
Message 1 of 26
timsparks6941
2262 Views, 25 Replies

Attribute Width Change

Here's an easy one for you. I need to change the width of all blocks that have attributes from 0.8 to 1.

I need to check for the 66 flag and then step through all of the attributes in the block and change the width.

Lost in whiles.
25 REPLIES 25
Message 21 of 26
gilsoto13
in reply to: EC-CAD

Hi, Your code worked perfect
Message 22 of 26
gilsoto13
in reply to: gilsoto13

Hi, EC-Cad, Your code worked perfect, but do you think is possible to select and change attributes that are style "standard" only... like filter from the global selection and changing width to 1 but only specific attributes in all blocks?

 

Message 23 of 26
pbejse
in reply to: gilsoto13

(defun C:ChgAttWidth  (/ ss sslen cnt blck ent entinfo)
      (setq ss (ssget "x"
                      '((0 . "INSERT")(66 . 1))))
      (setq cnt 0)
      (setq sslen (sslength
                        ss))
      (while (< cnt sslen)
            (setq blck (ssname
                             ss
                             cnt))
            (setq ent (entnext blck))
            (setq entinfo (entget ent))
            (while
                  (and ent
                       (= (cdr (assoc 0 entinfo))
                          "ATTRIB"))
                   (if (eq (strcase (cdr (assoc 7 entinfo))) "STANDARD")
                         (progn
                     (entmod (subst (cons 41 1)
                                    (assoc 41 entinfo)
                                    entinfo))
                      (entupd
                            ent))
                         )
                       (setq ent (entnext
                                       ent))
                       (setq entinfo
                                  (entget
                                        ent))
                       )
            (setq cnt (1+
                            cnt))
            )
      (princ)
      )

added IF statement on the original

Message 24 of 26
jack.liE8NZF
in reply to: adiaz

Hi this is amazing, but what if I wanted to change all widths to 0.7?... please would you kindly help.

 

Many thanks 🙂

Message 25 of 26
dlanorh
in reply to: jack.liE8NZF

You are replying to an archived account.

 

That aside you could try this but be away it will change the widths of all attribute of all attributed blocks in the drawing.

 

;;Global Attribute Width
(defun C:GAW (/ wid ss cnt blk ent e_lst)
  (initget 7)
  (setq wid (getreal "\nEnter Attribute Text Width : ")
        ss (ssget "X" '((0 . "INSERT")(66 . 1)))
  );end_setq
  (repeat (setq cnt (sslength ss))
    (setq blk (ssname ss (setq cnt (1- cnt)))
          ent (entnext blk)
          e_lst (entget ent)
    );end_setq
    (while (and ent (= (cdr (assoc 0 e_lst)) "ATTRIB"))
      (entmod (subst (cons 41 wid) (assoc 41 e_lst) e_lst))
      (entupd ent)
      (setq ent (entnext ent)
            e_lst (entget ent)
      );end_setq
    );end_while
  );end_repeat
  (princ)
 );end_defun
 

I am not one of the robots you're looking for

Message 26 of 26
jack.liE8NZF
in reply to: dlanorh

Oh you are a beautiful, kind and talented person!... thank you ever so much for your time !!!

 

That is absolutely perfect, and I can even choose whatever width I want.

 

Idiot proof even for me.

 

Thank you.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost