DYNAMO : Assigning Multiple Parameter Values to Multiple Elements

DYNAMO : Assigning Multiple Parameter Values to Multiple Elements

gautier_vasseur
Enthusiast Enthusiast
606 Views
2 Replies
Message 1 of 3

DYNAMO : Assigning Multiple Parameter Values to Multiple Elements

gautier_vasseur
Enthusiast
Enthusiast

Hello,

 

I’m working on a Dynamo script where I need to set multiple parameters for several Revit elements, with specific values for each element.

 

Example :

I have a list of elements = [element1, element2, element3]
A list of parameter names = [parameter1, parameter2]
A list of values = [[value1, value2], [value3, value4], [value5, value6]]

 

I would like to achieve the following:

  • element1 → parameter1 = value1, parameter2 = value2

  • element2 → parameter1 = value3, parameter2 = value4

  • element3 → parameter1 = value5, parameter2 = value6

 

I’m trying to use SetParameter like this, but I can’t get it to work.

 

gautier_vasseur_0-1754599149370.jpeg

 

On my Set.Parameter, I need as many elements in the output as I have in the input (102).

 

I feel like I’m on the right track and maybe just missing a node.

Thanks in advance !

 

Gautier


LinkedIn GIF

0 Likes
Accepted solutions (1)
607 Views
2 Replies
Replies (2)
Message 2 of 3

RLY_15
Advisor
Advisor
Accepted solution

For some reason the resolution on the screenshot is making the list levels and list counts unreadable, but from what I can gather:

 

1. You have a simple list of elements.

2. You have another list of parameter names with the same list level as (1)

3. You have a list of the values with one additional list level, each sublist corresponding to a parameter from (2). Hopefully the list size of this is (1) x (2) meaning you have each parameter defined for each element.

 

The 'simplest' (meaning you don't care about computational efficiency) way to fix this is to push equal-sized lists into the setparameter node so that you don't actually have to mess with the list levels or lacing method at all. If my assumption in (3) is correct, all you need to do is get list counts for (1) and (2), and either list.cycle or list.numberofrepeateditems the first two inputs until the list size and structure for those inputs match (3).

 

 

What is probably the more correct option is to use Longest Lacing:

 

lacing.png

Message 3 of 3

gautier_vasseur
Enthusiast
Enthusiast

@RLY_15  You are right!

I also tried this combination, but I thought it was wrong because, in the output, I had a list longer than the number of my elements. But actually, yes — in the output, I do have a list with a length of (number of elements) × (number of parameters), where each sublist of elements has a length equal to the number of parameters.

 

Thank you very much!


LinkedIn GIF

0 Likes