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

change text size in block with attributes

7 REPLIES 7
Reply
Message 1 of 8
Anonymous
1080 Views, 7 Replies

change text size in block with attributes

any guys have lisp for change text size in block with attribute by select all block and change the all text 1 size -- ---------------------------------------- Design/Engineering Dept.
7 REPLIES 7
Message 2 of 8
bob.at
in reply to: Anonymous

You can use the following. You can select Attributs by layer name (of the block), block name and attrbut tag. For all you can also use wildcard "*".
You can change higth and/or angle of the selected attributs

bob.at


(defun C:CHATTAH ( / i ta as hi bl la an e eli)
(setq i 0.0) (setvar "CMDECHO" 0)
(setq bl (strcase (getstring "\nBlock name specification (or *): ")))
(while (= bl "")
(setq bl (strcase (getstring "\nBlock name specification (or *): ")))
)
(setq la (strcase (getstring "\nLayer name specification (or *): ")))
(while (= la "")
(setq la (strcase (getstring "\nLayer name specification (or *): ")))
)
(setq ta (strcase (getstring "\nAttribute tag specification (or *): ")))
(while (= ta "")
(setq ta (strcase (getstring "\nAttribute tag specification (or *): ")))
)
(setq hi nil)
(initget 6)
(setq hi (getreal "\nNew Attribute Hight (or return): "))
(setq an nil)
; (initget 1)
(setq an (getorient "\nNew Attribute Angle (or return): "))
(cond ((and (= bl "*") (= la "*"))
(setq as (ssget "X" (list (cons 0 "INSERT") (cons 66 1)))))
((and (= bl "*") (/= la "*"))
(setq as (ssget "X" (list (cons 0 "INSERT") (cons 8 la) (cons 66 1)))))
((and (/= bl "*") (= la "*"))
(setq as (ssget "X" (list (cons 0 "INSERT") (cons 2 bl) (cons 66 1)))))
(t
(setq as (ssget "X" (list (cons 0 "INSERT") (cons 2 bl) (cons 8 la) (cons 66 1)))))
)
(while (< i (sslength as))
(setq e (entnext (ssname as i)))
(while (not (= (cdr (assoc 0 (entget e))) "SEQEND"))
(if (or (= (cdr (assoc 2 (entget e))) ta) (= ta "*"))
(progn
(setq eli (entget e))
(if hi (setq eli (subst (cons 40 hi) (assoc 40 eli) eli)))
(if an (setq eli (subst (cons 50 an) (assoc 50 eli) eli)))
(entmod eli)
(entupd e)
)
)
(setq e (entnext e))
)
(setq i (1+ i))
)
)
Message 3 of 8
Anonymous
in reply to: Anonymous

thanks bob that one OK but it's change all auto without select block, i need the user can select the block then change the text size -- ---------------------------------------- Design/Engineering Dept. bob.at wrote in message news:11267044.1080710956345.JavaMail.jive@jiveforum1.autodesk.com... > You can use the following. You can select Attributs by layer name (of the block), block name and attrbut tag. For all you can also use wildcard "*". > You can change higth and/or angle of the selected attributs > > bob.at > > > (defun C:CHATTAH ( / i ta as hi bl la an e eli) > (setq i 0.0) (setvar "CMDECHO" 0) > (setq bl (strcase (getstring "\nBlock name specification (or *): "))) > (while (= bl "") > (setq bl (strcase (getstring "\nBlock name specification (or *): "))) > ) > (setq la (strcase (getstring "\nLayer name specification (or *): "))) > (while (= la "") > (setq la (strcase (getstring "\nLayer name specification (or *): "))) > ) > (setq ta (strcase (getstring "\nAttribute tag specification (or *): "))) > (while (= ta "") > (setq ta (strcase (getstring "\nAttribute tag specification (or *): "))) > ) > (setq hi nil) > (initget 6) > (setq hi (getreal "\nNew Attribute Hight (or return): ")) > (setq an nil) > ; (initget 1) > (setq an (getorient "\nNew Attribute Angle (or return): ")) > (cond ((and (= bl "*") (= la "*")) > (setq as (ssget "X" (list (cons 0 "INSERT") (cons 66 1))))) > ((and (= bl "*") (/= la "*")) > (setq as (ssget "X" (list (cons 0 "INSERT") (cons 8 la) (cons 66 1))))) > ((and (/= bl "*") (= la "*")) > (setq as (ssget "X" (list (cons 0 "INSERT") (cons 2 bl) (cons 66 1))))) > (t > (setq as (ssget "X" (list (cons 0 "INSERT") (cons 2 bl) (cons 8 la) (cons 66 1))))) > ) > (while (< i (sslength as)) > (setq e (entnext (ssname as i))) > (while (not (= (cdr (assoc 0 (entget e))) "SEQEND")) > (if (or (= (cdr (assoc 2 (entget e))) ta) (= ta "*")) > (progn > (setq eli (entget e)) > (if hi (setq eli (subst (cons 40 hi) (assoc 40 eli) eli))) > (if an (setq eli (subst (cons 50 an) (assoc 50 eli) eli))) > (entmod eli) > (entupd e) > ) > ) > (setq e (entnext e)) > ) > (setq i (1+ i)) > ) > )
Message 4 of 8
bob.at
in reply to: Anonymous

You can selcet the block by typing in the name of it. You wrote in message

> by select all block

so I thought it would be ok for you.

You should specify how to select:
- Click on one attribut of this block and then change this single attribut or
- Click on one block and change all attributs of this single block or
- the same as above but for all blocks/attributs with same name/tag in the current drawing
or something else
Message 5 of 8
Anonymous
in reply to: Anonymous

