MiGo Posted April 14, 2009 Posted April 14, 2009 Is it possible to make an AutoLISP that gets a selectionset of drawings from the user and simply runs a script on each drawing selected? Quote
Lee Mac Posted April 14, 2009 Posted April 14, 2009 I've never done it, but I should think that you could get a list of the drawings and then get a LISP routine to write the script file and save it somewhere, then the user can run it, but I don't think you can run a script on more than one drawing from a LISP as the LISP would terminate as soon as the new drawing is opened. Quote
MiGo Posted April 14, 2009 Author Posted April 14, 2009 A guy at where I work has come up with some lisp routines that run functions that the user designates on a batch of drawings that the user selects, but you have to put cad in a Single Drawing Interface (sdi). Quote
fuccaro Posted April 14, 2009 Posted April 14, 2009 See here: http://www.cadtutor.net/forum/showthread.php?t=19294 Quote
Lee Mac Posted April 14, 2009 Posted April 14, 2009 I would still be inclined to use something like a combination of maybe, "getfiled" and/or "vl-directory-files" or something to that nature to collect your list of files and directory paths. Then, I would use "vl-filename-mktemp" to create the script file and use "write-line" to write a script file that you can run at your own expense. Or maybe you could use the "script" command (but make sure that it is the LAST thing you run in your LISP... Just my opinion, Lee Quote
alanjt Posted April 15, 2009 Posted April 15, 2009 scriptpro (autodesk) will do exactly that. write a little script that will execute the lisp routines. this won't work anymore (scriptpro doesn't work with plotting after version 2004, i think), but this was something i put together to batch plot our EMP plans. this way, we could set a computer to plot the sheets, then have an admin collate anything that was out of order. granted, sheet set manager does this now but you can still use it for batch editing drawings. (foreach layl (layoutlist) (if (wcmatch (strcase layl) "*EMP*") (progn (setvar "ctab" layl) (command "-plot" "n" (getvar "ctab") "" "" "n" "n" "y") );progn );if );foreach even though this is all lisp coding, you can still just load it as a .scr file. or just call out the lisp routines from your script. this was one of many we used. i just keep them in my archives to be a pack rat. Quote
ASMI Posted April 15, 2009 Posted April 15, 2009 You should get collection of opened documents: (setq dCol(vla-get-Documents (vlax-get-acad-object))) and run your code for every drawing: (vlax-for doc dCol ... Your code ... ); end vlax-for To open existing documents you can use vla-Open method: (setq doc(vla-Open dCol "C:\\Some path")) Or use Object DBX interface to proceed drawings without opening. You can't to use command for this code. 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.