I have been attempting to update our office’s layer system. This would be difficult to do in AutoCAD without resorting to LISP or some programming to insert layers on mass. Creating lots of text on mass is really easy to do in Excel so that would be the program of choice to do this task.
The problem then comes of getting these layers into AutoCAD? There are numerous Lisp programs around on the internet to do this but what if you have AutoCAD LT only (as it lacks programming APIs)?
You can use Excels powerful cell commands to convert your layer list to a format that will then be able to create a script file. Below I will go through the steps you need to do to get this to work. (Note this is not my concept but I cannot find the original page where this was proposed).
Firstly create a blank Excel document.
Then place “-LAYER” in the 4th column over.
Now we are ready to input some data into the first three columns. This is in the order, layer name, colour, linetype. Make sure the second column for colour is text only to avoid any true colours being converted into numbers.
One completed we will now enter the following command below the cell with -layer in.
=IF(ISNUMBER(SEARCH(“,”,B2)),”N “& CHAR(34)&TRIM(A2)& CHAR(34)&” C T “&TRIM(B2)&” “& CHAR(34)&TRIM(A2)& CHAR(34)&” LT “&TRIM(C2)&” “& CHAR(34)&TRIM(A2)& CHAR(34),”N “& CHAR(34)&TRIM(A2)& CHAR(34)&” C “&TRIM(B2)&” “& CHAR(34)&TRIM(A2)& CHAR(34)&” LT “&TRIM(C2)&” “& CHAR(34)&TRIM(A2)& CHAR(34))
This creates the magic that is script. (Note the quotes are required for layer names with spaces).
Add layer information down the left and drag the little square in the bottom right of the excel cell to copy this to all cells below.
Once completed, save this file for future reference.
Copy the entire column of D and paste to a new file using paste values only.
Now the file is ready to become a script. Save as Formatted Text (space delimited) PRN file.
You should now have a text file that has the entire script for making your layers you need in it. Two steps to go!
Firstly we are going to rename the extension on the file (if you cannot see extensions follow this). This needs to be renamed from myscript.prn to myscript.scr.
Then open the file and add a return at the very end to create another line. This will terminate the last command and thus end the script.
Finally we load the script into AutoCAD using the command “script“.
Voila, all the layers are now in AutoCAD.