Basic list management question

I’ve done some searching on the internet and was unable to find the component I am after. What I want to do is select a certain ‘groups’ of lists within lists. Hopefully the attached image will clarify this.

 

<span style=“line-height: 1.5em;”>List In Grasshopper you would select the ‘tree branch’. There must be a similar tool in Dynamo</span>

If you’re trying to select a range of sub-lists of a list, I think the node you’re looking for is List.Slice

2014-06-19_182236

I am not sure if this will respond your question, but just for the case…

If the list of lists is, for example, “GlobalList”, you can get the sublist in the position N (starting in N=0) with GlobalList[N]. So if you want the lists in position 0,1 and 2, all together in a new list of lists …GlobalList[{0,1,2}]. If you want to get that sublist as different elements …GlobalList[0], GlobalList[1] and GlobalList[2].

It is exactly the same if they would be individual elements instead of lists

 

 

 

 

 

Some clarification of my last post…

01

 

So you can give the list of lists a variable name and map its sub lists in whatever order you want. Wow you gotta love the new options with DS dynamo, but dang so much to learn again :slight_smile:

Thank you Eduardo for the great examples!

You are welcome.

I made the example with the variable name “A”. But for sure you can just write in a CBN … PointsList[1]; or PointsList[{0,1,2}]; or PointsList[0…7];

Wow thank you guys! This is exactly what I was after :slight_smile: don’t know why I wasn’t getting notifications from this post however…

I’m seeing this Code Block is quite powerful. So calling ‘A’ calls the ‘group of lists’, would calling ‘B’ let you select items within these groups? Say you wanted the first and third item in each group of lists, would you have numbers 0-2 in ‘A’ and 0, 2 in ‘B’ ? This is hypothetical, i’m not trying to do this just getting my head around possibilities and methods

Great clear posts too!! Thanks again

Hi,

There is a really good introduction to the CBN by Colin McCrone in the blog.

In any case, the CBN is a way of witting DS code, but fully integrated in the visual environment of nodes. Every time you call to a var (called “A” or “WhateverYouWant”) that is not explicitly defined in that CBN , you will have automatically a “IN” connection. Every time you define or create something, you will have an “OUT” connection. That “IN” and “OUT” connections are recognized in real time. It works really well.

And all the methods are the same, doesn’t matter if you use the node or write the code in CBN. So you can do everything using nodes or writing code, and combines both ways all the time. It is really very flexible.

Hi guys,

Great information on list management. I have a problem where I am trying to use the LunchBox Package to Query all the floor plates and, eventually, all walls that I design into my floor plan. Basically I want to extract the top face of each floor plate so I can go ahead with running analysis with Intersection functionality. In the image, each list represents the solid floor plate and the nested sub-list is the faces of each.

The LunchBox plugin also allows to get the edge curves from the floor plate. I tried a lot of different options including to do “Surface by Patch” to get at the top surface.

I understand you can do “Select Element Face” when querying Revit geometry but I am looking for an automated approach to update when I have finished modifying my design. I am working with floors right now to understand the concept, but I want to ultimately be able to work with my walls built in Revit to help trim down my geometry and run intersection analysis for a camera sensor array system. Capture-Query top face of floors

So in the image, I am trying to get the 5th item in the sub-list index without having to flatten the entire list structure to get at the faces I want.

When I get to working with walls, I would want to be able to query just the outside 2 faces of the wall and not the 4 surrounding faces that comprise its thickness.

I posted here because my biggest question is about querying indexed items within a nested sub-list.

Best Regards,
-Tim

I whipped up a quick but potentially time consuming approach to selecting the top faces I want. This also is only selecting 1 face at a time which works for floor plates but will not work when querying a set of surfaces from a Revit wall. Below is my solution. Thoughts?

Capture-Query top face of floors 2

As long as your floor is not offset from the level it was created on, you could use the following:

2014-11-17_134916

However, the boundary lines should be fixed to the plane it was created on and may not be offset together with the floor.

In that case you might need to use some creative ways to filter your surfaces. I’d suggest something along the lines of this:

2014-11-17_134701

 

TopOfFloor

Hope that helps.

Hi Dimitar! Thank you so much. Yes! It works beautifully and definitely helps me to clean up my model process for what I’m going after. I tested out the second combination of nodes through filtering which definitely help me understand nodes I had never used before but I think will be unnecessary this time. Thanks for the quick and effective feedback!

-Tim

Hi All,

One more question from a newbie;) Could someone have a look at what I’m doing wrong with list management?. I’m trying to extract every [0] item from all the sublists of the ‘global’ list, but it’s not working in the way discussed above…

I’m able to get items from one sublist of the ‘global’ list though… Is there a way to get every N’s item from sublists of a list?!

thanks

Try List.GetItemAtIndex

Oh…that’s better;)…Thanks for pointing me in the right direction… Just a small comment regarding this stuff if anyone face the same thing - do not forget to change lacing to Cross Product

cheers