Open Dynamo in background while C# add-in executes

Hi all,

Does anyone knows how to open Dynamo in background? I want to run a Dynamo script through Revit add-ins .

Any help is appreciated.

I wonder how Dynamo player is doing it. Or Dyno too.

Me too. :thinking:

With the ProtoGeometry library is really easy to solve geometric issues, on the other hand is really painful trough the API.

If you are making an addin you could import those classes I imagine.

I managed to launch DynamoSandbox from its exe file, but I can’t find Dynamo for Revit. I really don’t know how to uses classes to achive that.

Have a look at the DynamoAutomation code. It uses the same methodology as Player / Dyno / RevitTestFramework, which is JournalData + PostableCommands



Thanks. I’ll give it a try.

1 Like

This may or may not help but I threw a stone in the dark as below:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Dynamo.Applications;
using Dynamo.Core;

namespace my_addin
    class DynamoTest : IExternalCommand
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)

            string Journal_Dynamo_Path = path_to_my_dyn_file;
            DynamoRevit dynamoRevit = new DynamoRevit()

            DynamoRevitCommandData dynamoRevitCommandData = new DynamoRevitCommandData();
            dynamoRevitCommandData.Application = commandData.Application;
            IDictionary<string, string> journalData = new Dictionary<string, string>
                { Dynamo.Applications.JournalKeys.AutomationModeKey, true.ToString() },
                { Dynamo.Applications.JournalKeys.ShowUiKey, false.ToString() },
                { Dynamo.Applications.JournalKeys.DynPathKey, Journal_Dynamo_Path }
            dynamoRevitCommandData.JournalData = journalData;       

            Result externalCommandResult = dynamoRevit.ExecuteCommand(dynamoRevitCommandData);

            return externalCommandResult;


And I’m getting this error:


Does anyone know what I’m doing wrong?

Hello hzamaniM54WP,

I extended your code, you were missing a few JournalKeys. See here: Run a.dyn from a Revit add-in?