How to calculate Revit Opened File Idle time in ..Net ?

How to calculate Revit Opened File Idle time in ..Net ?

adiln
Participant Participant
1,038 Views
5 Replies
Message 1 of 6

How to calculate Revit Opened File Idle time in ..Net ?

adiln
Participant
Participant

How to calculate Revit Opened file idle time. I have already implemented time spent for open file and save information when application closed in a excel filee.


Unable to figure out how to claculate idle time for each opened file .

 

 
0 Likes
1,039 Views
5 Replies
Replies (5)
Message 2 of 6

jeremytammik
Autodesk
Autodesk

The Revit API does in fact provide an Idling event that might enable you to get what you need:

 

https://www.revitapidocs.com/2020/e233027b-ba8c-0bd1-37b7-93a066efa5a3.htm

 

It has two modes. You can ask for the event handler to be called once only, when Revit enters the idling state, or continuously. Since no call-back is provided for exiting the idling state, you may need to implement continuous polling. That may have the disadvantage of degrading system performance. Alternatively, you may be able to determine when Revit exist the idle state from the journal file. You may even be able to determine both entry and exit into the idling state from the journal file. 

  

Here are many other discussions of the Idling event:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.28

 

Note that for many uses, it has now been superseded by external events. It may just fit your needs, though. 

 

Looking forward to hearing how you end up solving this task.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 6

adiln
Participant
Participant

@jeremytammikThanks for the feedback but issue is when added application Event Handler<IdlingEventArgs> for   dle state time calculation, the event is continuously invoked every second. 

 

It should be triggered at times for Revit Idle state but is triggered continuously every second even if working on a file too.  It should be triggered at idle states scenarios only.

0 Likes
Message 4 of 6

jeremytammik
Autodesk
Autodesk

You can file a wish list item in the Revit Idea Station if you think a different behaviour would make more sense.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 5 of 6

Dale.Bartlett
Collaborator
Collaborator

Not sure if this is useful, but I was looking at using some of the ideas.

https://www.codeproject.com/Articles/30345/Application-Idle 

Dale




______________
Yes, I'm Satoshi.
Message 6 of 6

jeremytammik
Autodesk
Autodesk

Wow, that codeproject article looks really great! Thank you! Were you able to use it unmodified as is?

  



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes