DynamoDS / Dynamo

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

Need Help : How to call Dynamo Player Open to execute Revit API ? #15102

Open chuongmep opened 2 months ago

chuongmep commented 2 months ago

Dynamo Version

3.0

Host

No response

Operating System

Windows 10

What did you do?

I want try automation process use Dynamo Player :

What did you expect to see?

Can't fine any way to implement.

What did you see instead?

Nothing

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

We are trying use Revit API addin

Stack Trace

No response

Details

No response

Amoursol commented 2 months ago

@chuongmep are you trying to use a Graph in Dynamo Player, or trying to use the Player API to create your own addin?

chuongmep commented 2 months ago

Hi @Amoursol , I saw it can call from forma to open user interface of dynamo player, so I just want to know how it posible to use the Player API to create my own addin and execute dynamo script, and then I can connect to forma platform.

Amoursol commented 2 months ago

Ah, understood! @saintentropy @twastvedt any insight you can provide to @chuongmep here?

twastvedt commented 2 months ago

Hi @chuongmep! Are you building an addin in Revit, Dynamo, or Forma? Is the goal to run a Dynamo graph in the Revit context from Forma?

chuongmep commented 2 months ago

Hi @twastvedt , that is Revit add-in can intergrate with Dynamo, my process is intergrate from :

twastvedt commented 2 months ago

OK! Some thoughts: You can do a lot with pyRevit, including starting Dynamo and running a graph. Here's some discussion on that topic: https://discourse.pyrevitlabs.io/t/how-to-execute-a-dynamo-graph-inside-a-python-script/1742/4

Relay allows you to add a button to the Revit ribbon that runs a Dynamo graph. Maybe that's what you need, or it's open source and you might be able to learn from what it does. https://github.com/johnpierson/Relay?tab=readme-ov-file (the part that starts Dynamo is here) Discussion: https://forum.dynamobim.com/t/relay-for-revit-adding-dyns-to-ribbon/55566?u=jacob.small

Orkestra has capability around sharing Dynamo scripts, if that's the end goal

chuongmep commented 2 months ago

Thank you @twastvedt , I think I'm done with first step to open dynamo player now :

 RevitCommandId commandId = RevitCommandId.LookupPostableCommandId(PostableCommand.DynamoPlayer);
                       commandData.Application.PostCommand(commandId);

Nexte step with me is how to add default path setting for folder in Dynamo Player ? image

twastvedt commented 2 months ago

Hi @chuongmep , sorry for the delay. What version of Revit and Dynamo are you using? Up to Revit 2023, that setting is in %appdata%\generative-design-client-2022\AppSettings.json. Starting in Revit 2024 the default folder is set in Dynamo's settings file, at %appdata%\Dynamo\Dynamo Revit\<Dynamo version>\DynamoSettings.xml.

chuongmep commented 2 months ago

Thank you for you help @twastvedt, it really useful for me to keep continute grow the ideal !