dijxtra
dijxtra

Reputation: 2751

Running AutoCAD from command line only

I would like to run an AutoCAD script, print the resulting drawing to PDF and exit AutoCAD, all without a single click (so we can schedule it on a server). Is that possible with AutoCAD?

Upvotes: 4

Views: 7364

Answers (3)

Nik
Nik

Reputation: 1870

If you're simply scripting Autocad tasks, you should use AutoDesk's accoreconsole.exe. You can find this console app in the same folder as your acad.exe. It has (almost) all the same libraries as Autocad, but it is super light weight because there is no UI -> therefore VERY FAST. I use accoreconsole for all of my company's drawing processing needs, and it is fantastic!

This will get you started: http://adndevblog.typepad.com/autocad/2012/04/getting-started-with-accoreconsole.html

Let me know if you have any more specific questions once you've had time to look at it.

Upvotes: 2

crashmstr
crashmstr

Reputation: 28563

Yes, use the /b command line parameter

Command Line Switch Reference

/b Script name
Designates a script to run after you start the program (b stands for batch process). If the script file is in the Start In folder, a full path to the script file is required unless this security measure is suppressed either by including the /six command line switch, or setting the LEGACYCODESEARCH system variable to 1. Scripts can be used to set up drawing parameters in a new drawing file. An SCR file type is assumed.

If you want AutoCAD to exit after completing the script, you will need to include that as part of the script as well.

Upvotes: 4

CAD Developer
CAD Developer

Reputation: 1697

I do it in ZWCAD (AutoCAD alternative) but I suppose in AutoCAD should be the same. You can create .bat file where run AutoCAD with parameter - path to script file. In script file (*.scr) You can plot to PDF or run LISP which do what You want. PrintDWG.bat:

"C:\Program Files\ZWSOFT\ZWCAD 2018\ZWCAD.exe" /b F:\PrintDWG.scr

PrintDWG.scr:

_filedia 0
_open "c:\Path\Drawing.dwg"
(load "F:\\____Zgłoszenia\\0001965\\PrintDWG.lsp")
_filedia 1

PrintDWG.lsp

(command "_-plot" "_Y" "Layout1" "PDFCreator" "A4" "_M" "I" "N" "" "" "" "N" "." "T" "" "" "N" "")

Upvotes: 1

Related Questions