Include binding for Dynamo Player

Hi Everyone, I know this sounds backward but… Is there a way to create element binding for script that runs in Dynamo Player? In order to make some scripts officewide, Dynamo player seems to be a better choice for users. But it does not have binding and creates duplicate elements. Thanks

There is not. Some technical facts:

  1. Bindings are saved into the DYN when you save a graph which leverages nodes which make use of session trace.
  2. Bindings are unique per file and run because the leverage the GUID of the elements created.
  3. Session trace will only store one file’s bindings at a time.
  4. Dynamo Player does not save the graph after executing it.

Because of this DYNs which you want to leverage bindings for need to be managed at the project level, not the office level. The first run bindings will work with bindings for File A, but those bindings will be overwritten when the DYN is executed on File B, and if run a 2nd time in File A you’ll get duplicates because the trace data is lost (and the bindings for File B will be overwritten with the new bindings for File A). As a result you need to have a new version of the graph for each file in every project. A naming structure like rvtName_GraphName.Dyn works fairly well for this, getting more complex as you need.

Also, while DYNs are not saved when run via Dynamo Player, but this does not mean you can trigger your own headless Dynamo for Revit instance which saves the graph. This would have to be custom built, which is no small task but is certainly doable.

Easiest would just be to train users to use Dynamo directly instead of player. Not much of a downside to that, and if they ‘don’t like’ seeing the Dynamo UI, they can always attempt to do the work by hand in the same timeframe.

Alternatively you could hack your own element bindings together and store them elsewhere (either an external file, or in Revit’s extensible storage). Once you have the binding string you can add it to the file in question, but this would have to either be done in combination with a custom version of Dynamo Player, or as a ‘move bindings’ graph which prepares the DYNs in the ‘office wide’ directory for use prior to the user executing the DYN with the newly added bindings. This would be a lot of work.

The last and likely most computationally expensive method would be to add some degree of ‘checking’ to see if there is an existing instance already placed in or near to the newly created element’s location. Something like All Elements of Type > Element.Location > Geometry.DistanceTo(NewLocationPoint) > LessThan(targetRange) > List.FilterByBoolMask(NewLocationPoints) would be a good place to start if you want to go that route. Computationally expensive and that expense scales with the number of uses (vs the expense of writing your own version of player).

Other management tools like Orkestra may enable this as well, but I am not sure if any pull this level of detail.

1 Like

I watched the entirely video on the other post “getting the good stuff out of Pandora’s box: Element binding in dynamo for Revit” it was very helpful. This is a great additional information, thanks Jacob.

1 Like