Journal time-stamps at a set interval for another #RTCEUR #Revit API wish

Joel wished for “a time stamp added to journal files. I’m thinking something like an addin or macro that just notes the current time at specified intervals. The use would be for tracking performance – what processes take a long time, and how much how much time.”

It is so great that C# has the Timer class to make this easy –


Application app = null;
public void JournalCommentTimer()
    app = this.Application;
    UIApplication uiapp = new UIApplication(app);
    double seconds = 10;
    Timer timer = new Timer(seconds * 1000);
    timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
    timer.Enabled = true;

void timer_Elapsed(object sender, ElapsedEventArgs e)
    app.WriteJournalComment("New Timestamp", true);

Add this to your file to compile the code above:
using System.Timers;

2 thoughts on “Journal time-stamps at a set interval for another #RTCEUR #Revit API wish

  1. Interesting- will Arnost jump on this and say “don’t use threads with the API!”? or is this somehow simple and non-document-oriented enough to be able to use without problem?

    • Seemed safe in my testing. It isn’t changing the Revit model in a separate thread. I thought there might be problem when Revit was busy during a File Upgrade, but it worked fine, writing the timestamps to the journal file as it upgraded the RVT.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s