I'm trying to understand Geometry Nodes in 3.0 by doing my own modular generator where instances are being generated from a simple base mesh object (see image above) that is then put through a Remesh Modifier using Blocks (see remeshed object below that creates several instances that have constant xy values to create blocks). I've got a setup to create Random Instances of variations of corners and walls and then sets of those based on the level: bases, mains, and tops.
However, I can't figure out how to assess the instances to assign particular collections based on the xyz values. Basic if->then filtering based on the xyz values, also determining rotation based on facing. I've gotten the base layer to designate the right collections and rotate the corners and walls properly, but it appears that the min and max z value is for the entire mesh not the z values when x and y are constant. I'm sure what I'm doing isn't the best solution but I think I'm making this way more difficult than it has to be.
Choosing Geometry with minimum Z value (does it for the whole mesh not individual z axis)
Separating out X and Y values to set corners and walls along with rotation.
Iterations to find Max XY, Min XY, Max X-Min Y, and Min X-Max Y
Result of Base Filter only displays correct base on z axis where base all has same Z value.
Specifically, the lowest z valued instance for all of the instances with the same x and y should determine a base collection object, and then assess if it is a corner or wall, by determining base corners collection by the highest and lowest instance of x along the y axis, and the highest and lowest instance of y along the x axis. All other instances in the base filter would come from base walls collection (rotating these instances based on the x/y values would also need to be done). This process would be very similar for the top filter based on the highest z valued instances along the z axis. The main filter would be for all in between instances on the z axis.
I'm guessing it is something to do with the selection node but I'm not even sure where to start other with an embarassing node tree that shows that I lack a fundamental understanding of geometry nodes indices and beyond. I'm trying but the documentation in blender is not that helpful and I'm just looking for the right direction to start. I'm able to get some things going, in filtering, but I'm just not sure how to generate a value to create instances where the instance is the highest/lowest value on a particular axis.
This is the blend file https://drive.google.com/file/d/1PolRXHG8LS8UH_CkPDEZR2W-_5f6b_a3/view?usp=sharing where you can see my mess.