method to determine if Revit is in journal playback?

method to determine if Revit is in journal playback?

Anonymous
Not applicable
830 Views
2 Replies
Message 1 of 3

method to determine if Revit is in journal playback?

Anonymous
Not applicable

during command execution you can check to see if there is anything in the journal data map and use that as an indicator of being in playback (assuming you're doing some journal stuff where you're either storing some information in the journal data map or reading from it.)  In other areas of an external application, there are times I'd like to check to see if we're in playback or not.

 

I've implemented a nice journalling tool for use in regression coverage which leverages the journalling sample in the SDK: cool right?

 

One issue that I'd like to get sorted (and would like to do it in a less hacky way) is to repath to local for some text files I need based on whether Revit is in journal playback mode.  I seem to recall an api property that woudl tell us if Revit was in playback or not but I can no longer find it (could have been many moons ago).

 

QUESTION:  Is there a property or function available via the API that would tell us if Revit was in journal playback?

 

In the meantime, I'm throwing a regtest file in my test folder and checking for its presence but that seems hacky.  I can also think up about 5 other hacky ways to do it, just hoping for a nice little function or property to check.

0 Likes
Accepted solutions (1)
831 Views
2 Replies
Replies (2)
Message 2 of 3

jeremytammik
Autodesk
Autodesk
Accepted solution

Dear Ken,

 

Thank you for your query.

 

Yes, that definitely sounds very cool indeed.

 

No, I am not aware of any such functionality off-hand.

 

Exploring the Revit API help file for you, here are some off-the-cuff suggestions that come to mind:

 

Have you looked at the Application.RecordingJournalFilename and ControlledApplication.RecordingJournalFilename properties?

 

What do they say when you are in playback mode?

 

Possibly, they are non-empty when recording, and empty on playback.

 

Alternatively, can you ensure that your own add-in is always loaded first?

 

If so, you could ensure that a specific 'marker' command of yours is executed first of all, e.g. directly after ApplicationInitialized, use the WriteJournalComment to write a journal command if you are in recording mode, and use that command later when reading back to determine that you are in playback mode.

 

I hope this helps.

 

Best regards,

 

Jeremy



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

Message 3 of 3

Anonymous
Not applicable

Greetings Jeremy!

 

I will take a look at the RecordingJournalFilename though, since Revit is writing a journal on playback as well as on record, my guess is that I would have to infer something from the location (e.g., recording is pathed to one of my regression test folders)

 

The command to initialize a regression test recording is an interesting idea and might be good to pursue a bit further. 

 

My quick-and-dirty solution was to place a "flag file" (empty text file) of a specific name in the regression test folder.  I look to the journal recording location and determine if that file is present at the same location, if so: load my settings from the local regression test folder, if not, load them from the normal location. 

 

The more I think about it, it could make for a more flexible scenario.  Would allow QA to playback a journal either using their local machine settings or the settings in the reg test folder by adding or removing that flag file.

 

As for the Revit API property, I'm half wondering if I imagined a way to determine if we were in playback.  I had a feeling like I wrote an external application that automatically opened baretail (baremetal software) with the currently recording journal so I could watch it while working.  That would have been probably 2010 so many moons ago.

 

Thanks for the additional suggestions.  The "reg test initialization" command could be quite interesting as it might present an opportunity to automate some of the manual work of organizing the new test into the suite (renaming, info on who recorded it and what it's supposed to test, smoke or not, etc.)

 

Thanks again,

-Ken

 

 

0 Likes