Matteo Cominetti is a design technologist focusing on BIM, VDC, parametric design and open standards.

Handle Variable Input List Length Nesting In Custom Dynamo Nodes

Some custom Dynamo nodes need to handle inputs and outputs of variable nesting length. In python this can be done using var[]..[], but how to do it in C#?

To achieve this on the output of a node it is very easy as it’s done automatically when using the MultiReturn attribute, see the docs.

On the inputs, instead, the secret is to use the [ArbitraryDimensionArrayImport] object item attribute, see a sample node.

public static IList AddItemToEnd([ArbitraryDimensionArrayImport] object item, IList list)
            return new ArrayList(list) //Clone original list
                item //Add item to the end of cloned list.

Thanks to Peter for revealing this!

comments powered by Disqus