Launch Dynamo from Journal File

Is it possible to launch Dynamo from a journal file and run a script?

I tried the following which I got from @Andreas_Dieckmann Dynamo Automation :

Jrn.Command "Ribbon" , "Launch Dynamo, ID_VISUAL_PROGRAMMING_DYNAMO"
Jrn.Data "APIStringStringMapJournalData", 5, "dynPath", "C:\Users\dboghean\Desktop\Home.dyn", "dynShowUI", "false", "dynAutomation", "false", "dynPathExecute", "true", "dynModelShutDown", "true" 

It loads the required Revit File, but then skips the load Dynamo part and closes Revit.

Checking the journal file after Revit runs says this:

 ' 0:< Unnecessary nesting;ArrowUI_4;-1;ID_VISUAL_PROGRAMMING_DYNAMO ;N++EB(NB); 

'PermissiveJournal:DebugMode: The following error in the journal is ignored: JournalData "APIStringStringMapJournalData" from file was skipped 

Any ideas what I’m doing wrong?

Seems like you have two versions of dynamo installed. You’ll need to have only one to successfully launch Dynamo from the journal.

I only have Dynamo Core 1.3.1 and Dynamo Revit 1.3.1 installed.

Any other ideas on what may be causing the error?

For anyone interested in accomplishing this, the problem is that Revit doesn’t load any addins when launching via a journal file. The Dynamo.addin needs to be in the same location as the journal file when it is launched in order to load it.

Now I’m running into a problem of Revit closing before the Dynamo script executes.


hi @Dan_Boghean I’ve got the same problem as you at the moment, I managed to open dynamo and the graph but it doesn’t run. (I’ve tried every combination of true and false just in case.)

the current is:

Jrn.Data "APIStringStringMapJournalData"  _
         , 6, "dynAutomation", "true" _
         , "dynForceManualRun", "false", "dynModelShutDown" _
         , "true", "dynPath", " " _
         , "dynPathExecute", "true", "dynShowUI" _
         , "true"

I had a look into the DynamoRevit.cs
it looks like a good explanation but still doesn’t run.

any idea?

// Summary:
// A data map that can be used to read and write data to the Autodesk Revit
// journal file.
// Remarks:
// The data map is a string to string map that can be used to store data in
// the Revit journal file at the end of execution of the external command. If
// the command is then executed from the journal file during playback this data
// is then passed to the external command in this Data property so the external
// command can execute with this passed data in a UI-less mode, hence providing
// non interactive journal playback for automated testing purposes. For more
// information on Revit’s journaling features contact the Autodesk Developer
// Network.
public IDictionary<string, string> JournalData { get; set; }

    /// <summary>
    /// Defines startup parameters for DynamoRevitModel
    /// </summary>
    public class JournalKeys
        /// <summary>
        /// The journal file can use this key to specify whether
        /// the Dynamo UI should be visible at run time.
        /// </summary>
        public const string ShowUiKey = "dynShowUI";

        /// <summary>
        /// If the journal file specifies automation mode, 
        /// Dynamo will run on the main thread without the idle loop.
        /// </summary>
        public const string AutomationModeKey = "dynAutomation";

        /// <summary>
        /// The journal file can specify a Dynamo workspace to be opened 
        /// (and executed if we are in automation mode) at run time.
        /// </summary>
        public const string DynPathKey = "dynPath";

        /// <summary>
        /// The journal file can specify if the Dynamo workspace opened 
        /// from DynPathKey will be executed or not. 
        /// If we are in automation mode the workspace will be executed regardless of this key.
        /// </summary>
        public const string DynPathExecuteKey = "dynPathExecute";

        /// <summary>
        /// The journal file can specify if the Dynamo workspace opened
        /// from DynPathKey will be forced in manual mode.
        /// </summary>
        public const string ForceManualRunKey = "dynForceManualRun";

        /// <summary>
        /// The journal file can specify if the existing UIless RevitDynamoModel
        /// needs to be shutdown before performing any action.
        /// </summary>
        public const string ModelShutDownKey = "dynModelShutDown";

        /// <summary>
        /// The journal file can specify the values of Dynamo nodes.
        /// </summary>
        public const string ModelNodesInfo = "dynModelNodesInfo";

I was able to get it to work using the command I posted above.

It seems like you’re not specifying a dynPath to run. That’s the first place I would guess to look. Otherwise it doesn’t know what script to run. Although you’re saying the graph is opening, so that doesn’t seem right.

Only thing I can suggest is copying the exact same code I have and trying that since that worked for me.

I did run into issues with Revit 2016, though.

I deleted my local path before posting, didn’t want to post publicly…

I’m trying with Revit 2017, I might give it a go with 2018.

The script opens, but it just doesn’t run and keep going through the journal doing the other actions.

I’ll try your exact code and keep you posted.

ok, I’ve tried everything:

  1. I’ve managed to run the script (it just place a generic model by importinstance by geometry for testing) using your code, the issue before was that dynamo gave me an error without reporting anything

  2. now the best part: when I save the model, and I can see it actually saves it (gets updated the timestamp in windows), it doesn’t save the family imported. it just save an empty file

  3. I’ve tried to not making it close with the Journal to see if the script actually placed the family, and it does.

  4. when I saved it manually I’ve looked into the journal and found this line:
    Jrn.Data "Transaction Successful", "Dynamo-51297CB5 Script"
    I guess when the dynamo script runs it doesn’t ends up the transaction, and if I try to add that line on the journal it says It doesn’t work and will enter in “interactive mode”

@Dan_Boghean any idea?

After saving the file, can you try killing the dynamo process with a python node at the end?

I’m sorry I can’t be more helpful, I’m not an expert in journal files by any means. I have run into a similar situation where I was programmatically changing a parameter, but Revit wouldn’t save it. The solution there was to rename the parameter and then change it back to the original name. Not sure if that can be extrapolated somehow to your situation, but thought I’d throw it out there to see if you could run with something.