AutoCAD Architecture Forum
Welcome to Autodesk’s AutoCAD Architecture Forums. Share your knowledge, ask questions, and explore popular AutoCAD Architecture topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Global Font Change

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
Mike.Lamka
1347 Views, 7 Replies

Global Font Change

Hello, I am trying to globally change a font style (from Romans to Arial) across multiple drawings on ACA 2013.  I have been trying to this using the hurricane program to create a script to run it, but the lisp routine i need to use chtext.lsp will not work.  is there anything else out there that i can use that anyone knows of?  any help would be grealy appreciated.

 

This is the script i've been trying to get to work:

;BEGIN SCRIPT

CHT

;Select objects: all

ALL

;Select objects:

;Carriage return to tell it you are done

 

;Height/Justification/Location/Rotation/Style/Text/Undo/Width: s

S

;Individual/List/Select style/<Arial>:

;Just a carriage return for ALL

 

;New style name for all text entities:

 Arial

;Height/Justification/Location/Rotation/Style/Text/Undo/Width:

;just a carriage return to exit the command

 

;Command: regen

REGEN

;END SCRIPT  

 

Thank you,

 

Mike Lamka

 
 
7 REPLIES 7
Message 2 of 8
David_W_Koch
in reply to: Mike.Lamka

A few thoughts:

 

1.  Are you seeing any error messages as the script runs?  If you can, that may help to trouble shoot what is not working.

 

2.  Can you manually run the script on one open file, using the SCRIPT command?  Does that work as expected?

 

3.  Is chtext.lsp always loaded when you open/start a new file?  If not, you may need to have your script file load it first.

 

4.  Does the Arial text style exist in all the drawings to which you are applying the script?  This will not create the style, just apply it.


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Message 3 of 8
Mike.Lamka
in reply to: David_W_Koch

I talked to a friend of mine who sent me a lisp routine he has used in the past.  He sent me three actually, one for dtext, one for mtext and one for blocks.  2 of them work, but the one for the blocks doesn't.  I'm getting closer.  This is the non-working one for blocks.

 

(defun C:CHSTYAD (/ entities len count ent ent_data ent_name new_style_name)

 

(command "Style" "Arial" "ARIAL.TTF" "" "1" "" "" "")

(setq entities (ssget "X" '((0 . "ATTDEF")))      

len      (sslength entities)      

count 0

);setq  

 

(while (< count len)       

(setq ent      (ssname entities count)             

ent_data (entget ent)             

ent_name (cdr (assoc 7 ent_data))       

);setq  

 

(setq new_style_name (cons 7 "Arial"))

(setq ent_data (subst new_style_name (assoc 7 ent_data) ent_data))

(entmod ent_data)  

 

(setq count (+ count 1))

);while  

 

(princ)  

);defun

 

When ever I run this i get this error "bad argument type: lselsetp nil".  I would rather know what is wrong with the routine to get it fixed rather than just looking for the quick fix and not knowing what is wrong.

Thank you for your help,

Mike Lamka

Message 4 of 8
David_W_Koch
in reply to: Mike.Lamka

The LISP routine works, but may not do what you want it to do.  This was designed to be run in a file that defines the block, and has all of the block's entities in model space, including attribute definitions.  (If you were to WBLOCK a block definition from your file, and open the resultant file, the routine would run, provided that the block has attribute definitions within it.)

 

If you run it in a file without attribute definitions, the command crashes because it tries to create a selection set of all of the attribute definitions in the file [the SETQ statement that assigns (ssget "X" '((0 . "ATTDEF"))) to the variable entities].  It then immediately tries to determine the number of entities in the selection set, without first testing to see if a proper selection set was created.  If there are no attribute definitions in the file, entities will be nil, and (sslength entities) will create the error condition you are observing.

 

The attached file remedies that error by trying to create the selection set, and then uses the COND function to test entities to see if it is nil.  If so, a message is printed to the command line and the program ends.  If not, it processed the attribute definitions found.


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Message 5 of 8
Mike.Lamka
in reply to: David_W_Koch

It works when I open the actual block drawing and run it.  Guess I wasn't coming through clear before.  I want to be able to open a drawing with standard blocks and blocks with attributes in it and be ab;e to change the fonts in all of those.  The reason is that we have clients that want to use their CAD standard instead of our office standard. 

 

I did ,however, run the lisp routine you changed and it worked great.  Thank you for that.

 

Mike Lamka

Message 6 of 8
David_W_Koch
in reply to: Mike.Lamka

I suspected that was what you wanted. Unfortunately, that is not what the routine you posted does. To do what you want, a routine would need to step through the block definition table, looking for blocks that have attributes attached. For those blocks, it would the need to redefine the attributes to use the new text style and the run ATTSYNC to update all instances of the block with the revised attribute definitions.

David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Message 7 of 8
Mike.Lamka
in reply to: David_W_Koch

I was afraid that it wouldn't be that simple.  Thank you for all your help.

Message 8 of 8
David_W_Koch
in reply to: Mike.Lamka

Perhaps not that simple, but not all that complex.  I have not done extensive testing, but I believe the attached routine will do what you want, for block attributes.

 

If I were writing this for myself, I might have set this code up as a non-command routine that had an argument into which to pass the desired text style name, deleting the code that creates the Arial text style at the beginning and then replacing the "Arial" in (cons 7 "Arial") with the name of the argument.  That would make it more flexible.  A calling command routine could then be written to create the text style, if necessary, and then call the routine, so that you could have separate commands for different text styles.


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

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

Post to forums  

Autodesk Design & Make Report

”Boost