@keith.sowinski @FabioDeAgostini I stand corrected. The intention is not to prevent or discourage (custom) node authors to avoid using input types of a certain rank. Empty lists should not be treated any differently than non-empty lists and should be consistent in their replication behavior. The fact that a custom node or function defined in a code block node returns
null for an empty list is in fact a regression from a previous version of Dynamo and we will prioritize a fix for this. The best way to explain what I mean is by way of an example from the older version of Dynamo (2.1.x), in which it worked as expected:
As you can see the above result is what you should
expect. Notice that both the empty and non-empty list return the same structure for the output irrespective of whether they’re empty or not. In other words since the input type is a list of single dimension and we are passing in a list of a higher dimension (2 in this case), the function
replicates over the input to produce 2 items instead of 1. If on the other hand you were to pass a list of single dimension, you would get the single list returned from the function.
To summarize, what you’re trying to do by using
var for your inputs is correct, if that’s what you intend for your custom node; just remember that it will not replicate for a list of rank 1 and will replicate for a higher dimension list. Also note that if you pass an input with a single value, since your function accepts an input of
var the single value will get promoted to a list, which is why you see the single Polyline object returned inside a list of a single item in your example above. Thanks for pointing out the bug!