List "reduction"

#1

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

  • the list elements above in the picture

in:

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

Thank you in advance !
Anton

0 Likes

#2

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?

0 Likes

#3

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.

0 Likes

#4

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

0 Likes

#5

Use lacing or levels.

0 Likes

#6

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.

0 Likes

#7

This worked for me !

Immagine 4

0 Likes

#8

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

#9

exact. please provide the whole picture when asking questions.

0 Likes

#10

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

0 Likes

#11

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:

0 Likes

#12

I’m studying the example here: Set Wall Compound Layers Function 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).


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 !
Anton

0 Likes

#13

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.

0 Likes

#14

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.

0 Likes

#15

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…

0 Likes

#16

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