I’m working on a script that assigns colors to elements based on their level. Depending on the category, the level is stored in different parameters.
For example:
For Walls, I need to get the value of the Base Constraint parameter.
For Structural Framing, I need to get the value of the Work Plane parameter.
I have gathered all elements from these categories (Walls and Structural Framing) and connected them to the Element input of the Element.Parameter node. I also connected the two parameter names to the Parameter input.
However, the output is not correct. I suspect this is due to a list structure mismatch. I need to get the Work Plane value only for Structural Framing elements and Base Constraint only for Walls.
Could someone advise on how to properly handle this so each category uses the correct parameter?
First, when assigning the parameter name, you included quotation marks around “Workplane”, which caused the component to misread the parameter name.
Second, beams use the Work Plane parameter, while walls use Base Constraint.
To resolve this, I grafted the input so that the data structure aligns correctly for each element type.
@MSAwan
That solved the problem, thank you!
However, I noticed that for Structural Framing elements, there are two possible parameters indicating the level: “Work Plane” and “Reference Level”.
In some cases, one of these parameters is either empty or not available, so I get some null or empty values when I use only one of them.
I now need to figure out how to retrieve either “Work Plane” or “Reference Level” — whichever is available or filled — for each element.
Here’s a new version of the revit file in which you can see what I mean.