Original Post found [here]
I wanted to share my post here at CADTutor about using the new Core Console that has been introduced with AutoCAD 2013 products. If you need to run scripts on many drawings, the new Core Console can help speed up the process. This Core Console is a stripped down version of of AutoCAD that includes no buttons or user interface other than what looks like a cryptic command line.
If you have an AutoCAD 2013 product installed, you can open it and see for yourself what it looks like. It is located at C: drive > Program Files > Autodesk > AutoCAD 2013 > “accoreconsole.exe”
After launching the Core Console it looks similar to the windows command line…
Notice the size of the Core Console. It weighs in at only 27kb on my computer. compare that to the acad.exe which loads when you open the normal AutoCAD interface and you can see why this Core Console can be your new best friend when it comes to batch processing files.
http://autocadtips.files.wordpress.com/2013/01/core-console-3.jpg
So if you need to run batch routines on files, the Core Console is meant to be quick and capable way of running AutoCAD script files (.scr), LISP routines, .NET (dot net) dlls and other programming routines. (I am only familiar with script files and LISP so that is where I will focus my attention).
After getting down the basics that are contained in this tutorial, feel free to modify the batch routine to fit your needs with other script files.
As I mentioned above, the Core Console is limited in what it can do. And luckily Kean Walmsley has already done the hard part and found out what commands the Core Console will recognize found [here] and Kean has also put together a nifty .txt file that contains the available commands as well found [here]. Thanks for putting that together Kean!!
If you have launched the Core Console as shown above go ahead and close it. You can see that it is a bit cryptic in that it isn’t obvious as to how to even use it even though they give an example of the syntax… It took me a while to get it to run for me and like the name of the post, I want to get you up and running with it as well.
For this post we will learn how to run the Core Console 2 ways.
1) by running ScriptPro 2.0 and
2) by running it by itself through a windows .bat (batch) file.
Both ways we will use the same AutoCAD script file that prints the layout tab named “Layout1″ to a PDF file.
If you would like to follow along with this example – Create a folder on your C: drive and name it “Test”. Place some drawings that contain a layout tab called “Layout1″ and also place a copy of the below AutoCAd script file called “Plot2PDF.scr” in the C:\Test folder.
Example Script file: Please save as “Plot2PDF.scr”
(setq CurrDwgName (getvar "dwgname"))
(setq Fname (substr CurrDwgName 1 (- (strlen CurrDwgName) 4)))
(setq name (strcat (getvar "DWGPREFIX") Fname ".pdf"))
;Command:
FILEDIA
;Enter new value for FILEDIA <1>:
0
;Command:
-PLOT
;Detailed plot configuration? [Yes/No] <No>:
Yes
;Enter a layout name or [?] <Model>:
Layout1
;Enter an output device name or [?] <None>:
DWG To PDF.pc3
;Enter paper size or [?] <ANSI A (11.00 x 8.50 Inches)>:
ANSI D (22.00 x 34.00 Inches)
;Enter paper units [inches/Millimeters] <Inches>:
Inches
;Enter drawing orientation [Portrait/Landscape] <Portrait>:
Landscape
;Plot upside down? [Yes/No] <No>:
No
;Enter plot area [Display/Extents/Layout/View/Window] <Display>:
Extents
;Enter plot scale (Plotted Inches=Drawing Units) or [Fit] <Fit>:
1:1
;Enter plot offset (x,y) or [Center] <0.00,0.00>:
0.00,0.00
;Plot with plot styles? [Yes/No] <Yes>:
Yes
;Enter plot style table name or [?] (enter . for none) <>:
monochrome.ctb
;Plot with lineweights? [Yes/No] <Yes>:
Yes
;Plot Scale lineweights with plot scale? <No>
;Plot paper space first? <No>
;Hide paper space objects? <No>
;Enter file name <C:\Work\solids-Model.pdf>:
!name
;Save changes to page setup? Or set shade plot quality? [Yes/No/Quality] <N>:
No
;Proceed with plot [Yes/No] <Y>:
Yes
;Command:
FILEDIA
;;;Enter new value for FILEDIA <1>:
1
Example Using ScriptPro 2.0
ScriptPro 2.0 is free and can be downloaded from the following [THIS] link. The old version of ScriptPro does not let you set the Core Console to run the batch. The old version automatically uses the full-blown acad.exe file.
Once you have it installed go ahead and launch ScriptPro 2.0
There should be a desktop icon that was installed or you can navigate to it by:
Start > All Programs > Autodesk > ScriptPro.exe (shown below)
The only trick to using ScriptPro and the Core console is setting ScriptPro to use the correct .exe file.
Once ScriptPro is open,
Click “Settings”
Browse – navigate to C:\Program Files\Autodesk\AutoCAD 2013\accoreconsole.exe Select the .exe file.
Click OK
Now that the Core Console is set, you can build a list of files and select a script as normal.
To select files:
Click “Add From Folder” button and then browse to a folder from the list and then click OK.
One great thing about ScriptPro is that you can build a list
To select a script file that will be run on each of the files:
Click “Browse” in the “Script file” section
Browse to the location of the script file
Select the script
Click “Open”
Now that the files are listed and the script file is set the batch process can use the Core Console to process the files.
To process the files that have a check mark next to them press the button “Checked” (shown below)
To use a batch file (.bat) use the following and adjust accordingly for your needs.
If you copy the following line into a Notepad file and save it with the extension .bat it will become a batch file.
But before you run it, it would be nice to know what it is doing so below is a simple explanation of what the .bat file does:
Here is the content of the batch file:
FOR %%f IN (“c:\Test\*.dwg”) DO “C:\Program Files\Autodesk\AutoCAD 2013\accoreconsole.exe” /i “%%f” /s “c:\Test\Plot2PDF.scr” /l en-US
Make sure to copy it as it is shown in the picture -meaning in one line. I was not able to get it to run when the content was on multiple lines. It only worked for me when it was all in one line. (but then again, I am a novice at these batch routines….)
The result of this is the following: it created PDFs of Layout1 of each of the drawings and placed the PDFs in the same folder as the drawings.