MitS Posted July 17, 2020 Posted July 17, 2020 I want to run a particular script in AutoCAD on all the files that exist within the directory. For doing that, I have created an executable file and placed in the directory where all the drawings exist and has the following contents as described in the image. This script runs perfectly fine, however, the routine opens AutoCAD for one drawing in the directory and closes after running the script, then opens the application again, runs the script, and close and this goes on for every dwg's (200+ in this case). Does anyone know how to change this routine to open the AutoCAD application just once, for the first drawing and then close the drawing and open another one in the same application? I'm still green in the LISP and any kinda input will be really helpful. TIA! Cheers, M Quote
Steven P Posted July 17, 2020 Posted July 17, 2020 You might want to look at script processing this - I think Lee Mac has one that could save you a lot of time (http://www.lee-mac.com/scriptwriter.html I think), always worth checking there first 1 Quote
BIGAL Posted July 17, 2020 Posted July 17, 2020 (edited) Rather than scripting use aeccoreconsole instead of ACAD.exe it is designed to run with out user interaction and does not open dwg, there is examples using the same batch file method as you have. https://through-the-interface.typepad.com/through_the_interface/2012/02/the-autocad-2013-core-console.html https://houseofbim.com/2016/10/05/son-of-a-batch-autocad-core-console-through-lisp/ bat file echo off :: Path to AutoCAD core console set accoreexe="C:\Program Files\Autodesk\AutoCAD 2014\accoreconsole.exe" :: Path to the script to run set script="C:\Users\[USERNAME]\Desktop\IPAD\TESTER\tester2.scr" %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST1.dwg /s %script% %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST2.dwg /s %script% %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST3.dwg /s %script% %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST4.dwg /s %script% %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST5.dwg /s %script% pause Edited July 18, 2020 by BIGAL 1 Quote
MitS Posted July 20, 2020 Author Posted July 20, 2020 On 18/07/2020 at 09:54, BIGAL said: Rather than scripting use aeccoreconsole instead of ACAD.exe it is designed to run with out user interaction and does not open dwg, there is examples using the same batch file method as you have. https://through-the-interface.typepad.com/through_the_interface/2012/02/the-autocad-2013-core-console.html https://houseofbim.com/2016/10/05/son-of-a-batch-autocad-core-console-through-lisp/ bat file echo off :: Path to AutoCAD core console set accoreexe="C:\Program Files\Autodesk\AutoCAD 2014\accoreconsole.exe" :: Path to the script to run set script="C:\Users\[USERNAME]\Desktop\IPAD\TESTER\tester2.scr" %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST1.dwg /s %script% %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST2.dwg /s %script% %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST3.dwg /s %script% %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST4.dwg /s %script% %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST5.dwg /s %script% pause This was very helpful BIGAL. The website has a routine to run the script for every file in the directory so all I had to do Is add a stop for the loop and adjust few parameters and it worked. Thanks mate, appreciate it! Quote
MitS Posted July 20, 2020 Author Posted July 20, 2020 On 17/07/2020 at 23:42, Steven P said: You might want to look at script processing this - I think Lee Mac has one that could save you a lot of time (http://www.lee-mac.com/scriptwriter.html I think), always worth checking there first Hi Steven, this was a nice way of performing simple commands over a batch of drawings. However, the only limitation is for adding conditions and handling errors for the script. Thanks for sharing though! Quote
Lee Mac Posted July 20, 2020 Posted July 20, 2020 14 hours ago, MitS said: Hi Steven, this was a nice way of performing simple commands over a batch of drawings. However, the only limitation is for adding conditions and handling errors for the script. Thanks for sharing though! I would suggest using an AutoLISP application to perform the required operations, and using the Script purely to open each drawing, evaluate the AutoLISP program, and then save & close the drawing - I describe this technique here. 1 Quote
Recommended Posts
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.