December 25, 2017

Dynamo: Selecting All Curtain Walls

An opportunity to use Dynamo to create a string with which to tag Curtain Walls came up in a thread in the AUGI Revit Architecture - Families Forum. The first task for the Dynamo graph is to select all of the Curtain Walls in the Autodesk® Revit® project file. The All Elements of Category node, in combination with the Categories node, is the usual method for selecting all objects of a particular category in a project file, but there is no Curtain Walls category; you have to choose Walls as the category, and you get all of the Walls, including Basic Walls, Curtain Walls and Stacked Walls.

Thanks to the Filtering / Selecting Curtain walls thread in the Dynamo Forum, in particular, the third post by thread initiator Aseem Deshpande, I was able to use a modified version of what was shown in that post to generate a list of just Curtain Walls from the list of all Walls. (The code posted by Aseem Deshpande sought to remove the Curtain Walls, leaving only "opaque" Walls.) I too had used the Element.Parameter node to examine the available parameters and noted that the Family parameter held the information I needed to determine if a Wall was a Curtain Wall. Unfortunately, I also found that the Element.GetParameterValueByName node was returning the Type name, rather than the value of the Family parameter. The nodes in the post provide a way to make use of the Family parameter value to determine if a particular Wall is a Curtain Wall.

In the image below, the list of all Walls generated by the nodes in the image above, is fed to both the Element.Parameters node and the List.FilterByBoolMask node.
The Element.Parameters node takes the list of all Walls and creates a list of lists; each sub-list contains a list of the parameters attached to each Wall. The Parameter.Name node takes the list of lists of parameters and converts each parameter object to a string of the parameter name. That list of lists of parameter names is then fed to the List.FirstIndexOf node, which outputs a list of the index of the first occurrence of the string "Family" in each sub-list.

The List.GetItemAtIndex node takes the list of parameters lists and the list of indexes of the Family parameter to create a list of the Family parameters. The String from Object node converts each item on that list from a parameter and its value to a string. A code block then tests each string to see if it is equal to "Family : Curtain Wall", which is the value that will be present for Curtain Walls; the output is a list of True or False values, True representing Curtain Walls and False representing Basic or Stacked Walls. This list of Booleans is used as the mask input to the List.FilterByBoolMask node, and is applied to the list of all Walls. That node generates two lists, the "in" list contains all the "Trues", or Curtain Walls, and the "out" list contains all the "Falses". The "in" list is what I needed for the balance of that graph, a list of all of the Curtain Walls in the Revit project.

1 comment:

Rob Cross said...

Favour,

Would it be possible to post up the Dynamo Script?

Thanking yo in advance

Rob