I am looking for a way to run dynamo script with Revit API programmatically.
Following code execute simple dynamo scripts successfully but unable to run dynamo script which requires user interaction (Select from dwg or input some values)
//Get application and document objects and start transaction
UIApplication uiapp = commandData.Application;
Document doc = uiapp.ActiveUIDocument.Document;
// Run dynamo script without dynamo player..
string Journal_Dynamo_Path = @"<dynamo_script_path>";
var dynamoRevit = new DynamoRevit();
var dynamoRevitCommandData = new DynamoRevitCommandData
{
Application = uiapp
};
IDictionary<string, string> journalData = new Dictionary<string, string>
{
{ Dynamo.Applications.JournalKeys.ShowUiKey, false.ToString() }, // don't show DynamoUI at runtime
{ Dynamo.Applications.JournalKeys.AutomationModeKey, true.ToString() }, //run journal automatically
{ Dynamo.Applications.JournalKeys.DynPathKey, Journal_Dynamo_Path }, //run node at this file path
{ Dynamo.Applications.JournalKeys.DynPathExecuteKey, true.ToString() }, // 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.
{ Dynamo.Applications.JournalKeys.ForceManualRunKey, false.ToString() }, // don't run in manual mode
{ Dynamo.Applications.JournalKeys.ModelShutDownKey, true.ToString() },
{ Dynamo.Applications.JournalKeys.ModelNodesInfo, false.ToString() }
};
dynamoRevitCommandData.JournalData = journalData;
Result externalCommandResult = dynamoRevit.ExecuteCommand(dynamoRevitCommandData);
DynamoRevit.RevitDynamoModel.OpenFileFromPath(Journal_Dynamo_Path, true);
DynamoRevit.RevitDynamoModel.ForceRun();
Tried to run script with Dynamo player itself, able to open dynamo player programmatically, but not able to run script using player.