Exemplo n.º 1
0
        internal static Result RunGraph(UIApplication app, string dynamoJournal)
        {
            //toggle the graph to automatic. this is required for running Dynamo UI-Les
            DynamoUtils.SetToAutomatic(dynamoJournal);

            DynamoRevit dynamoRevit = new DynamoRevit();


            IDictionary <string, string> journalData = new Dictionary <string, string>
            {
                { JournalKeys.ShowUiKey, false.ToString() },
                { JournalKeys.AutomationModeKey, true.ToString() },
                { JournalKeys.DynPathKey, "" },
                { JournalKeys.DynPathExecuteKey, true.ToString() },
                { JournalKeys.ForceManualRunKey, false.ToString() },
                { JournalKeys.ModelShutDownKey, true.ToString() },
                { JournalKeys.ModelNodesInfo, false.ToString() },
            };
            DynamoRevitCommandData dynamoRevitCommandData = new DynamoRevitCommandData
            {
                Application = app,
                JournalData = journalData
            };

            var result = dynamoRevit.ExecuteCommand(dynamoRevitCommandData);


            DynamoRevit.RevitDynamoModel.OpenFileFromPath(dynamoJournal, true);
            DynamoRevit.RevitDynamoModel.ForceRun();

            return(result);
        }
Exemplo n.º 2
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            string dynamoJournal = Globals.CurrentGraphToRun;

            if (string.IsNullOrWhiteSpace(dynamoJournal))
            {
                return(Result.Failed);
            }

            //toggle the graph to automatic. this is required for running Dynamo UI-Les
            DynamoUtils.SetToAutomatic(dynamoJournal);

            DynamoRevit dynamoRevit = new DynamoRevit();

            IDictionary <string, string> journalData = new Dictionary <string, string>
            {
                { JournalKeys.ShowUiKey, false.ToString() },
                { JournalKeys.AutomationModeKey, true.ToString() },
                { JournalKeys.DynPathKey, dynamoJournal },
                { JournalKeys.DynPathExecuteKey, true.ToString() },
                { JournalKeys.ForceManualRunKey, false.ToString() },
                { JournalKeys.ModelShutDownKey, true.ToString() },
                { JournalKeys.ModelNodesInfo, false.ToString() },
            };
            DynamoRevitCommandData dynamoRevitCommandData = new DynamoRevitCommandData
            {
                Application = commandData.Application, JournalData = journalData
            };

            return(dynamoRevit.ExecuteCommand(dynamoRevitCommandData));
        }
Exemplo n.º 3
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            string dynamoJournal = Globals.CurrentGraphToRun;

            if (string.IsNullOrWhiteSpace(dynamoJournal))
            {
                return(Result.Failed);
            }

            //toggle the graph to automatic. this is required for running Dynamo UI-Les
            DynamoUtils.SetToAutomatic(dynamoJournal);

            //this is the UI stuff
            //if (File.Exists(Path.Combine(Globals.ExecutingPath, "Prlx.RelayUI.dll")))
            //{
            //    try
            //    {
            //        Prlx.RelayUI.UI.SampleWindow sample = Prlx.RelayUI.Utilities.BuildUI(dynamoJournal);
            //        sample.ShowDialog();
            //    }
            //    catch (Exception e)
            //    {
            //        string messages = e.Message;
            //        //suppress the warning something went wrong.
            //    }
            //}

            DynamoRevit dynamoRevit = new DynamoRevit();



            IDictionary <string, string> journalData = new Dictionary <string, string>
            {
                { JournalKeys.ShowUiKey, false.ToString() },
                { JournalKeys.AutomationModeKey, true.ToString() },
                { JournalKeys.DynPathKey, "" },
                { JournalKeys.DynPathExecuteKey, true.ToString() },
                { JournalKeys.ForceManualRunKey, false.ToString() },
                { JournalKeys.ModelShutDownKey, true.ToString() },
                { JournalKeys.ModelNodesInfo, false.ToString() },
            };
            DynamoRevitCommandData dynamoRevitCommandData = new DynamoRevitCommandData
            {
                Application = commandData.Application,
                JournalData = journalData
            };

            dynamoRevit.ExecuteCommand(dynamoRevitCommandData);


            DynamoRevit.RevitDynamoModel.OpenFileFromPath(dynamoJournal, true);
            DynamoRevit.RevitDynamoModel.ForceRun();

            return(Result.Succeeded);
        }