Group Similar Panel Dimensions Using a Custom Tolerance

Hi everyone,

I am trying to create a script that groups panel dimensions according to their uniqueness and a defined tolerance.

For example, I have the following output data:

2801 x 1471
2801 x 1471
2801 x 1471
2802 x 1472
2802 x 1472
2804 x 1470
2804 x 1476
2804 x 1476
2805 x 1479
2806 x 1471
2806 x 1471
2806 x 1479

Exact duplicates should be counted together. Dimensions that are close to each other within a specified tolerance should also be merged into one group.

For example, if the tolerance allows 2802 x 1472 to be considered equivalent to 2801 x 1471, the expected result would be:

Dimension Quantity
2801 x 1471 5
2804 x 1470 1
2804 x 1476 2
2805 x 1479 1
2806 x 1471 2
2806 x 1479 1

What would be the best approach for doing this in Grasshopper?

Unitizing panels by specific tolerance.gh (67.8 KB)

Could any of these help?

Not using surfaces:
Unitizing panels by specific tolerance_c.gh (113.6 KB)

Using surfaces (patch):
Unitizing panels by specific tolerance_b.gh (64.4 KB)


*EDIT:
After seeing your file, I don’t think I provided much help :sweat_smile:. At first I couldn’t see all components because you’re using a plug-in.

I could replace the missing plugin component with a substitute group of components.
Looking at the numbers this could be a correct replacement.

Unitizing panels by specific toleranceEW.gh (69.0 KB)

Thanks, Eef!

I figured for this case neither the bounding box nor rectangle are needed—it was easy to use the (native?) ‘deconstruct rectangle’ (gives you plane + X & Y domains) to plug and chug into a ‘rectangle’ component.