Dynamo Issue: Setting Nested Parameter Values for Multiple Elements
Context:
I’m working in Dynamo to set parameter values for multiple Revit elements. Specifically, I have a list of door elements, a list of orientation values (e.g., “Left” and “Right”), and a list of parameter names. The challenge is that my data is structured in a multi-level nested format, and Dynamo’s Elements.SetParameterByName or Element.SetParameterByName nodes seem to struggle with interpreting these nested lists correctly. Here’s a summary of the structure:
Data Structure:
- Door Elements List: This list of door elements (elements) is three levels deep (
@L3
). - Orientation Values List: This list of orientation values (values) is also three levels deep (
@L3
). - Parameter Names List: The parameter names list (parameterName) is two levels deep (
@L2
).
The goal is to set each door’s Door Orientation parameter to the corresponding “Left” or “Right” value. The problem arises when trying to map these lists together in Dynamo due to their different levels of nesting. I have over 140 doors, and I want each door to receive only one corresponding orientation value.
What I’ve Tried:
- Flattening and Lacing:
- I attempted to flatten the lists and set lacing to Shortest in Elements.SetParameterByName. However, this either resulted in all values being concatenated into one long string or only one value being set across all doors.
- List Levels:
- I tried setting List Levels in Elements.SetParameterByName as follows:
- elements input to
@L3
- parameterName input to
@L2
- value input to
@L3
- elements input to
- Despite this, the values still weren’t applied as expected, and it didn’t resolve the issue of one-to-one mapping.
- Workaround Attempts:
- I explored using List.Map and List.Combine with a custom function in a Code Block, but encountered issues where Dynamo didn’t handle the nested structure properly or applied all values to each door instead of matching them one-to-one.
Example of the Data:
- Elements List (3 Levels):
[[[door1], [door2]], [[door3], [door4]]]
- Parameter Names (2 Levels):
[[parameterName], [parameterName]]
- Values List (3 Levels):
[[[Left], [Right]], [[Left], [Right]]]
Question: How can I set up Dynamo to interpret these nested lists correctly and apply each orientation value to its corresponding door in a one-to-one relationship? Any insights into handling multi-level list structures for setting parameters would be greatly appreciated.
Tools Available: I’m looking to solve this within Dynamo without resorting to Python if possible, as I want a more native solution using Dynamo nodes.