Grouping items by boxes and then by layer

Hey there. I am trying to group some items that might be inside of boxes and then group them if they are in the same layer. So far I have been able to group them if they are inside of the same box, but I havent been able to then group them again if they are in the same layer also.

I am using LunchBox for the ObjectAttributes which gives you the layer the item is in.

Sorting by boxes and layer.gh (111.0 KB)

not sure what the upper part was about, this works tho

Hey Rickson! Thank you for the help, but I tried to replicate your solution and it doesnt seem to work at my end. Some breps just get ignored and others get duplicated.

only difference could be the rhino layers.

group items.gh (79.7 KB) Re_group items.3dm (193.4 KB)

I guess it didn’t work because you didn’t assign any layer attributes to the boxes. That explains why the ObjectAttributes - Layer - outputs null.

Sorry if I am doing something obviously wrong but I tried the files Rickson provided and its the same thing. Some breps get duplicated and some just ignored as you can see in this images.

Does anybody know what could have gone wrong here? Its seems to be a simple task of sorting and then sorting again in groups but I cant figure it out.

Thank you

If the box contains the brep it gets branched accordingly, if objects in the first branch are on a layer they are broken out into a sub branch. Best seen in Branch {1;0} and {1;1}

The amount of objects is the same, no breps are duplicated, just passed down stream… into their respective branches.

image

Yes, the number of breps are the same, but some objects get ignored and others get duplicated to fill the previous number of breps.

Could you try to bake the objets from your example and see if this also happens to you? Maybe could be something with my computer but I am almost sure that this is not working.

Thank you!

They wouldn’t get baked on the same layers as you, hence making it up. Post the Rhino file as well.

Hey Rickson! Thanks for the reply, I am using the same files that you provided but once I bake them its the same result where I get duplicates and some breps ignored. Could you bake them in your computer to test this?

Thank you

group items.gh (79.7 KB) Re_group items.3dm (193.4 KB)

11 original object, 11 objects in the tree. I fail to see what you are referring to.

first branch is the boxes, second is the layer, as you indicated.

Yes the numbers at the same but please look at the 3d model. This is what I am getting:

From this.-

To this.-

As you can see in the 3D viewport some items are not there anymore after the bake and the ones that look a lot more opaque are duplicated.

ok. So whats the objective? You have 11 items on various layers you are then dividing by zone then layer (the same layers they are on). You would like these baked how?

In this instance i would probably create an attribute on the Rhino Geometry that say what box its in (1 thru 8) and not bake anything. Really depends on what you are trying to do.

RE RE group items.gh (85.7 KB)

Heres what I am trying to do:

I have a huge model of a building with different layers of floors, ceilings, pipes, etc. All layers have a lot of meshes.

I want to be able to divide the building in small boxes and then merge the meshes that share the same box and the same layer. And then bake these items again into their original layers.

So finally I would have one merged mesh for each box for each layer.
I hope this makes some sense.

So just apply an attribute instead, no need to do any of the baking.

Floor 3 has layers of mechanical [Pipes, Lights, Hvac, Sprinklers], you create a container box for Floor 3, apply that to all (FloorAtt : 03). If you need to sub divide Floor 3 add Floor 3.1, 3.2 boxes and apply that attribute. (FloorSubAtt : 3.1, 3.2). Once attributes are applies you can do what ever is next to the filtered objects.

as so

ReRe_group items.3dm (321.6 KB)