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

Change font of named Attribute through out drawing

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
mewescott
813 Views, 9 Replies

Change font of named Attribute through out drawing

Does anyone know how to change the font of a specific attribute in all my blocks in a drawing.  I am trying to change the INST attribute font to Arial but I have thousands of them through out my project.  My other attributes that I do not want to change are using the same Style as this block so I can not simply change the style.

9 REPLIES 9
Message 2 of 10
_Tharwat
in reply to: mewescott

AFAIK you can not change the font of the attributed block string , and changing fonts would affect on text styles in tables , anyway create a TEXT STYLE named ARIAL and try this piece of code .

 

(defun c:TesT (/ Unlock-layers lock-layers l lst ss n e i)
  ;; 		 Tharwat 17. Sep. 2012   			;
  ;;          Change a specific attributed ' Value style name	;
  ;;                             to ARIAL			;
  (while (setq l (tblnext "LAYER" (null l)))
    (if (eq (Logand 4 (cdr (assoc 70 l))) 4)
      (setq lst (cons (cdr (assoc 2 l)) lst))
      )
    )
  (defun Unlock-layers (layerlist / tbl)
    (foreach x layerlist
      (if (tblsearch "LAYER" x)
        (entmod (subst (cons 70 0) (assoc 70 (setq tbl (entget (tblobjname "LAYER" x)))) tbl))
        )
      )
    (command "_.regen")
    )
  (defun lock-layers (layerlist / tbl)
    (foreach x layerlist
      (if (tblsearch "LAYER" x)
        (entmod (subst (cons 70 4) (assoc 70 (setq tbl (entget (tblobjname "LAYER" x)))) tbl))
        )
      )
    (command "_.regen")
    )
  (if (and (tblsearch "STYLE" "ARIAL") (setq ss (ssget "_:L" '((0 . "INSERT") (66 . 1)))))
    (progn (if lst
             (Unlock-layers lst)
             )
           (repeat (setq i (sslength ss))
             (setq n (entnext (ssname ss (setq i (1- i)))))
             (while (not (eq (cdr (assoc 0 (setq e (entget n)))) "SEQEND"))
               (if (eq (cdr (assoc 1 e)) "INST")
                 (entmod (subst (cons 7 "ARIAL") (assoc 7 e) e))
                 )
               (setq n (entnext n))
               )
             (setq n nil)
             )
           (if lst
             (lock-layers lst)
             )
           )
    (princ)
    )
  (princ)
  )

Tharwat

Message 3 of 10
Moshe-A
in reply to: _Tharwat

Tharwat,

 

why BEDIT + ATTSYNC is not enough?

 

moshe

Message 4 of 10
mewescott
in reply to: _Tharwat

Tharwat,

 

Thank you, but it did not work.  It did ask to select objects but it did nothing to them.

Message 5 of 10
mewescott
in reply to: Moshe-A

Bedit with ATTSYNC would work if it was only a couple of blocks.  I may have anywhere from 20 to 50 blocks per drawing with the same INST attribute that I want to change.

Message 6 of 10
_Tharwat
in reply to: mewescott

Hi ,

 

It should work except if you do not have the attribute value INST within the selected blocks .

 

can you upload a sample drawing ?

Message 7 of 10
_Tharwat
in reply to: Moshe-A

You are right Moshe , but the OP have many different blocks as he/she mentioned that in post No. 5

 

Message 8 of 10
Moshe-A
in reply to: mewescott

i'm sorry i meant BATTMAN (instead of bedit+attsync)

 

if the problem is a text style? why don't you consider modifiy it to use the right font file

(even change it's name if needed)

 

moshe

 

 

 

 

 

 

Message 9 of 10
_Tharwat
in reply to: Moshe-A


@Moshe-A wrote:

if the problem is a text style? why don't you consider modifiy it to use the right font file

(even change it's name if needed)

 

moshe

 


You may need to re-read the first post again Moshe . Smiley Wink

 

The OP wants specific attribute entity with vallue and not the text style that holds them .

 

 

 

Message 10 of 10
mewescott
in reply to: _Tharwat

I do have multiple blocks with the same attribute name that I want to change the font on.  I have received a solution to my posting in the posting I put on the Autocad Electrical forum.  Pat Muren created a custom lisp file and script that worked like a charm.  To view the posting go to:  http://forums.autodesk.com/t5/AutoCAD-Electrical/Change-the-font-of-the-Installation-code-through-ou...

 

Thank you for assistance.

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

Post to forums  

Autodesk Design & Make Report

”Boost