A few weeks ago, I took a pause from discussing our plug-in on randomizing curtain walls because Andreas and I entered a hackathon and we wanted to share some information on our project. This week, we’re back to curtain walls and switching gears from the curtain wall grid lines to the curtain wall panels. In addition to randomizing curtain wall panel sizes, we also want to be able to randomize the material.
The first step to be able to change the material of the panels is to get a list of all the options. This is where data type validation comes into play. Generally when you want to collect all the elements of a certain type, you use a filtered element collector. For curtain walls, this can return panel types that, if used, throw an error that they are invalid. In order to avoid this, we want to first get the ElementId of the first panel of our selected curtain wall since we know this is a valid type. Then we can use the GetElement method to retrieve the panel Element and assign it to a variable.
To put together our list of valid curtain wall panels, we use the GetValidTypes method and add these valid types to a list. In our valid panel types, it is possible to have some that aren’t panels for curtain walls. To filter out those, we need to check if the name of the Category is “Curtain Panels.” Once we’ve checked for this, we have a list of curtain wall panel types that can be used to switch out the panels of our curtain wall system.
Now that we have all the types of panels we can use, our next step will be randomizing the panels. Next week, we will walk through how to randomly assign a panel type based on a user entered ratio.