Hi All!
I am trying to launch dyn script from revit addin:
string Journal_Dynamo_Path = dynamoOperateInfo.DynamoFilePath;
DynamoRevit dynamoRevit = new DynamoRevit();
IDictionary<string, string> journalData = new Dictionary<string, string>
{
{ Dynamo.Applications.JournalKeys.ShowUiKey, true.ToString() }, // don't show DynamoUI at runtime
{ Dynamo.Applications.JournalKeys.AutomationModeKey, true.ToString() }, //run journal automatically
{ Dynamo.Applications.JournalKeys.DynPathKey, "" }, //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, true.ToString() }
};
DynamoRevitCommandData dynamoRevitCommandData = new DynamoRevitCommandData
{
Application = MainClasses.uiApp,
JournalData = journalData
};
Result dynResult = dynamoRevit.ExecuteCommand(dynamoRevitCommandData);
DynamoRevit.RevitDynamoModel.OpenFileFromPath(Journal_Dynamo_Path, true);
DynamoRevit.RevitDynamoModel.ForceRun();
if (dynResult == Result.Succeeded)
{
Logger.AddStrings("OK!");
}
else
{
Logger.AddStrings("NOT OK!");
}
But dynResult == Result.Succeeded even when the script completed with warnings. How to determine that case with warnings?
I am trying
foreach (NodeModel nodeModel in DynamoRevit.RevitDynamoModel.CurrentWorkspace.Nodes)
{
if (nodeModel.State == ElementState.Warning)
{
Logger.AddStrings("Error in node: "+nodeModel.Name+Environment.NewLine);
}
}
but it cause error