Jump to content

Saveall lisp for ZWCAD


pietrow

Recommended Posts

Hi,

 

i need a simple lisp to save each opened file in ZWCAD. In ZWCAD there is no that command.

Edited by pietrow
Link to comment
Share on other sites

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

  • Thanks 1
Link to comment
Share on other sites

(defun c:saveall ( / )
(vl-load-com)
 (vlax-for OpenDwgs (vla-get-documents (vlax-get-acad-object))
   (vla-save OpenDwgs)
 );; vlax-for
 (princ)
)

 

  • Thanks 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...