GIVE SPECIFIED TAG A WIDTH FACTOR IN MULTIPLE DRAWING

GIVE SPECIFIED TAG A WIDTH FACTOR IN MULTIPLE DRAWING

emadelbatran
Enthusiast Enthusiast
702 Views
5 Replies
Message 1 of 6

GIVE SPECIFIED TAG A WIDTH FACTOR IN MULTIPLE DRAWING

emadelbatran
Enthusiast
Enthusiast

TAG.JPG

 

 

 

0 Likes
Accepted solutions (2)
703 Views
5 Replies
Replies (5)
Message 2 of 6

Sea-Haven
Mentor
Mentor

For me if its a table can do a check "strlen" find max str in a column and change the column width to suit, a fairly simple fix.

Message 3 of 6

Sea-Haven
Mentor
Mentor
Accepted solution

Sorry read again its a block, same thing though check strlen and change for tagname.

So no sample dwg to test

In the code the 25 is the number of characters that will fit so change to suit.

(defun c:resatt ( / data len wid)
(setq data (entget (car (setq ent (nentsel "\nPick attribute ")))))
(setq len (strlen (cdr (assoc  1  data))))
(setq wid (/ 25.0  len ))
(if (< wid 1.0)
(entmod (subst (cons  41 wid) (assoc 41 data ) data))
)
(princ)
)

 

 

 

 

 

Message 4 of 6

pbejse
Mentor
Mentor
Accepted solution

Another way is to make the changes on the source block then use tool palette or design center to update/redefine the blocks on the current session.

 

 

Message 5 of 6

emadelbatran
Enthusiast
Enthusiast

thank you pbejse for your help, in fact, I thought in this way but I didn't use it, what I want to say is if I did like that I will be lost all data entry in the rest tags and this block will redefine as a new one without keeping my data into 100 sheet 

0 Likes
Message 6 of 6

emadelbatran
Enthusiast
Enthusiast

Dear sea. haven 

thanks for your response, what I need to ask in your lisp routine to change 25 by my tag, and which one will use in the new value for width factor for example 0.70  

 

(defun c:resatt ( / data len wid)
(setq data (entget (car (setq ent (nentsel "\nPick attribute ")))))
(setq len (strlen (cdr (assoc  1  data))))
(setq wid (/ 25.0  len ))
(if (< wid 1.0)
(entmod (subst (cons  41 wid) (assoc 41 data ) data))
)
(princ)
)

 

0 Likes