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?
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With