Loop structure for Set Parameters

Hi everyone,

 

What I have: I have a script that reads the data of an excel file, each row is a different parameter. Then, the data is written in Revit by matching each parameter (row index) with the equivalent parameter in Revit. This works perfectly.

Problem? Imagine that I want to set 300 parameters (300 rows), I have to define “element set parameter” nodes for each row? for the 300? (see the image e.g.) There must be an easier way for sure but I’m still a dynamo rookie.

I thought using a loop structure (something like “for 1 to 300” or “while ==”), so in each excel row(iteration) searches for the equivalent parameter name in Revit and if it is true (if ==), it sets the parameter for that position.

From what I haver searched, there are two ways to have loop structures: “loopwhile” or “list.map” nodes.

Can someone give me some guidance in this?

 

Best Regards

dynamo_script

Would be better if you attach the file. Unable to read anything in the attached image.

Here are the files:

Excel test_forum

Dynamo Teste_VC_forum

 

I don’t have any loop structure, my goal is to find way to set 30 or 500 different parameters without having to place and define so many element set parameter’s nodes.

Thanks!

Oliviera, the attached image and script describe a possible way to cycle through a set of multiple parameters for multiple elements, in your case family types parameters. You will need to keep a sharp eye on your indices and make sure you are driving the correct parameter value to correct element. In my example I used the “List.Combine” node which is basically "List.Map"s big brother. I was unaware of “List.Map” and “List.Combine” for ages, so I hope this helps you avoid the pain I went through. Set muliple Parameters Set multiple parameters

1 Like

Thanks Neil for your reply.

Is exactly that what I want but I would like also to add a structure between the “data to write” (from an excel file) and the “List.combine” node which allowed me to search for the correct parameter and match it with the parameter name from Revit.

Imagine that I have a list of 100 parameters from an excel file and I want to set just 20 parameters to Revit. So, I have some node(s) that searches for these 20 parameters in the excel list and set their values to the correct places. I don’t want to do this having the parameter in the correct index of the excel file, instead I want to have some node that runs: “if” both parameter names (excel and revit) are the same, it writes its value to Revit, if not it goes to the next index (from index 0 to the index 100).

Is this possible?

(tip: I think that the “NullSetParameter” node can be useful.)

Cheers!

I found a way to accomplish this using the “dictionary.by keys values” node.

 

Best Regards

1 Like

Hi Oliveira,
Can you share the solution to your problem? I haven’t used the “Dictionary.byKeys” node yet.