Element.SetParameterByName is interpreting the list as a single item rather than as multiple values

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:

  1. 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.
  1. List Levels:
  • I tried setting List Levels in Elements.SetParameterByName as follows:
    • elements input to @L3
    • parameterName input to @L2
    • value input to @L3
  • Despite this, the values still weren’t applied as expected, and it didn’t resolve the issue of one-to-one mapping.
  1. 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.

can you post at least a screenshot so we can which is connecting to what?

Sure, I modified my post


you don’t need to create a List, check the logic of my example, so basically when vector is equal to 1, set the parameter to the left, else, set to right. Modify it according to your needs.

1 Like

Curious as to why you are adding the door instances/elements to the code block list of door orientations? Seems that if you just feed the door orientations straight into the “Value” input of the Set Parameter node and set the lacing to Auto or Longest, it should work. If not, then flatten the list of door orientations down to a single level to match the list of door elements, but still use either Auto or Longest lacing on the Set Parameter node. In either scenario, you shouldn’t have to do anything with the levels.

1 Like

Thank you for your answer! The script is running now, and I really appreciate your help with that.

However, I’m encountering an issue where both doors are being assigned the same value, “Right,” even though they are facing different directions. I tried addressing this by adding an additional check on the Y vector, but unfortunately, that didn’t resolve the problem.

I assume that a node “FamilyInstance.FacingOrientation” doesn’t identify directions correctly. Do you have any suggestions how to change a script to make it work?

i’m assuming that door in question is flipped, you can investigate in on revit lookup, if it is, i’m not sure, check if there is a node for that on family instances and study how the logic should go

Hi another way maybe…

Revit_keCgMIUyMK

1 Like