Empty lists after List.FilterByBoolMask in custom node

Hi everyone!

First post over here.

I’m doing some testing about create ‘custom nodes’.

In my daily work I often need to filter Revit model elements from a parameter value. I know it’s a very simple task that only requires the use of Element.GetParameterValueByName, String.Contains and List.FilterByBoolMask nodes.

But, for learning reasons, I’ve created a custom node with the following structure:

When I perform tests with the custom node in a script, I find that the output are lists than contain empty lists.

If I place a List.Flatten after the output ports I get a cleaner list:

But, if I add List.Flatten inside the custom node it doesn’t work: I get empty list structure again.

Any help?


Hello Javier

Change the input nodes in your custom node:

1 Like

Thanks Nico, it’s works!

Do you know why it doesn’t work if I add ‘datatype’ and ‘default value’?

Hello Javier

I just know that it don’t work the way you want when you add : Revit.Elements.Element = null

I don’t know the reason off this. Probably people like @jacob.small, @Jonathan.Olesen or @Kulkul understand it better then I.

@javiersmp - I’d have to test, but I believe it’s because you’re mixing data types. null isn’t the same as "" or a Revit element after all. That said I’m also having issues with Revit.Elements.Element in design script in 2.x due to some aggressive namespace collisions in a few packages I have installed, so it’s going to be awhile until I can test (removing the offending packages breaks a much customer work flow in a VERY bad way, and I don’t want to take chances after so much work has gone into the process).

As such you may want to try testing yourself and letting us know what you find. Start with maintaining the null default on one of the string inputs but clearing all the rest. Record your results. Then try changing the value to an empty string "", and record those results. Then try the same with just the Revit element… you get the idea. :slight_smile:

Also, ALWAYS use well labeled outputs and input hints in custom nodes (prefix the values with a comment). This will save you headaches in the future.

1 Like