Removing extra sublist in Dynamo

Ethan asks:

I am stuck at what seems like a pretty trivial point wherein there is an extra sublist level that is preventing a proper export of quad points. Basically, I create a list of points based on the intersection of gridlines on a surface. The “Geometry.Intersect” function creates a three tiered list with these points where each point is a [0] index value point within a list. As such, I just want to move all of these [0] points up a level so that there are only two tiers within the list (essentially I want to flatten from the inside as opposed to the outside). These seems like a relatively simple operation, but I haven’t come across a fix after perusing around a couple blogs.

If this is not possible, another alternative is pull out each set of quad points, flatten them, then recombine into a list (similar to the screenshot attached). Is there an easy way to use a loop to do something such as this? I’ve attached my dynamo file and the reference surface in case that helps.

ReferenceSurface

DesignExploration-Spiral-Ordered

image

Hello Patrick Tierney,

I am not sure I fully understand what is the exact output from List.Create from your case as its preview is not expanded.

But on my understanding for Placement fo Adaptive Component, you are looking for a sub list consists of FOUR Point and right now you are getting those FOUR point but in 2D array form.

See if below solution works for you.

Thanks,

Ritesh

FlattanList

have you tried passing a Flatten node through a List.Map?

exactly what Ritesh proposed. My bad I didn’t read the whole response. It started with “I am not sure I understand…” …Ritesh had the right solution.

CaptureI am trying to remove a middle tier of lists indices. Right now I have 3 tiers, and I want to get rid of the second. When I pass at flatten node through a list map. It collapses the 3 and I get a long string of points where as I would like to keep them in groups of four.

cca

You can pass them through list.map and then use list.chop to re-group them into 4s?

Hi Chris,

As with most things in Dynamo, you’ve got multiple options to do this. “List.Flatten” with an amount of “1” is the generally accepted one. You could also try to extract the nested list with “List.GetItemAtIndex” and use an index of “0”.

2015-06-05_10-58-51