Jump to content

need a autosave lisp... Autocad's autosave just does not cut it.


MikeP

Recommended Posts

when i saved your code, do i need save it as a .lsp or a .txt then load it in the appload?

 

A Reactor is still a LISP file, just a different type of function - should be saved as a .lsp as normal.

Link to comment
Share on other sites

  • 2 years later...
  • Replies 35
  • Created
  • Last Reply

Top Posters In This Topic

  • CmdrDuh

    10

  • Lee Mac

    8

  • MikeP

    6

  • andre81

    5

Top Posters In This Topic

Posted Images

I've got a question for LEE MAC's routine. I've start to use it - it works well - but sometimes I have to use 'undo' command. When I use it then counter for 'save' command rise fast and do saving during I'm still pressing 'Ctrl+Z'. How to exclude counting 'i' when I use 'undo' command? The reason I'm using this routine is that I have open about 10 drawings in the same time but need to save just few - the other are for read only. So when I have turn on "auto-save" in Autocad it need time to save all drawings.

By the way - maybe someone use SSD drives - how it works during autosave and working with Autocad - especially xrefs?

Link to comment
Share on other sites

Cause it's much faster and has shorter access time so:

- soft installed on it should work faster,

- TEMP directory located on SSD should make autosave much faster,

- drawings located on SSD drive should open and save faster,

 

For example now I have drawing with attached 9 xrefs and during autosave runnig I have to wait about 25 seconds and I'm lose my attention.

Link to comment
Share on other sites

That's no doubt. I thought about time - how long it takes. As I said - depend of drawing - now I takes for me about half minute - with standard drive. I have set time period for 15 minutes so every 15 minutes I have to wait at least half minute - depending also how many other drawings I heave open.

Link to comment
Share on other sites

I've got a question for LEE MAC's routine. I've start to use it - it works well - but sometimes I have to use 'undo' command. When I use it then counter for 'save' command rise fast and do saving during I'm still pressing 'Ctrl+Z'. How to exclude counting 'i' when I use 'undo' command?

 

Try this updated version:

 

(vl-load-com)
(if (null *save:react*)
   (setq *save:react* (vlr-command-reactor nil '((:vlr-commandwillstart . savedwg)))
         *save:acdoc* (vla-get-activedocument (vlax-get-acad-object))
         *save:count* 0
   )
)

(defun savedwg ( reactor params )
   (if
       (and
           (not (wcmatch (strcase (car params)) "*UNDO"))
           (zerop (rem (setq *save:count* (1+ *save:count*)) 10))
       )
       (if (zerop (getvar 'DWGTITLED))
           (vla-saveas *save:acdoc* (strcat (getvar 'DWGPREFIX) (getvar 'DWGNAME)))
           (vla-save   *save:acdoc*)
       )
   )
   (princ)
)
(princ)

Link to comment
Share on other sites

Yes, I agree. The read/write times of the SSD should make the saving process go a bit faster. There should be no downside to using a SSD. However, given the cost of an SSD versus a regular hard drive wouldn't it be better to save your drawing files to the regular hard drive? I know that having the program itself loaded on the SSD is definitely the way to go.

Link to comment
Share on other sites

Guys...I don't know what you all have for computers...but saving every 10th command or once a minute would drive me insane. Maybe you're just super fast but come on... If you are losing that much work, buy a UPS so your computer stays on. Don't get me wrong, I'm a great believer in autosave, but I have mine set at 15 minute intervals. Every minute? Ain't no way you can lose that much in a minute.

Link to comment
Share on other sites

hm.

I thought the drawing is big and cause it has many xrefs sav and autosave takes many time but.... after "autocad fatal error: cannot write to undo file (probably disk full)" I found indirect reason.

When I set variable SAVEFIDELITY to 0 (same unchecked options -> Open and Save -> Maintain visual fidelity for annotative objects) save or autosave takes 1 second so it's solve my problem.

Link to comment
Share on other sites

Thanks Lee Mac for routine. I will check it.

 

Maybe my English isn't good enough so I didn't explain it well.

My idea was - use save/autosave only for drawings which I change:

- turn off autosave

- load Lee Mac's routine for constuction drawing which I'm working on

- don't use save for architecture drawings which I'm don't change - just compere with my constructions drawings - so i don't waste time for autosave these drawings

 

Now after setting SAVEFIDELITY to 0 it works well also with autosave.

 

@ReMark - I agree that SSD is now too expensive especially for my but not for my company.

@Jack_O'neill - You've got right - autosave every 10 commands is too often. I've just change Lee Mac's counter - routine is usefull.

Link to comment
Share on other sites

  • 3 weeks later...

A much simpler command to set list is as follows:

 

start of AutoSave.lsp

 

(if (

)

 

the "5" is for 5 minutes so if you want to set it for 30 minutes, yes you guessed it ... type 30

Link to comment
Share on other sites

  • 3 years later...
Will save after 10 commands ~ just load it.

 

(defun Make_Reactor  ()
   (vl-load-com)
   (if    (not save:reactor)
   (setq save:reactor
        (vlr-command-reactor nil '((:vlr-commandWillStart . SvPrompt)))))
   (princ))
(Make_Reactor)

(defun SvPrompt  (Reac Args / doc)
 (or i (setq i 0))
 (if (= i 10)
   (progn
     (setq doc (vla-get-ActiveDocument
         (vlax-get-acad-object)))
     (vla-save doc)
     (vla-saveas doc
   (strcat (getvar "dwgprefix") (vla-get-name doc)))
     (setq i 0))
   (setq i (1+ i)))
 (princ))

 

Thank you Lee :thumbsup: very helpful :shock:

Link to comment
Share on other sites

  • 5 years later...

I use Lee Mac solution, (I'm an old Lisp programmer), I added a small change to check if any entity is created. also changed the names of variables,
just to avoid any problems with undeclared variables.

I don´t want to save unchanged files, although I may loose some changes to entities, if I have changed but not created anything new.

(defun Make_Reactor  ()
   (vl-load-com)
   (if    (not save:reactor)
   (setq save:reactor
        (vlr-command-reactor nil '((:vlr-commandWillStart . SvPrompt)))))
   (princ))
(Make_Reactor)

(setq #ncommandsave 20)
(setq #entlastautosave (entlast))
(defun SvPrompt  (Reac Args / doc)
 (or #autosave (setq #autosave 0))
 (if (> #autosave #ncommandsave)
   (progn
     (if (not (equal #entlastautosave (entlast)))
       (progn
          (setq doc (vla-get-ActiveDocument
          (vlax-get-acad-object)))
          (vla-save doc)
          (vla-saveas doc (strcat (getvar "dwgprefix") (vla-get-name doc)))
          (setq #autosave 0)
	  (setq #entlastautosave (entlast))
	)
     )
   )
   (setq #autosave (1+ #autosave))
 )
 ;(princ #autosave)
  (princ)
)

 

Edited by PBxpto
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...