Dynamo API

Hi,

A question for Dynamo development team. I’m trying to run a dyn file using:

dynamoRevit.ExecuteCommand(dynamoRevitCommandData)

It’s working fine in 75% of times, however I’m getting some unexpected results as well. Just wondering if there’s an explanation for this. My suspect was that it’s happening because I haven’t initialised DynamoCore in my code. But while debugging I can see the initializedCore property is set true. The unexpected results that I’m getting are: frozen nodes being run, certain nodes running ok for the first time and then acting like they are subscribed to DocumentChanged event. And when I make any change to the document they are triggered and re-run with incomplete inputs.

Could someone please shed some light on how best to use ExecuteCommand method. Am I missing any initialisation? Thanks.

@Michael_Kirschner2 @Racel_Williams

Hi @HossZamani what is the context of this call?

I’m not sure what dynamoRevit is in this case, or what data you are passing -

Please share some more detailed code.

I’m calling the method in my ExternalCommand:

            DynamoRevit dynamoRevit = new DynamoRevit();

            DynamoRevitCommandData dynamoRevitCommandData = new DynamoRevitCommandData();

            // commandData is the instance of my ExternalCommandData

            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, dynPath } // dyn file path

            };

            dynamoRevitCommandData.JournalData = journalData; 

            dynamoRevit.ExecuteCommand(dynamoRevitCommandData);

@Michael_Kirschner2 is the code above clear enough? Is there something else I need to clarify? Thanks.

Hi @HossZamani - really not sure - not too many examples of users who are starting their dynamoRevitModel - have you looked at this comment: