Jump to content

Recommended Posts

Posted

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”

core-console-2.jpg

 

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

core-console-4.jpg

 

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)

core-console-6.jpg

 

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”

  1. Browse – navigate to C:\Program Files\Autodesk\AutoCAD 2013\accoreconsole.exe Select the .exe file.
  2. Click OK

core-console-7.jpg

 

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

core-console-8.jpg

 

To select a script file that will be run on each of the files:

 

Click “Browse” in the “Script file” section

  1. Browse to the location of the script file
  2. Select the script
  3. Click “Open”

core-console-9.jpg

 

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)

core-console-10.jpg

 

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:

core-console-11.jpg

 

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.

core-console-12.jpg

  • Like 1
  • 2 weeks later...
Posted

Thanks for the info! That's alot of information to digest. I have too many drawings to "move" into this ScriptPro Program. I will have to use the Batch File Method. Can you tell me how to modify the batch file so it searches for ALL drawings in ALL folders and subfolders of my "F:\" Drive? I have a script file that will update a block in each drawing, I am having a hard time getting the batch file to process. Your assistance would be appreciated. Thanks, John.

Posted

John,

You can drag 'n drop the files directly from windows explorer or windows search into ScriptPro. ScriptPRO then applies the scripts to each file in turn to either AutoCAD or the AutoCAD console.

ScriptPRO does away with the batch file.

Posted

I have over 600 gb of drawing files that are located on my server. I wouldn't be able to drag them somewhere else. That's why I was opting to leave the files where they are and run the batch file. Or am I missing something with the Script Pro method? Dragging and dropping sounds to me like your physically "moving" or copying files from location to another. Is that not the case?

Posted

The files stay in place, it just copies the file path location. I wouldn't try adding so many files in one go though. Any memory leaks in AutoCAD would choke the PC running so many files one after another. If you have a few PC's you could use, try sharing the load over night, after a test run. ScriptPRO will time out if you have a dodgy file & then move onto the next - so you don't have to monitor it running - it has a log file to highlight any problems. Best of luck!

Posted

i was able to test a simple subfolder with ScriptPro 2.0

I made sure that the option was selected to select subfiles...

 

In the mean time - i will work on figuring out the .bat solution

thanks

~Greg

ScriptPro 2.0 subfolders.jpg

Posted

Can I run the script pro from the server and execute the accoreconsole.exe from a workstation that has autocad on it? My server doesn't have a copy of Autocad on it.

Posted

Thanks Greg. Any help with the bat file would be greatly appreciated! John

Posted
Can I run the script pro from the server and execute the accoreconsole.exe from a workstation that has autocad on it? My server doesn't have a copy of Autocad on it.

I just tested it on my work's server and it worked just fine. I think that it treats server locations just like an extension of you computer like a gigantic flash-drive. It worked when i tested it with both the main folder and it automatically selected the sub folder as shown above as well.

Sorry, i cant show any screen shots because of client stuff on the server location

~greg

Posted

Thanks Greg. I will test it out this evening and see how it works.

Posted

I ran the routine and it worked on 99% of the files I tested it on. The log file showed ALL files successfully updated but 1 out of 18 did not update (no date change to the file). Not sure why this happened. The file that didn't update wasn't the last one in the selection set. I will try again tomorrow. Thanks for taking the time to provide all this information. It will be very helpful! John

Posted
I ran the routine and it worked on 99% of the files I tested it on. The log file showed ALL files successfully updated but 1 out of 18 did not update (no date change to the file). Not sure why this happened. The file that didn't update wasn't the last one in the selection set. I will try again tomorrow. Thanks for taking the time to provide all this information. It will be very helpful! John

You are very welcome John. I am stoked that you are able to use something that I posted. I tried many versions of batch files (.bat) to get it to run in sub folders but cannot get it to work. I have only been writing batch files for about 2 weeks so I want to make sure that I get it right before posting. I will keep at it and be sure ti post back here when I find a solution. I am hapy that the ScriptPro route worked successfuly on the amount of folders and sub folders that it did process.

One error out of many isnt that bad...

-Greg

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...