Showing posts with label Scripts. Show all posts
Showing posts with label Scripts. Show all posts

AutoCAD: SaveAs 2004 Script

A script to save your drawings on a previous AutoCAD version.
Català - Castellano - Deutsch
As I promised on a previous post about Running Scripts on Multiple AutoCAD files, here comes the script to save your files as 2004 version. I found the need of this script recently, when a collaborator of mine was working with AutoCAD 2004 (i didn't know that in advance) and I was working with 2010. After finishing the tweaks on some of the files, he asked me "can you convert them to 2004, otherwise I can't read them". Well there were nearly 40 drawings, so I had no intention to save them one by one to 2004 format. I set myself to generate a script to do that for me.
This is the script file SaveAs2004.scr and let me easily explain how it works. Let's analyse it line by line.
FILEDIA 0 - This line turns off the dialog boxes (see this post for more info)
SAVEAS 2004 Y - this part is the proper saving as 2004 version. we call the saveas command, stipulate 2004 (or any other version we want) and then click yes, because the program will ask us if we want to overwrite the existing file. note here that there are 2 spaces between 2004 and Y, this is due to the fact that the first is to enter 2004, and the second is needed, to confirm the file name. (If you want to understand this better, run the different commands manually with the FILEDIA system variable set to 0, and you will be able to see all the steps I am following).
FILEDIA 1 - here I simply wanna make sure that after running the script the settings return to what they were, so i set the FILEDIA SV back to 1.
CLOSE - Closes the file, be sure that there is a space or an enter after close, since it is easy to forget that being the last text in the script file. This is generally not neecessary if you use a batch scripting program such as Autoscript or ScriptPrp, but in case you run the script directly in one file, this will close the file after running it.
That's it, now you have a script to save as 2004 version. Replace 2004 by, R14, 2004, 2007, 2010, Standards, DXF or Template, and you will save in that format.


Show me more...

AutoCAD: Run scripts on multiple files

You can run scripts on multiple files using ScriptPro
Català - Castellano - Deutsch
Imagine that you want to purge 100 files to be sure that not unnecessary information is saved, wasting space. Or imagine that you want to save all the drawings of a project to a previous version of AutoCAD so a consultant of yours can read your files. You don't want do it yourself or appoint someone to do it manually.
What you want is a software to Batch process scripts on multiple files, Autodesk actually provides the application for free.
This application is called ScripPro. You can directly download it here, or go to the information page.


For versions of AutoCAD previous to 2007, you'll need this version instead.
For thsoe who don't know what scripts are in AutoCAD, just imagine them as entering a set of commands without typing them manually. You can save them in a text file, and when you run the scrip file (by entering the SCRIPT command) all the set of commands will run one after the other.
I will post an example script soon, so those who are new to scripts can get a better idea of what they do. I already posted another example before explaining how to create a script to generate all your standard layers.

Update: The installer of ScriptPro is for 32Bit windows only...my 64bit windows doesn't like it, i get "not compatible with operationg system,,,crap!"
Update 2: I found this freeware software called Autoscript that runs on Windows 7 64bit. It adds a new menu called autoscript, that actually doesn't work!!! but if you type AUTOSCRIPT as a command it will run a program that works the same way as ScriptPro. Via Cadig.



Show me more...

AutoCAD: Layer Creation Script

Learn how to edit a script to re-create all you standard layers
Català - Castellano - Deutsch
Having your standard layers is basic for easy printing and having everyone in the same office know which layers to use for each object. The creation of standard layers and plot tables can be long but it is important if you are trying to set your own standards for several projects.
Some layers are deleted when using commands like PURGE. To get them back there are several methods. One of them is to have a Script that creates all the layers again. This sample script will generate only 3 layers, but it is useful to see how this type of script works. To test the script, save it to your hard drive and type SCR in AutoCAD. Then Browse to the folder where you have saved it and select it. The syntax of the script is as follows:


What you see after ;;; signs is pure description. The script consists of 3 lines. It calls the -LAYER command (See that it uses the hyphen version of the LAYER command, so it does not call the Layer manager window). After each -LAYER there is MAKE to create a new Layer. Then each of the properties of that layer are set.
Following the syntax of this Script with the properties of your standard layers you can generate a script that will allow you to quickly recover all the layers that have been deleted. Here is the link to the Script again.

Show me more...