May 30, 2016

Dynamo - Filter by Type Parameter

I created another custom node for my fire/smoke rating Detail Item placement graph, previously discussed here and here. The previous two nodes gave me a list of all of the straight Walls visible in the current plan View, whose Base Constraint matched the level of the current View. In order to apply the correct Detail Item to each fire/smoke rated Wall, that list needs to be filtered, based on the fire-resistance-rating and whether the Wall is a smoke partition or smoke barrier. This information is stored in a type-based parameter for the Wall Types. I needed to repeat this multiple times in this graph, and since it also seemed to me that this was something that will have use in future projects, I created a custom node.

The custom node takes three inputs, one for the list of Elements (Walls) to be filtered, one for the name of the Parameter that is the basis for the filter and one for the value of the Parameter that will determine which Elements are "in" and which are "out".

The filtering is done in a similar way that the straight Walls were filtered, except this time, instead of using the fact that an empty string would be returned as the value for an instance-based parameter that was not present on the straight Walls, the Element Type of each Wall needs to be retrieved, using an Element.Type node, and then the value of the filtering parameter obtained from that by an Element.GetParameterValueByName node. An == (x equal to y) node is again used to generate a Boolean Mask list of trues and falses.

The Boolean Mask list is then used in a List.FilterByBoolMask to put the Elements that match the parameter in the "in" output and those that do not in the "out" output.

The entire graph of the custom node is shown below.

No comments: