List "reduction"

Hi everybody,
I’m looking for a method (flattening ?!?!) to convert:

  • the list elements above in the picture


  • a list with single selected elements (same format of the bottom part of the picture)

Thank you in advance !

Immagine 3

If you only want one specific element, why dont you then select only that one element?
What should then be the purpose of selecting several elements?

You can use List.Chop to chop the single list of two elements into two lists of single elements but I’m not so sure that’s what you’re after. If you’re wanting to have an individual element, not a list, you’ll have to have a node (or code) for each element.

Hi @erfajo I’m trying a script who accept the “single element selection format” but I’ve a list.

Use lacing or levels.

Then share the graph (or script)… so we all can see what the purpose should be. There might be a better answer that could solve the problem, instead of retrieving one element at the time.

This worked for me !

Immagine 4

That’s great but realize this only works for a static number of elements and really isn’t the best option for your case. It’s hard to tell what your exact issue is without seeing your whole graph.

1 Like

exact. please provide the whole picture when asking questions.

It’s very big and confused, I’ll try to make a clean screenshot :sweat_smile:

Zoom in on a few nodes, use the camera upper right inside dynamo.
Try also to describe what your purpose is, then there might be solutions to your problem you didnt think existed…

Many of us are here to help :slight_smile:

I’m studying the example here: that basically requires element types to run a Python script.
The example is referred to walls.
By means of the following script I create several family types duplicates (using an existing wall type as starter element).
Immagine 7
The output (highlighted in red) is the previously mentioned list that I have to “convert” to a sequence of single elements types.
The method of @Nick_Boyts works !
Thank you again !

It looks like you can “filter” the list by the wall type name. That way you will not get your items in a static way.
Home.dyn (10.0 KB)

However, without having the full picture there might even be more that could be optimized.

Your referred link is about compound layer structure. If you need to change all the duplicated walls, you would not be interested in splitting the list, it would be better to pack all the structures in a list and then use them on the list of walls you have by now.

Share your entire graph (also as a dyn file) if you want more help.

You could even do it more efficient… If you get your new types from a excel file, you also have the names. Since you have duplicated them, they are avalible without filtering anything.
Home2.dyn (7.5 KB)

But still, this might be unnecessary if we knew the whole picture.

hi @erfajo thank you very much !
yes I do not need to split the list… it’s a dummy way to solve my problem because I’m not able to modify the python script :sweat_smile::sweat_smile::sweat_smile:

As you can see in the post about the walls just one wall is accepted by the script , so I have to modify the code block but it’s too difficult for me…so I’m splitting the list…

share your entire graph… also as a dyn file.
it is much easiere to help someone if you have the whole picture :slight_smile:

1 Like