pietrow Posted August 23, 2022 Posted August 23, 2022 (edited) Hi, i need a simple lisp to save each opened file in ZWCAD. In ZWCAD there is no that command. Edited August 23, 2022 by pietrow Quote
Steven P Posted August 23, 2022 Posted August 23, 2022 I am not sure of the commands for ZWCAD, AutoCAD does have "saveall" command in the express tools ZWCAD should be able to run this I think: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/zoom-extents-all-opened-drawings-lisp-routine/td-p/5402517 Google reckons that this zooms all and saves all the open drawings, take out the zoom function and away you go. I haven't tried this yet but might in a moment 1 Quote
zwonko Posted August 24, 2022 Posted August 24, 2022 (defun c:saveall ( / ) (vl-load-com) (vlax-for OpenDwgs (vla-get-documents (vlax-get-acad-object)) (vla-save OpenDwgs) );; vlax-for (princ) ) 1 Quote
pietrow Posted August 26, 2022 Author Posted August 26, 2022 Thank you, both work very well. I have another question - is there possibility to implement for this routine to call command from created lisp like C:LISPNAME? I have about 20-30 dwg files and in every of them i need to run exact the same lisps - its time consuming and could result in omitting some dwg. Quote
Steven P Posted August 26, 2022 Posted August 26, 2022 A couple of ways to do this. I assume your saveall is saved in a LISP file somewhere. Put the file you want with the LISP routines you want into the startup suit Simple, but effective for 30 drawings is to put for example (c:LISPNAME) right at the end of your Lisp file, outside of the last function definition, so when CAD loads the file it will ge to that line and run it. Best to keep the (C:LISPNAME) line in the same file as the LISP just in case it hasn't been loaded when it is asked to run Second easiest is to create a seperate LISP with all the LISPs running from that, load a drawing, run this one and it does everything for example (defun c:runsomestuff ( / ) (c:LISPNAME) (c:saveall) (dosomehing) ) Just run that each time you open a drawing Ad third look at something like scriptpro, and run c:runsomestuff as a batch on all the drawings 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.