Applying Parameter Values Through Nested Lists

Capture

 

 

 

 

 

 

I think I’m along the right lines but probably missing a function or two. To explain what I want I have my initial watch node which is producing a list of elements in my Revit window grouped together by their Z axis. As a result each sublist could range from how many elements are within it. In the watch node there is a total of 27 groups. Within each of these is a collection of Revit Elements with the parameter Number already embedded within. I have created a sequence of 1-28 which I then want to apply to each element within the corresponding group. So the first three elements in group 0 are assigned the value 1. The next four elements in the next group (1) are assigned the value 2 and so on. With the method pictured it seems to apply the values 1, 2, 3 to the first three elements and then for the next four elements starts again at 1, 2 , 3, 4.

I see two ways of doing this currently… embed the index you want to look up in the list.

[0,familyinst,familyinst,familyinst]
[1,familyinst,familyinst]

then extract that number and go lookup the right value

Or use IndexOf inside a custom node to lookup the index of the thing we’re currently iterating over while mapping, then go use that index to go look up the right value to set number to.

There might be something better.

Actually, will this work for you, you can leave number set to constant, set element parameter will be then function you’ll lace with?Screen Shot 2014-08-07 at 6.31.27 PM

I tried the latter but it doesn’t seem to apply the value to the parameter? Can you explain what you mean by your first method a little more or show me? Thanks

Capture

switch the order of your input lists into the lace node. It will input the first list into the first input top to bottom.

CaptureI have tried them the other way round but it still leaves the parameter empty? We are so close ha…

I’d try the following:

-count the items in each sub list

-create a number sequence and repeat each number by the sublist length

-flatten the elements into a big list

-apply the repeated number sequence to the elements

2014-08-12_173633

 

 

 

 

 

 

Please note that I’m converting the numbers to strings only because the daily version of dynamo doesn’t want to apply numbers to the “Comments” parameter.

Also note the lacing on your List.Cycle node.

Hi,

Unfortunately I cant count the amount within each sublist manually as this would take an age, and the number varies within each sub-group. I want this be calculated automatically to allow my script to work simultaneously.

But it is counted automatically - that’s what the List.Count node is there for :smiley:

Done! This is how…

Capture

Hey Mark, can you edit your post and try to link to the original image, I can’t see and want to know how you solved it!!!

I feel like the workflow I gave you should also have worked so it may be a bug you found as well.

Capture

Hi Michael, hopefully you can see this one? I had to use a the cycle node through the lace node. I think you misunderstood what I was trying to achieve at the start. If you can see the image it will probably help you understand the result I required.

M

Thank you for this solution – just what I needed!

Great!

Thanks a lot,

exactly what I needed.

Seems I have to read the primer about advanced list stuff again (and again)…

Already solved, but putting forth a solution with replication guides as well for reference.

Delme

Hi there, I’m having a similar issue, and thought this would solve it, but the elements I’m working with are walls, and the element.setparameterbyname is coming up null. I’ve had issues with walls because they’re system families, not working with some of the regular widgets that work on all other families. I’ve had to download custom widgets to deal with that, am I looking at the same problem here?

ver 1.0