Put events on a timer?

Discussion in 'AutoCAD' started by Bob Quinn, Dec 26, 2004.

  1. Bob Quinn

    Bob Quinn Guest

    Is it possible to trigger an autolisp routine to activate
    lets say, every 5 minutes? I have a progress tracking system I would like
    to be able to call the update routine automatically. Thanks for your help :)
     
    Bob Quinn, Dec 26, 2004
    #1
  2. Hi Bob,

    Could you put a reactor on the Autosave event ?

    --


    Laurie Comerford
    CADApps
    www.cadapps.com.au
     
    Laurie Comerford, Dec 26, 2004
    #2
  3. Long before there was Autosave, we had the cancel buttons on our tablet
    pucks programmed to cancel AND then check the drawing timer, and if it had
    been running for more than some set time, offer to save the drawing. If you
    said yes, it would reset the timer, and the Save tablet menu items also
    reset it. Since we have lots of ordinary commands on tablet menu items
    built to repeat automatically, everyone used cancel often enough that it
    worked well as a surrogate autosave feature. And because it was tied to
    cancel, it never interfered with any ongoing commands.

    You could do that kind of thing if you use a puck with a cancel button. Or
    is it possible to "redefine" cancel to do something like that? (Cancel
    isn't a "command" of the same kind as others, so maybe it can't be
    redefined, but maybe you can assign a modified function to the Escape key.)
     
    Kent Cooper, AIA, Dec 27, 2004
    #3
  4. Bob Quinn

    pablorico21 Guest

    You could use Visual Basic (not VBA), but you will need a Microsoft Visual Basic compiler(Microsoft Visual Studio). In Visual Basic we have timer object. It's just a way...
     
    pablorico21, Dec 27, 2004
    #4
  5. Bob Quinn

    Bill DeShawn Guest

    Why not just hit the save button on the drop-down menu. It does two cancels
    before it saves.
    ^C^C_qsave
    Why on earth do you need another piece of hardware? Move your wrist an inch
    or so and use the one-click buttons that are available.
    If you think you can't lose the puck, assign the macro above to a button.

    If you want an automatic save, you could undefine MOVE and write a routine
    for acad.lsp like this:
    (command "undefine" "move")
    (defun c:move ()
    (command "_.undo" "_begin")
    (command "_.move" )
    (while (= (getvar "cmdactive") 1)) (command pause))
    (command "_.undo "_end")
    (command "_.qsave")
    (princ)
    )
    (defun c:m () (c:move) (princ))
    This way every time you exit a move command, you automatically save.

    I didn't test the above code, so, if it's wrong, get some help. I'll help
    you again, too.
     
    Bill DeShawn, Dec 27, 2004
    #5
  6. Read it again. It wasn't really about saving at all (the original poster
    mentioned a different kind of routine they want to activate), or about
    canceling. I just gave my old save-check case as an example of a way to
    trigger something based on elapsed time, which is what they were looking
    for. My example used a menu item that invoked cancel as a trigger to check
    the elapsed timer, and if it had gone past the specified time, to do
    something (in my example, asking whether you want to save, and presumably in
    the original poster's case, activating their routine). It's a feature we
    used to use long ago (as I said, before there was Autosave), and we haven't
    used it since Autosave came along. In fact, if the OP wanted to see the
    code for it as a starting point to edit for invoking their routine, I don't
    think I even have any copies of menu files old enough, so I'd have to try to
    recall how it was actually done.

    The problem I see for most people these days is that it was triggered by the
    digitizer puck cancel button, and not many people use digitizers any more.
    Those buttons can be programmed to do anything you want (just like any other
    kind of menu item) -- the "standard" was to have one of them be Cancel, and
    we just modified that to add the elapsed-timer check. I kind of assume the
    Escape key can't be programmed, so maybe the tieing-it-to-Cancel approach
    can't be used by mouse-people, unless, as you say, it's put into a button or
    something. Maybe the Cancel item in the little context-popup menu-lets can
    be programmed this way, but I'd bet most people are more likely to hit Esc
    than to use those.

    Personally, I wouldn't want to redefine any command to include saving,
    because you can't easily undo the effects of a command that alters the
    drawing file itself, rather than the stuff you have loaded in the drawing
    editor. If you opened a drawing, worked in it for a while (including doing
    some of whatever command you redefine to include saving), and then decide
    you didn't want to keep any of what you had done, you couldn't just close or
    quit and tell it you didn't want to save your changes, because it would
    already have saved some of them. You'd have to undo repeatedly all the way
    back, and then save again, if you wanted to restore the drawing to its
    condition when you opened it.

    That was the beauty of tieing our elapsed-time check to Cancel (it wasn't
    invoked by any drawing or editing command), and having it not just
    automatically save, but rather ask you whether you wanted to. But the OP
    could certainly program such a timer-check item to just do their routine,
    without asking or even notifying the user, if that's appropriate for their
    purposes.
     
    Kent Cooper, AIA, Dec 27, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.