Showing posts with label Script. Show all posts
Showing posts with label Script. Show all posts

Thursday, 19 April 2012

Change Text Style Script - AutoCAD

He is how to create a script to change the text style in AutoCAD.
  1. Open Notepad
  2. So the Text styles dialog box does open you will need to type -STYLE into the command line.
  3. Now following the command line:  
Enter name of text style or [?] <Annotative>: (ENTER THE TEXT STYLE NAME HERE) Standard
Specify full font name or font filename (TTF or SHX) <romans.shx>: (ENTER THE FONT NAME HERE) Arial
Specify height of text or [Annotative] <0.0000>: (ENTER THE TEXT HEIGHT HERE) 2.5
Specify width factor <0.5000>: (ENTER THE TEXT WIDTH FACTOR HERE) 1

Specify obliquing angle <0>: (ENTER THE TEXT STYLE NAME HERE) 0
Display text backwards? [Yes/No] <No>: (ENTER YES OR NO TO DISPLAY TEXT BACKWARDS HERE) n
Display text upside-down? [Yes/No] <No>: (ENTER  YES OR NO TO DISPLAY TEXT UPSIDE-DOWN HERE) n
Press F2 in AutoCAD so the Text Window opens, select and copy of the text into Notepad. So it should read as follows:


-STYLE
Standard
Arial
0
1
0
n
n

Note: If you add a few enters after the last n you will see it will start the command again, so just watch your enters.
Now hit save as and name your script i.e Style_Text.scr.  Note to run it as a script you must put .scr at the end.


To run the script in AutoCAD now type SCR into the command line, go the location where you saved the script select it and click Open. It should now change your Text Style to "Standard" as current.

Tuesday, 7 February 2012

Creating a Script to Print

Ok so if you want to print off a drawing very quickly why not create a script which will do all the steps for you.

To start off open notepad. Note you need to remember that every space you leave AutoCAD will read so if you have finished a line hit enter to start the next.

First all you need to make sure you are in paper space or on a layout tab, so the first line you need to type TILEMODE 0.

So the script will look somethine like this.

TILEMODE 0
-plot
y

drawing sheet
a1 dwf
dwf6 ePlot

ISO full bleed A1 (594.00 x 841.00 MM)
millimeters
landscape
n
extents
1:1
center
y
giff full size mono.ctb
y
n
n
n

n
y

Please note where I put (giff full size mono.ctb)you need to put the ctb your are going to use.

Now you have put all this into notepad hit save. I have called mine dwf A1.scr, you need to have .scr at the end otherwise it wont work.

Open up AutoCAD if its not already open and type CUI enter. The CUI dialog box will open.
At the bottom left hand side under commands section there will be an icon that will create a new command, hit that and it should start to create a new command.

Give you command a name (i.e. A1 DWF), and a description so if other users will use it they know what it does. 
Ok so for the important bit under Macro, this where AutoCAD will run the command from.
You must always start a command with ^C^C this will escape from any other command before it starts this one.
We then type _script: so I will look for a script, then "the scripts location and name". Its important you have "" at the start and end.

So it should look something like this:

^C^C_script;"//mafp01/mabst1/Design Centre/Support Files/Script/dwf A1.scr"

Now thats done create a image for your icon, then simply add it to a current toolbar/ribbon or create a new one. Unless you have company toolbars/ribbons already i would create one for all your tools.

I hope this was useful, please feel free to leave your feedback.

Thanks.