Skip to content

Dynamo Command Line Interface

Aaron (Qilong) edited this page Dec 2, 2020 · 32 revisions

  -o, -O=VALUE               OpenFilePath, Instruct Dynamo to open headless and run a dyn file at this path                            

  -c, -C=VALUE               CommandFilePath, Instruct Dynamo to open a commandfile and run the commands it contains at 
                             this path,this option is only supported when run from DynamoSandbox                       

  -l, -L=VALUE               Running Dynamo under a different locale setting

  -v, -V=VALUE               Verbose, Instruct Dynamo to output all evalautions it performs to an xml file at this path

  -g, -G=VALUE               Geometry, Instruct Dynamo to output geometry from all evaluations to a json file at this path

  -h, -H, --help             Get some help

  -i, -I, --Import           imports some zero touch node assembly before running the graph.

  -gp -geometrypath          attempts to load the geometryLibrary(ASM) from this directory.

  -k, -K                     Keepalive mode, leave the Dynamo process running until a loaded extension shuts it down.

  -hn, -HN=VALUE             Identify Dynamo variation associated with host

What

The Command Line Interface (DynamoCLI) is a supplement to DynamoSandbox. it is a dos/terminal command line utility designed to provide the convenience of command line arguments to run Dynamo. In its first implementation it does not run standalone, it must be run from the folder where the Dynamo binaries reside, as it depends on the same core DLLs as the Sandbox. It can not interoperate with other builds of Dynamo.

There are four ways to run CLI: from a Dos prompt, from Dos batch files, and as a Windows desktop shortcut whose path is modified to include the specified command line flags. The Dos filespec can be fully qualified or relative, and mapped drives and url syntax is supported as well. It can also be built with Mono and run on linux or mac from the terminal.

Dynamo packages are supported by the utility, however you can not load custom nodes (dyf) only standalone graphs (dyn).

In preliminary testing the CLI utility supports localized versions of Windows and you can specify filespec arguments with upper Ascii characters.

The CLI can be accessed through the DynamoCLI.exe application. This application lets a user or another application interact with the Dynamo evaluation model by invoking DynamoCLI.exe with a command string. This might look something like:

C:\Program Files\Dynamo\Dynamo Core\2.0\DynamoCLI.exe -o "C:\someReallyCoolDynamoFile.Dyn"

This command will tell Dynamo to open the specificed file at "C:\someReallyCoolDynamoFile.Dyn", without drawing any UI, and then run it. Dynamo will then exit when the graph has completed running.

New in version 2.1: The DynamoWPFCLI.exe application. This application supports everything that the DynamoCLI.exe application supports with the addition of the Geometry (-g) option. The DynamoWPFCLI.exe application is windows only.

Important Notes

  • The preferred method of interacting with DynamoCLI is through a command prompt interface.
  • At this time you will need to run DynamoCLI from its install location inside the Dynamo 2.0 folder. The CLI needs access to the same .dlls as Dynamo so it should not be moved.
  • You should be able to execute graphs that are currently open in Dynamo, but this may cause unintended side effects.
  • All file paths are fully dos compliant so relative and fully qualified paths should work, but be sure to enclose your paths in quotes "C:path\to\file.dyn"
  • DynamoCLI is new functionality and currently in flux: the CLI loads only a subset of standard Dynamo libraries at this time, note this if a graph does not execute correctly. These libraries are specified here
  • currently no std output is provided if no errors are encountered, the CLI will simply exit after the run completes.

Why

You might want to control Dynamo from the command line for various reasons, these might include:

  • Automating many Dynamo runs
  • Testing of Dynamo Graphs (also look at -c when using DynamoSandbox)
  • Running a sequence of Dynamo graphs in a specific order
  • Writing batch files that run multiple command line executions
  • Writing another program to control and automate the running of Dynamo graphs and do cool things with the results of those computations

How

-o /o you can open dynamo pointing to a .dyn, in a headless mode that will run the graph.

    C:\Program Files\Dynamo\Dynamo Core\2.0\DynamoCLI.exe -o "C:\someReallyCoolDynamoFile.Dyn"

-v /v can be used when Dynamo is running in a headless mode (when we have used -o to open a file), this flag will iterate all nodes in the graph and dump their output values to a simple xml file. Because the /s flag can force Dynamo to run multiple graph evaluations, the output file will hold values for each evaluation that occurs.

    C:\Program Files\Dynamo\Dynamo Core\2.0\DynamoCLI.exe -o "C:\someReallyCoolDynamoFile.Dyn" /p "C:\aFileWithPresetsInIt.dyn" /s "all" /v "C:\output.xml"

The xml output file would have the form:

    <evaluations>
        <evaluation0>
            <Node guid="e2a6a828-19cb-40ab-b36c-cde2ebab1ed3">
                <output0 value="str" />
            </Node>
            <Node guid="67139026-e3a5-445c-8ba5-8a28be5d1be0">
                <output0 value="C:\Users\Dale\state1.txt" />
            </Node>
            <Node guid="579ebcb8-dc60-4faa-8fd0-cb361443ed94">
                <output0 value="null" />
            </Node>
        </evaluation0>
        <evaluation1>
            <Node guid="e2a6a828-19cb-40ab-b36c-cde2ebab1ed3">
                <output0 value="str" />
            </Node>
            <Node guid="67139026-e3a5-445c-8ba5-8a28be5d1be0">
                <output0 value="C:\Users\Dale\state2.txt" />
            </Node>
            <Node guid="579ebcb8-dc60-4faa-8fd0-cb361443ed94">
                <output0 value="null" />
            </Node>
        </evaluation1>
    </evaluations>

-g /g can be used when Dynamo is running in a headless mode (when we have used -o to open a file), this flag will generate the graph and then dump the resulting geometry in to a json file.

    C:\Program Files\Dynamo\Dynamo Core\2.0\DynamoWPFCLI.exe -o "C:\someReallyCoolDynamoFile.Dyn" /g "C:\geometry.json"

The json geometry file would have the form:

 TBD - Work in progress

-h /h use this to get a list of the possible options

    C:\Program Files\Dynamo\Dynamo Core\2.0\DynamoCLI.exe -h

the -i flag can be used multiple times to import multiple assemblies which the graph you are trying to open requires to run.

    C:\Program Files\Dynamo\Dynamo Core\2.0\DynamoCLI.exe -o "C:\someReallyCoolDynamoFile.Dyn" -i"a.dll" -i"aSecond.dll"

the -gp flag can be used to point DynamoSandbox or CLI to a specific set of ASM binaries - use it like

    C:\Program Files\Dynamo\Dynamo Core\2.0\DynamoSandbox.exe -gp "\pathToGeometryBinaries\"

or

    C:\Program Files\Dynamo\Dynamo Core\2.0\DynamoSandbox.exe -gp "\pathToGeometryBinaries\"

the -k flag can be used to leave the Dynamo process running until a loaded extension shuts it down.

    C:\Program Files\Dynamo\Dynamo Core\2.0\DynamoCLI.exe -k

the -hn flag can be used to identify Dynamo variation associated with host.

    C:\Program Files\Dynamo\Dynamo Core\2.0\DynamoCLI.exe -hn "DynamoFormIt"

or

    C:\Program Files\Dynamo\Dynamo Core\2.0\DynamoSandbox.exe -hn "DynamoFormIt"

Releases

Roadmap

How To

Dynamo Internals

Contributing

Python3 Upgrade Work

Libraries

FAQs

API and Dynamo Nodes

Clone this wiki locally