Author Topic: Mission: Capture time event  (Read 2688 times)

0 Members and 1 Guest are viewing this topic.

ahankhah

  • Guest
Mission: Capture time event
« on: December 11, 2014, 04:42:15 AM »
Hi all,

is it possible to define functions to time events in visual lisp?
For instance, doing something (issuing a function) t a disired time.

I appreciate any help or clue

Mehrdad Ahankhah
www.irancad.com

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Mission: Capture time event
« Reply #1 on: December 11, 2014, 06:36:59 AM »
Unfortunately I don't think anything fired on a specific time is possible. Not directly from Auto-/VisualLisp.

You could make some reactor firing on a specific user action (e.g. vlr-command-reactor if any command is started) then test the current time against the previous run and only call the function if a specified interval has elapsed. Unfortunately this won't guarantee that the function will be called at the specified time - only that it won't be called sooner (e.g. what if the user doesn't issue any command for hours on end?).
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

ahankhah

  • Guest
Re: Mission: Capture time event
« Reply #2 on: December 12, 2014, 01:31:04 AM »
Irneb,
thank you very much.

Mehrdad Ahankhah
www.irancad.com

TimAshby

  • Guest
Re: Mission: Capture time event
« Reply #3 on: December 12, 2014, 04:12:47 PM »
Best I can think of would be to ensure autosave is active & trigger a reactor from the autosave event.

Autosave (at, say, 10minute intervals)
  Reactor triggers
    Get DATE
      If close to desired time
        Set autosave to 1 minute intervals
      If DATE = desired time (+- 1 minute)
         Execute command

Not a great solution, but...
         

ChrisCarlson

  • Guest
Re: Mission: Capture time event
« Reply #4 on: December 12, 2014, 04:17:49 PM »
What needs to be done at a certain time?

ahankhah

  • Guest
Re: Mission: Capture time event
« Reply #5 on: December 28, 2014, 05:23:14 AM »
ChrisCarlson,
there should be several functions to do at a certain time.
For example:
1- Alert user to do something in an exact time.
2- Doing some tasks in desired intervals.
...

BlackBox

  • King Gator
  • Posts: 3770
Re: Mission: Capture time event
« Reply #6 on: December 29, 2014, 11:48:10 AM »
Best I can think of would be to ensure autosave is active & trigger a reactor from the autosave event.

As I understand it, Editor Events are not raised for Autosave directly, but the DocumentLockModeChanged, and DocumentLockModeWillChange Events are.



Unfortunately I don't think anything fired on a specific time is possible. Not directly from Auto-/VisualLisp.

You could make some reactor firing on a specific user action (e.g. vlr-command-reactor if any command is started) then test the current time against the previous run and only call the function if a specified interval has elapsed. Unfortunately this won't guarantee that the function will be called at the specified time - only that it won't be called sooner (e.g. what if the user doesn't issue any command for hours on end?).

1+

Discussed a similar topic here back in 2013; page 2 may be of interest, here's a snippet:

Quote from: BlackBox_ 05-28-2013 11:41 AM
Quote from: BlackBox_ 05-28-2013 03:32 PM
To the best of my limited knowledge....
 
If you really wanted to do this right, you'd use a custom .NET LispFunction Method which registers a System.Timer.Elapsed Event Handler, supplying the ResultBuffer with both the int32 (?) increment (the time to elapse), and the symbol/function (without Command calls) as the would-be Callback invoked via silent SendStringToExecute() call immediately following the unregisteration of the aforementioned Event Handler. *untested*

... One cannot pass a SUBR (Symbol/Function) to LispFunction, else error 'overflow' message returned, however, (to the best of my knowledge) one can pass the name of said SUBR as string, which can be used to build the string command parameter of the SendStringToExecute() Method for the Elapsed Event Handler.

Code - Auto/Visual Lisp: [Select]
  1. (MyLispFunctionMethod 1800 "MyDefunSubFunctionName")



Cheers
"How we think determines what we do, and what we do determines what we get."

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: Mission: Capture time event
« Reply #7 on: December 29, 2014, 02:51:00 PM »
Maybe a dumb observation, but why would you be looking to do this while ACAD is active, would not a better solution be to have the operating system do this for you in the event ACAD is not active.