# Finding the maximum and minimum gaps between a squares arranged in a grid

I’m working on a panel which will have laser cut punctures. The fabrication shop is saying that the gaps between the squares should not exceed 1.2 millimeters otherwise the material will be burnt in those areas.

How can I measure the gaps between all the squares?

I want to see the list of maximum and minimum gap between the edges of the squares, for the entire panel, and eventually sort them into horizontal and vertical distances. I have the idea that the gaps will be measured between 0th and 2nd edges for vertical , 1st and 3rd for horizontal, but not able to proceed further.

After I see the max and min distances, I want to change the domain of the graph mapper accordingly by changing sliders. How can do it?

MEASURING DISTANCES _QUESTION.gh (19.9 KB)

Instead of trying to check and correct the data after creating your design, perhaps it’s possible to include the minimum distance between the squares as an input parameter instead?

I don’t know how to do that.

Have a look at this and see if it could work.

MEASURING DISTANCES _QUESTION V2.gh (19.1 KB)

1 Like

That’s what I would do too. Use the inputs to your Domain.
You’ve got your size and can calculate the minimum scale factor to get the smallest distance.

on the same way you can controll the minimum size of your output too - thats important for the laser as well.

For example if your size is 100 and your minimum distance is 10, you need a maximum of 95. The result depends on the distance of your center point.

1 Like

Thanks a ton! This works. I’ll go through the script multiple times to see how the math and logic of it is working.