DynamoDS / Dynamo

Open Source Graphical Programming for Design
https://dynamobim.org
Other
1.74k stars 634 forks source link

How to close Dynamo script opening in Dynamo by external application? #15086

Open chuongmep opened 8 months ago

chuongmep commented 8 months ago

Dynamo Version

2.19

Host

No response

Operating System

Windows 10

What did you do?

I want intergrate with external application to close dynamo script opening

What did you expect to see?

Don't know how to do

What did you see instead?

Nothing

What packages or external references (if any) were used?

No response

Stack Trace

No response

Details

No response

github-actions[bot] commented 8 months ago

Thank you for submitting the issue to us. We are sorry to see you get stuck with your workflow. While waiting for our team member to respond, please feel free to browse our forum at https://forum.dynamobim.com/ for more Dynamo related information.

mjkkirschner commented 8 months ago

hi @chuongmep can you please share some code or give a bit more of a technical description of what you want to achieve, I'm not sure how to help at the moment.

chuongmep commented 8 months ago

hi @chuongmep can you please share some code or give a bit more of a technical description of what you want to achieve, I'm not sure how to help at the moment.

Hi @mjkkirschner , this is code I can execute in case dynamo don't open :

DynamoRevit dynamoRevit = new DynamoRevit();

                IDictionary<string, string> journalData = new Dictionary<string, string>
                {
                    {JournalKeys.ShowUiKey, false.ToString()},
                    {JournalKeys.AutomationModeKey, true.ToString()},
                    {JournalKeys.DynPathKey, temppath},
                    {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

                };
                Result result = dynamoRevit.ExecuteCommand(dynamoRevitCommandData);

But when Dynamo opening, how can we call close script current by use Dynamo Application opening ?

mjkkirschner commented 8 months ago

so you start Dynamo programmatically, then you want to get to a state where no script is open, only a blank workspace?

if you are starting Dynamo with a view model you can do: viewModel.NewHomeWorkspaceCommand.Execute(null);

If you only have access to the model, I think you'll need to do something like: model.ClearCurrentWorkspace()

chuongmep commented 7 months ago

Hi @mjkkirschner , In my case, the user opening dynamo include user interface, and what I want is from the Revit Ribbon, I can call another script to automation open with new tab in Dynamo user interface and run it with Code. I don't think it is posible right now but I'm trying to get that process. Thank you for your help.