[Search tip detail and code files using keywords, tip number, author name, etc ]
 
Use Publish to Batch Run Commands
Tip# 4294 By Andrea Andreetti On 21-Apr-2014
5
Rated By 1 users
Categories : Misc. User Tools
Software type : AutoCAD 2014
Rename File To : No Files to download.
You can put together a little LISP code to do what you want, then let Pubish iterate your drawing list.

This helpful tip comes from Andrea Andreetti.

I've seen many AutoCAD users try to run LISP in batches. Some have created huge tools or used script, opening their drawings one by one, which wastes time. Some use ODBX, which I think is good but limited. Then there is my contribution: Why not use the Publish command? Yes, you can do just about whatever you want using the Publish command. Just write your desired commands in a LISP file, then put the LISP file in the Appload Startup Suite, and run Publish with any configuration you want. I use DWF to prevent wasting paper. Be sure to remove your LISP from the Startup Suite when you have finished. You can also purge, create objects, add blocks, etc., and because you are using Publish, you can get a print of the document at the same time. At the end of your LISP code be sure to save the drawing file with this code:

     (vl-cmdf "._qsave")

That’s it! Enjoy!

Notes from Cadalyst tip reviewer R.K. McSwain: What a great tip. If you can put together a little LISP code to do what you want, you can let Pubish iterate your drawing list. As Andrea points out, be sure to remove your LISP from the startup suite when you are done, because that LISP will load for each drawing you open no matter how it is opened.

 

Average Rating:
5


User comments
Comment by Clark,Phil
Posted on 2014-04-21 14:09:11
If I'm not mistaken startup LISP code does not run when background publishing is turned on, in which case just turn it off in Options.
Comment by Porter,Bill
Posted on 2014-04-21 14:36:45
While this does sound ingenious, I would recommend using Script Pro free from Autodesk. (http://images.autodesk.com/adsk/files/scriptpro.exe) It lets you run a script file (from which you can then call a lsp file, if desired) on a list of drawings that you select. It keeps track of which ran sucessfully, and allows you to rerun those that failed. It also gives you a log to see the command line output. And you don't have to remember to change your Startup Suite.
Comment by Lindner,Chris
Posted on 2014-04-21 14:58:28
Excellent tip! The possibilities are almost endless. I am doing this via the S::STARTUP using the ACADDOC.lsp. I have not tried it using the Startup Suite. From what I can tell, S::STARTUP is only loaded/executed when you publish "in the foreground" (i.e. AutoCAD opens each drawing). Does the Startup Suite get around this limitation (i.e. does it load/execute when publishing in the background)? Also, if you uncheck "Publish in background" and you are including the current drawing in your sheet list, that drawing doesn't get "re-opened". It seems to plot the current in the background anyway, in which case, the S::STARTUP is not triggered. Again, not sure if the Startup Suite is a fix for this or not.
Comment by Dalusung,Eustacio
Posted on 2014-05-17 19:20:19
Andrea Andreetti, How to attach the lsp file for the publish...please help and edit my steps to and send to me @ etd438@yahoo.ca 1. Publish command 2. Click + icon to add drawings for publish 3. Browse and select drawings > select layout only >check drawing prefix sheet title with file name > Select the drawings 4. Click Publish
Comment by Palacio,Tony
Posted on 2014-05-21 19:24:12
This is an extraordinary idea! Unfortunately I can't seem to wrap my head around the details. Once you load all your drawings into the Publish Dialog box, where do you specify a Lisp routine to run on all the drawings selected? Thanks for your time and the tip! Once I figure this out it will save me a ton of time! Tony