CADnoobcoreconsole1

 

Ok, so here is an example where volunteering in the forums is paying dividends. I frequently visit the forums to try to help others and learn about the wonderful world of CAD. A question came through on a topic that i had never heard about (no surprise there). It was the nature of the content of the question which was amazing. They were asking about something called Core Console. 

WTF is Core Console..

So I did some quick Googling and there is some info out there but not as much as I would have hoped. The following two articles are the ones I found most useful. (cadtips, Through the interface) So what is the Core Console, its basically AutoCAD stripped naked of a UI (user interface). To most, this seems like a step backwards, but to those geeks out there who like playing in a command line as much as they like playing with their selves, this is an awesome portal into nerd-dom. From what I gathered this is only 'recently' available as of 2013. So if you are rocking it old school you may have to wait until you upgrade to play with this toy. 

If the potential of this still escapes you, let me put it another way. You can run scripts on drawings without ever opening AutoCAD. It allows for Batch Processing files without ever clicking on the AutoCAD icon. 

mind = blown

This knowledge couldnt have come at a better time. Im staring at a heaping pile of drawings that I need to purge the regapps out of. This is all i need to do to these drawing, so once this is done i cand move them on to thier next stage in thier little DWG life.  This is as clear cut an example as i could ever need to apply batch processing. 

I used the previsously mentioned links as a go by. Def check them out but what i did looked like the following. 

First: I created two blank txt files in the directory of the drawings I was working on. 

You can open the folder in file explorer and right click on an empty space and create two new text documents. You will need to change the file extensions of these text documents to something else. If you do not know how to do this and you are looking to use core console, this is likely going to be a bumpy ride. If you cant see your file extensions you can google to find out how or follow a walk-through like this

So If you can see the file extentiosn you need to change one of .txt to a .scr and the other .txt to a .bat. This should also change the Icon for these files. 

 CADnoobcoreconsole3

CADnoobcoreconsole4

Bat files are old school and if you are into automating things and dont know about bat files, you will want to look into them further. The .scr is a file extension for AutoCAD scripts. 

Now we need to put stuff into these files. My personal favorite program for this is notepad. Its simple clean and uncomplicated. You can try right clicking and see if the edit option is available for you. You can also try the 'open with' option if that is a possibility as well and then select notepad. Or you can oipen note pad first and use its open command... just get to a place that you can edit the files. 

CADnoobcoreconsole5

Once inside the bat file, you will put the information which will handle the batch. The Core console its self is not a batch processor. The .bat file will be the item handling the batch aspect of the whole deal. So going by the examples in the batch file i put the following text:

 

FOR %%F IN ("C:\MYDRAWINGPATH\*.dwg") DO "C:\AUTOCADCORECONSOLEPATH\accoreconsole.EXE" /i "%%F" /s "C:\AUTOCADSCRIPTPATH\SCRIPT.scr"

 

 

Ok so a few things. You are going to need to know where your drawings are and they need to all be in the same folder. Next locate the AutoCAD core console exe file. I did this by opening windows explorer and just doing a search. You can copy the path from the explorer path bar or from property etc. 

 

CADnoobcoreconsole2

 

And lastly you need to know the path location of the .scr file. If you need a little more break down of these parts and pieces and what going on, go to the cad tips link above. Skip down to the lower part of the article and there is an excellent image giving the description of what each section of the bat string is up to. 

Ok. So assuming all is well in the bat file arena (likely it wont be as mine sure wasnt the first time through) the next part of the puzzle is the scr file. 

So the scr file is super easy (famous last words). I'm not really experienced with scr files but they look like you basically put in the commands as though you were typing them in AutoCAD. One key take away is that you have to leave a blank line to indicate the enter command. So the following example adds a line and then a circle. Notice the blank to indicate "enter"

CADnoobcoreconsole6

Ok so a batch of line-circle commands aren't that useful (... or is it..) but its a good way to practice implementing some of these commands via core console. I created a practice bat file just to play. That bat file looked more like the suggestions that are provided when you start up core console. You just type in the path to core console and then the  "/i" and then file the file including path and then the "/s" and then the script and location. I would recommend doing something similar to get to know the tools if you are a noob like me. It was during this playing that i stumbled on a crucial step in the process. 

Your script will not run if it is not in a trusted location or if it is not a trusted file. The way you will get past this will vary on which release of AutoCAD you are using. I imagine its fairly similar between releases as you will likely go into OPTIONS and the SYSTEM and then SECURITY, but past that i don't know what has changed for each version of software. I was getting the warning of message that said: "File load canceled" and that was because i had the security settings set to display a warning message and this couldn't happen so the script would load. 

Ok so on to the real work. My true goal is to purge the regapps out of several drawings so my final work horse scrip was:

 

-purge

r

 

n

qsave

 

; end script file

This interface doesn't show it that well but its the command "-purge" then the next line is "r" for regapps and the next line is blank for enter (thats accepting the default option of all apps in the command) then the next line is "n" for no. After that the next line is "qsave" and then the next linke is blank for enter again. The semicolon denotes a comment and is not processed. 

Once thats done, just run your .bat file and it will run this script on every dwg in the directory. Now thats bad ass! All files processed in a fraction of the time with almost no effort on my part. This is a time saving way to automate AutoCAD and unleash the program with out even opening it. no go forth and core console.