I often use the Dynamo Sandbox environment because then I don’t have to open a host application, which saves time and resources. One disadvantage I always had with this was that I couldn’t run scripts without having to open my Dynamo Graphs itself, like the Dynamo Player.
In my quest to reduce my number of clicks, effort & time, I came across a very handy feature of Dynamo that many people probably do not (yet) know. At least I didn’t! :
The Dynamo Command Line Interface
The Dynamo Command Line Interface (DCLI) is a functionality of Dynamo which opens a broad way of possibilities to easily run Dynamo scripts, and even run them in Batch, without having to open Dynamo itself.
I have created a script which creates .scr-files such that the End User doesn’t have to rewrite the code everytime, (and they probably also don’t know how ). Before the only way to run this script was to open the Dynamo Player, open the entire script and press “Run”.
When we use the DCLI workflow, all I have to do is run a .bat file that is on my desktop and the script runs itself!
How to create this .bat-file?:
For this .bat file, we actually only need three components:
- The location of the DynamoWPFCLI.exe (found in the same folder as the DynamoPlayer.exe.
- The command “-o”, this will open Dynamo in a headless variant (see the GitHub like for a more indepth explanation).
- The location of the Dynamo file to be executed (between double quotes: ").
When you have done this correctly, it should look something like this (one line):
C:\Users%USERNAME%\Downloads\DynamoCoreRuntime2.10.1\DynamoWPFCLI.exe -o “F:\Dynamo\Dynamo Onderzoek 4 - Multiple DWG Interaction\07. AutoLISP insteek\Dynamo Scripts V2.0\LISP scr Creator V0.2.dyn”
Save your command line to a .txt-file and rename this to a .bat-file and you’re done!
When you now double click this .bat-file it automatically opens the Windows Command Prompt and runs the Dynamo Graph in the background. I also tested this workflow on a Graph which contains Data-Shapes nodes and they also seem to be working properly:
For further reading into the functionalities I highly recommend checking out this GitHub page.