Set Parameter Depend on the Levels with Dynamo

Hi, I try to do set parameters for the structural columns automatically depend the level. For example I want to do like this :

Parameter Name : Columns Id
–if column which is the Level 1 for example that gone like Columns Id: C101
–if column which is the Level 2 for example that gone like Columns Id: C201

I try to solve this problem with dynamo. I can add parameters to all column but not depend the levels.
I can do level 1 Columns Id: C101
Level 2 Columns Id: C108
Can you help me ?

Please send a screenshot of your graph (use Dropbox or similar if you are not allowed to attach files at the moment)

You could take a look at Element.FilterByLevel (Chynamo package) for instance. If you double-click on it, you will see how it is build. See also here:

I think, the answer is depend on the python script. Your post didn’t solve the my problem.

Please illustrate what you say with a screenshot.
See this optionally:

Try this:

  1. List.GroupByKey, where the list are all the columns and the key is their level. This will produce a list of lists of columns by their level.

  2. Then a list.SortByKey where the list is the groups of columns and the keys are the keys output from the group by key node.

  3. You can then set a list of prefixes using the keys output and a sequence node.

  4. Next join the prefix with the suffix (the 01 part).

  5. Lastly Element.SetParameterValueByName with some levels and lacing set to longest will finish this off.

You may want to look into sorting them or otherwise picking a suffix logically.

1 Like

Can you explain with dynamo pictures please ?

This is precisely what you should do. Please show what you tried instead.

Unfortunately I have to work.

what about then ? I am sorry I dont understand. I am rookie with dynamo.

@asistolia23 Like @jacob.small said, Group your list of columns with their level as the key. So you need to get the Level of the elements, and connect the list of the element’s levels to the keys input on the List.GroupByKey node. You can get the elements’ level with the Element.GetParameterValueByName node.

You have to feed in a key as well as a list… see the dictionary for specifics on how to use the group by key node:

In your case you need to get some parameter values - the level - from the elements to create the keys.

Sort by key works similarly but the keys will be the unique keys from the group by node and the list will be the groups from the group by node.