Select Model Elements node doesn't always return a list


I’m using the ‘Select Model Elements’ for the user to select some objects which I then process using a Python node.

The problem I have is that the node does not produce consistent results.

It outputs a list of elements when multiple elements are selected, but if only one object is selected then it outputs a single object, no list.

I’m not been able to detect the difference between the two outputs and so my Python code fails if either single or multiple objects are selected depending on which type my code handles.

What I’d like to do is analyse the output of the node and then deal with it accordingly - and I would use the Type() function to do this.

But I’ve not been able to get this function to work in a Python node - it returns an error (I get IronPython.Runtime.Types.PythonType).

Any ideas?

Images/sample files or it didn’t happen Kevin. You know the rules.


@Kevin.Bell If you don’t know the rules. Read this.

How to get help on the Dynamo forums

1 Like

Hi Kevin,

This is one of those problems where the result would strongly depend on the implementation. That’s why the others have asked for more info. Many of the big name Dynamo packages solve this in one way or another, that furthers their needs and style.

For example here’s the elegant and simple solution used by clockwork and steam nodes:

Try it out - it might be exactly what you need.

Dimitar - that is exactly what I need, thanks.

I didn’t post a picture of the node as it was so simple, select model and then watch. Nonetheless, I note the rules.

Strange that the Select Model Elements produces two types of results, it would make life easier if it was consistent…