In th e modify II box of autocad 2002 there is a function block attribute manager. That will do perfectly what you want to do only 1 disadvantage. It changes all block with the name "block12". So it is not possible to select only 40 of the 70 "block12" blocks. "bob.at" schreef in bericht news:16707981.1080715033822.JavaMail.jive@jiveforum2... > You can selcet the block by typing in the name of it. You wrote in message > > > by select all block > > so I thought it would be ok for you. > > You should specify how to select: > - Click on one attribut of this block and then change this single attribut or > - Click on one block and change all attributs of this single block or > - the same as above but for all blocks/attributs in the current drawing > or something else
Message 6 of 8
Anonymous
in reply to: Anonymous

actualy all my drawing so many block attributes with different layer if i use that lisp the text size all change that why better user select the object at current layer -- ---------------------------------------- Design/Engineering Dept. bob.at wrote in message news:16707981.1080715033822.JavaMail.jive@jiveforum2... > You can selcet the block by typing in the name of it. You wrote in message > > > by select all block > > so I thought it would be ok for you. > > You should specify how to select: > - Click on one attribut of this block and then change this single attribut or > - Click on one block and change all attributs of this single block or > - the same as above but for all blocks/attributs in the current drawing > or something else
Message 7 of 8
bob.at
in reply to: Anonymous

Sorry but it is not yet clear to me, what you want to select. Try this code, here you click at one block and all attributs of each block wich is on the same layer ist changed (regardless of att tag and of the att layer):


(defun C:CHATTAHL ( / i ta as hi bl la an e eli)
(setq i 0.0) (setvar "CMDECHO" 0)
(setq ent (entget (car (entsel "\nSelect Block"))))
(setq la (cdr (assoc 8 ent)))
(setq bl "*")
(setq ta "*")
; end of selection
(setq hi nil)
(initget 6)
(setq hi (getreal "\nNew Attribute Hight (or return): "))
(setq an nil)
; (initget 1)
(setq an (getorient "\nNew Attribute Angle (or return): "))
(cond ((and (= bl "*") (= la "*"))
(setq as (ssget "X" (list (cons 0 "INSERT") (cons 66 1)))))
((and (= bl "*") (/= la "*"))
(setq as (ssget "X" (list (cons 0 "INSERT") (cons 8 la) (cons 66 1)))))
((and (/= bl "*") (= la "*"))
(setq as (ssget "X" (list (cons 0 "INSERT") (cons 2 bl) (cons 66 1)))))
(t
(setq as (ssget "X" (list (cons 0 "INSERT") (cons 2 bl) (cons 8 la) (cons 66 1)))))
)
(while (< i (sslength as))
(setq e (entnext (ssname as i)))
(while (not (= (cdr (assoc 0 (entget e))) "SEQEND"))
(if (or (= (cdr (assoc 2 (entget e))) ta) (= ta "*"))
(progn
(setq eli (entget e))
(if hi (setq eli (subst (cons 40 hi) (assoc 40 eli) eli)))
(if an (setq eli (subst (cons 50 an) (assoc 50 eli) eli)))
(entmod eli)
(entupd e)
)
)
(setq e (entnext e))
)
(setq i (1+ i))
)
)
Message 8 of 8
Anonymous
in reply to: Anonymous

thanks bob that i want..... -- ---------------------------------------- Design/Engineering Dept. bob.at wrote in message news:6221708.1080725399443.JavaMail.jive@jiveforum2.autodesk.com... > Sorry but it is not yet clear to me, what you want to select. Try this code, here you click at one block and all attributs of each block wich is on the same layer ist changed (regardless of att tag and of the att layer): > > > (defun C:CHATTAHL ( / i ta as hi bl la an e eli) > (setq i 0.0) (setvar "CMDECHO" 0) > (setq ent (entget (car (entsel "\nSelect Block")))) > (setq la (cdr (assoc 8 ent))) > (setq bl "*") > (setq ta "*") > ; end of selection > (setq hi nil) > (initget 6) > (setq hi (getreal "\nNew Attribute Hight (or return): ")) > (setq an nil) > ; (initget 1) > (setq an (getorient "\nNew Attribute Angle (or return): ")) > (cond ((and (= bl "*") (= la "*")) > (setq as (ssget "X" (list (cons 0 "INSERT") (cons 66 1))))) > ((and (= bl "*") (/= la "*")) > (setq as (ssget "X" (list (cons 0 "INSERT") (cons 8 la) (cons 66 1))))) > ((and (/= bl "*") (= la "*")) > (setq as (ssget "X" (list (cons 0 "INSERT") (cons 2 bl) (cons 66 1))))) > (t > (setq as (ssget "X" (list (cons 0 "INSERT") (cons 2 bl) (cons 8 la) (cons 66 1))))) > ) > (while (< i (sslength as)) > (setq e (entnext (ssname as i))) > (while (not (= (cdr (assoc 0 (entget e))) "SEQEND")) > (if (or (= (cdr (assoc 2 (entget e))) ta) (= ta "*")) > (progn > (setq eli (entget e)) > (if hi (setq eli (subst (cons 40 hi) (assoc 40 eli) eli))) > (if an (setq eli (subst (cons 50 an) (assoc 50 eli) eli))) > (entmod eli) > (entupd e) > ) > ) > (setq e (entnext e)) > ) > (setq i (1+ i)) > ) > )

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

Post to forums  

Autodesk Design & Make Report

”Boost