Jump to content

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


MikeP

Recommended Posts

I need an auto save lisp. It needs to load it self automatically every time I create a new drawing. I want it to run the "qsave" command every minuet. the autosave does not work like I want it to. and often I will loose work.

Link to comment
Share on other sites

  • 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

how about saving every X number of commands?

 

 

are you suggesting me saving every few commands or for a function for the lisp. if for the lisp that would be fine.

Link to comment
Share on other sites

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))

Link to comment
Share on other sites

I have a VBA function that saves every X commands, you specify, but it ignores pan zoom, and resets on qsave or saveas or save. Sorry, I dont use LISP very much

Link to comment
Share on other sites

I have a VBA function that saves every X commands, you specify, but it ignores pan zoom, and resets on qsave or saveas or save. Sorry, I dont use LISP very much

 

Hmmm... thats a point - mine was just a "quick & dirty" LISP post as ppl say... haven't tested it in the situation of qsave, save, pan and zoom... could be interesting.. :P

Link to comment
Share on other sites

Option Explicit
Dim command_count As Long    'Used in AcadDocument_EndCommand function

Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
'***Below code is to AUTO save the drawing every 25 commands,
   If ThisDrawing.GetVariable("DWGTITLED") = 1 Then    'don't use on new, unsaved drawings
       Select Case CommandName
       Case UCase("undo"), UCase("u"), UCase("zoom"), UCase("z"), UCase("pan")
           command_count = command_count
       Case UCase("QSAVE"), UCase("SAVE")
           command_count = 0
       Case Else
           command_count = command_count + 1
           If command_count = 25 Then    'change this to any number you want
               ThisDrawing.Save
               command_count = 0
           End If
       End Select
   End If
End Sub

Link to comment
Share on other sites

Will save after 10 commands ~ just load it.

 

 

 

 

what do you mean just load it. do I have to enter a command name in each drawinging to start it or is it universal for every new drawing. where do I just load it. I normaly load things into "appload"

Link to comment
Share on other sites

Open Autocad, then hit Alt-F11 to open the VBA IDE which is where we will cut and paste. Paste the code in the ThisDrawing area. Save as Acad.dvb in you search path, and then it just tweaking to your number of preferedd commands

Link to comment
Share on other sites

The Acad.dvb file will autoload, and run automatically.

 

Many thanks David - thats a great explanation, now I know for future reference. :thumbsup:

 

what do you mean just load it. do I have to enter a command name in each drawinging to start it or is it universal for every new drawing. where do I just load it. I normaly load things into "appload"

 

Just load the Reactor as you would a normal LISP - either in the appload, start-up suite or ACADDOC.lsp.

 

You needn't invoke the LISP with any command, it will run automatically when needed. (hence the name reactor). :)

Link to comment
Share on other sites

Many thanks David - thats a great explanation, now I know for future reference. :thumbsup:

 

 

 

Just load the Reactor as you would a normal LISP - either in the appload, start-up suite or ACADDOC.lsp.

 

You needn't invoke the LISP with any command, it will run automatically when needed. (hence the name reactor). :)

 

 

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

Link to comment
Share on other sites

Open Autocad, then hit Alt-F11 to open the VBA IDE which is where we will cut and paste. Paste the code in the ThisDrawing area. Save as Acad.dvb in you search path, and then it just tweaking to your number of preferedd commands

 

 

when ever i do that, it freezes cad for a while then it crashes

Link to comment
Share on other sites

that is very bizarre, I would have yout IT people look at your machine to see if they are disableing it somehow, or you might not have it installed. When autocad was installed, they might not have chosen FULL install.

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...