Element.SetParameterByName with 3 lists


#1

Hi all,

I’m trying to use the Element.SetParameterByName node with the following three lists:

  1. the first list with the elements (walls in my case), this is a one-dimensional list;
  2. the list with parameters: each element gets its own list of parameters, so this is a two-dimensional list;
  3. a list with the values to set: each element also gets its own list of values to set, so this is also a two-dimensional list.
Here are some examples to clarify:
list one (elements):
   [0] element 1
   [1] element 2
   etc.
list two (parameters):
   [0] List:
      [0] parameter 1
      [1] parameter 2
      etc.
   [1] List:
      [0] parameter 1
      [1] parameter 2
      etc.
   etc.
list thee (values):
   [0] List:
      [0] value 1
      [1] value 2
      etc.
   [1] List:
      [0] value 1
      [1] value 2
      etc.
   etc.
The image attached might also clarify. In this image it doesn't look like the parameter names nor values vary, but this will have to be possible. That's why I chose to define those parameter names and values for every element in the first case.

How would I go about setting these parameters to the elements, because the Element.SetParameterByName node doen’t take 3 lists. I’ve tried different lacings, transposing lists, making a for loop in a code block (which I failed at), making a Python script with a for loop (which didn’t work as expected). Can anyone help me with this?

As I said I tried using a for loop in a code block, but it says the variables aren’t yet defined which I don’t understand. An image of this code including the error is attached.

Thanks in advance.

Marc


#2

Seee if this works for you


#3

Marc,

Your script works fine, except for the null values. I can´t fix it, sorry.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

As Vikram has shown, the replication guides are very powerfull.

Regards.