I am trying to select boxes which are parallel to one another and close to each other. I want to lastly put them if in

How to select boxes which are in one direction, maybe parallel to one another and adjacent. I want to filter them want to put them in separate lists. Any ideas on how to approach this?


First group by their rotation.

  • Use a BoundingBox.ByMinimumVolume to get the box which is tightest to the original shape.
  • Use BoundingBox.ContextCoordinateSystem and a CoordinateSystem.XAxis node to get the vector of the X axis for the bounding box.
  • Use a Vector.AngleAboutAxis to get the angle to the canonical X axis about the cannonical Z axis
  • Use a Modulo (node looks like % for the name) of 90 to get the remainder of the angle after dividing by 90.
  • Finally use a List.GroupByKey to group the solids by the common angle.

Next up is finding those in a common group which touch. Watch the list levels and lacing closely here as you need to operate in the groups. Also if you won’t ever have a cuboid of rotation A in a group with rotation B you can skip everything above this.

  • Solid.ByUnion to convert each of the groups into one solid.
  • Solid.Separate to pull the individual solid parts from each group.
  • Geometry.DoesIntersect to test each of the original solids in the group against all of the parts in the group. Don’t operate at too high a level here or you will break things down. Read the primer and do the exercises on list levels and lacing if there are questions.
  • Finally use a List.FilterByBoolMask node to get the groups of solids which intersect with each of the separated parts of each union. This is your final result as you phrased the question.
1 Like

Thank you so much for the detailed description. This helps a lot to understand. I am
Going to try this and get back to you.

The only point I’d like to add which I should have mentioned in my description is that, the boxes which are close to eachother are not touching. They are upside to have a 8 inches gap in between them from all sides. I am not sure if that will change the second part approach

Assuming it is a consistent 8” gap, use a Solid.ThinShell before the union. Interior dimension and exterior dimension can both be 8”. Join the list of thickened solids with the original by way of a List.Join, and then use the Solid.Union.

Hi @tabeertariq i guess "geometry.group,by.distance node from spring could work here as well…maybe :wink:

1 Like

this step became very easy with your recommendation. Thank you

1 Like