Replace all items in sublists at index X

It seems like this should be easy, but I’m stumped. I’d like to replace the value at index 2 for each sublist with values from another list. The quantity of index 2s (11) matches the quantity in the other list (11).

I’ve tried the Replace Item at Index node, and several other things too. Any suggestions?

image

Hy cjg63C47!

I would get element at index 0 and 1, then List.Create from the three list (0, 1 , 2-newValue).

So first make a [PL-1A, LP-1B, LP-1B, …] list and a [3, 21, 24,26, …] list
and then make a new list with the three values in the right order with List.Create node (hit the “+” for the third Input)

and you need a list Transpose too

Good point. I actually did something similar as shown below. However, there’s a problem: The first list (with the sublists) comes from electrical circuits. The other list comes from mechanical equipment. I want to push the values from the mechanical equipment list into the Load Name parameter in the circuits. But I can’t get them to jive with each other. It’s writing the equipment tags to the wrong circuits.

This pic below shows what I’m trying to do. For example, I want dynamo to copy EF 03
to the cell it’s pointing to, which is the Load Name. As you see, it’s not matching the right equipment tags to the correct circuits.

Actually, it’s more than copying and pasting. As you can see with “HWP 01, HWP 02”, I’m concatenating equipment tags before pasting them into the Load Name parameter. As you see here, “HWP 01, HWP 02” got pasted into the wrong circuit; the load name for this circuit should say “EF 03”.

image

Actually, it’s more than copying and pasting. As you can see with “HWP 01, HWP 02”, I’m concatenating equipment tags before trying to paste them back into the Load Name parameter.

It’s not a problem, everything is possible in dynamo :slight_smile:
You had a problem on the top and there’s a solution under that.
As far as I can see, you showed another list problem at the second pic, but I can help you, just show some simple paint arrows or with a written list that you would like to create.
From there, you can set values in many kind.
Just show what would you like to create and from where in dynamo.

I did as you did, below. It still isn’t matching the correct equipment tag values with the correct circuits. Need to find some way to get these matched up.

I can get both lists lined up by sorting by panel and circuit (those two parameters are common to both the equipment and the circuit). But obviously i’m doing doing something wrong.

So you only need the index 2 values in the List.Transpose list?
And your problem is, that when you load them up in the elements, there is no match?

This is how I got the equipment tags listed in the same order as the electrical circuits. Index 0 is a concatenation of the panel name and the circuit number.

yes, index two, as you said.

And yes, those index 2 values need to match up with the correct electrical circuits, so it can give it the correct Load Name.

You have to keep the same order, to dynamo put them in the right place.
You can choose head, or tail as well.
Like make the same order at the end to match at the beginning, with GetKey node and FilterByBoolMask combo.
Electrical circuits are not my field - I only see data and lists :slight_smile: But if you show with Paint (or by writing down a sample aaa bbb ect lists) the start and imagined end list order, than I can help you.

OK i’ll try GetKeyNode and Filter by Bool Mask combo. I’ll see what I can do. Thanks for these tips - I’m obviously floundering…

The fact that we are dealing with two different Revit elements (mech equip and elec circuits) is what makes it tricky.

The start of the road can be rugged.
But if you know the destenation, the forum can help with the midlle part

You have to find a parameter or something, that can match the two element type lists. From there it’s only List Magic :slight_smile:

Right. Both objects have the parameters Panel and Circuit Number. Need to figure out how to marry them together with that info. And need a little more Dynamo pixy dust.

I got it! The magic node to bridge the divide was Dictionary.SetValueAtKeys. Thanks.

image

1 Like