Skip to main content

Dynamo Nodes [BETA]

caution

The VIKTOR Dynamo nodes are currently in BETA, which means we reserve the right to make breaking changes without providing an upgrade strategy.

VIKTOR offers a Dynamo library for easy drag-and-drop of custom VIKTOR nodes within Dynamo. The functionalities of these nodes strongly resemble the functionalities of the viktor.api_v1 module and can be used to communicate with certain entities that are present in a workspace of a VIKTOR application.

Installation

The VIKTOR package can be installed through the Dynamo interface:

  • In the toolbar navigate to "Packages > Search for a Package..."

  • In the search bar type "VIKTOR"

  • Find VIKTOR (by viktor.ai) and click on + Install to install

After the package has been installed successfully, you will see "VIKTOR" has been added to the Add-ons in the library bar:

Implementation

The starting point is logging in to VIKTOR using the Login.login node. This requires three input text nodes consisting of your username, password, and environment which you want to connect to. The login method returns an Environment object. With this object we can select the workspace of interest. This is done using the Environment.SelectWorkspace node, which triggers a dropdown menu with the available workspaces. In case the environment consists of a single workspace, this will automatically be selected.

Alternatively, you may store your credentials in a separate file. This way you will be able to share dynamo projects amongst colleagues without sharing personal credentials:

The Environment.SelectWorkspace method returns the Workspace object. The next step is to obtain the root entities using the Workspace.GetRootEntities node. The root entities are returned as a list of Entity objects. This list can be passed to the Workspace.SelectFromEntities node, to trigger another dropdown menu. After selecting the entity of interest, properties such as the entity name or last saved params can be retrieved, or you can obtain different entities such as the children or siblings:

The example above displays the general flow of the VIKTOR Dynamo nodes. See Available Nodes for an overview of all the nodes and the actions that can be performed.

caution

Dynamo will only re-execute nodes that have been subjected to a change in input. When, for example, an entity has been updated in the VIKTOR interface, this will not automatically be detected by Dynamo. For such cases, you will need to manually trigger a complete rerun, for example:

  • disconnect the nodes Login.login and Environment.SelectWorkspace
  • click "Run" to trigger an entire rerun
  • reconnect the two nodes
  • click "Run" to trigger an entire rerun

Available Nodes

Login

Environment

Workspace

Entity

EntityType

EntityRevision

Limitations

The Dynamo package has a couple of limitations in contrast to the actual viktor.api_v1 module:

  • Not able to perform "privileged" API calls to bypass user access restrictions.
  • No deserialization of params, which means that the params are returned as raw data. For example, a GeoPoint will be returned as dictionary containing a lat and lon property, an Entity will be returned as integer (entity id) etc.
  • Less efficient (no caching). For example, an API call is performed to get the params of an entity for each single LastSavedParams node.