Hi David,
Did you see this post: Open Dynamo in background while C# add-in executes ?
I feel like hzamaniM54WP was close with the following code, but I can’t figure out what he was doing wrong either.
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
{
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
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: