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.

May 26, 2016

Dynamo - Filter Straight Walls

As part of the Dynamo project for which I developed the Active View Walls at Plan View Level custom node, I also needed to be able to operate on straight Walls and radiused Walls separately. I ended up making a custom node to handle this, to both make the main graph easier to read and so that I could easily reuse the "code" should I need to do this in a different graph in the future.

The graph of the custom node is fairly straightforward, as you can see in the image below. (Click on any reduced-size image to see the image full size.)
A brief description of the various parts and what they do follows.

While my current application passes this node a list of Walls, I decided that may not always be the case in future graphs, so the first set of nodes uses a RemoveIfNot node to strip out any element in the list that is not a Wall.

While poking around in the properties that were available on the Walls in my test project, I noticed that radiused Walls have a parameter called Center Mark Visible, while straight Walls do not. When getting the parameter value for Center Mark Visible, straight Walls will have an empty string value, while radiused Walls will have a value of 0 (center mark not visible) or 1 (center mark visible). I chose to use this as the way to determine if a Wall was straight or radiused. The next set of nodes generates a list of Booleans (true or false) that parallels the list of Walls. The corresponding Boolean will be true if the Center Mark Visible parameter value for the Wall is an empty string (straight Wall) or false if the value is not an empty string (radiused Wall).

The list of Booleans generated by the previous set of nodes is used as a "Boolean mask" by a List.FilterByBoolMask node and applied to the list of Walls to generate two separate lists. The "in" list contains all of the Walls with a corresponding Boolean of true, or all of the straight Walls. The "out" list contains all of the Walls with a corresponding Boolean of false, or all of the radiused Walls.

The in and out lists are connected to the Straight and Curved outputs of the custom node, so that the main graph has access to the two filtered lists. This custom node was developed in Dynamo 0.8.2, but has been successfully used in the 0.9.1 and 1.0.0 versions as well.