Hi Klawson, I have followed this problem from a to z and I've tried to implement it into my own project. As mentioned above I'm also trying to run a dynamo script through my own button I've created in Revit. The script I am running, it's working just fine through Dynamo, but the issue is that this script starts with popping out new UI Window asking for some parameters and also to selecting some elements and by those choices it runs the script. As I have followed your block of code you guys put there, I was able to run it, but after I click on my button, it just runs, but won't actually do anything. I have check also if the Dynamo is set in Automatic mode and it is. Is there any function, that I need to evoke first, so that UI Form from Dynamo is popped up, so I can continue and see if it's actually working? This is the code I had followed through this communication:
[Transaction(TransactionMode.Manual)]
public class RunDynamo : IExternalCommand
{
public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
UIApplication uiapp = commandData.Application;
Document doc = uiapp.ActiveUIDocument.Document;
string Dynamo_Journal_Path = @"C:\Users\PeterMihok\AB Clausen\BIM Team - Dynamo Scripts\02 Scripts\02_01 All Scripts\ABC_Elements_SetElevation.dyn";
DynamoRevit dynamoRevit = new DynamoRevit();
DynamoRevitCommandData dynamoRevitCommandData = new DynamoRevitCommandData();
dynamoRevitCommandData.Application = commandData.Application;
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, Dynamo_Journal_Path }, // run node at this file path
{Dynamo.Applications.JournalKeys.DynPathExecuteKey, true.ToString() }, // The journal file can specify if the Dynamo workspace opened
{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);
return externalCommandResult;
}
} I have tried to debug it, but I am not really a programmer so I don't really understand what should I be watching for etc...I would really like to solve this problem as this really interest me and I would like to understand more of it. Thanks in advance for your time guys and responses!