I was asked to write a Grasshopper script for evenly sized panels. Each panel is 10.5’ x 3.75’. It feels like a pretty straightforward ask. However, I am running into an issue with the leftover space.
The space leftover is required to contain panels no less than 9.0’ located in the center of the area. Maybe I am overthinking this, but I cannot figure out how to accomplish that part. I have attached a screenshot for reference. You can ignore the green panels because those will always be 7.875’.
For reference, the overall length would be the primary variable being adjusted. Let me know if I need to clarify any of the information. Any insight would be greatly appreciated.
the 3 text containers on the right are the reference data of interest, as they wiil give you the possible combinations to divide your length
we want the leftover panels to measure at least 9 units but no more than 10.5, so we can keep all the solutions for which that value is >=9 and <10.5 :
of course, if you are in a situation with total length like the one in your image, where you can fill the total length of 128 units by just using main panels, you need to stop earlier and take that solution from the beginning, and ignore the rest of the calculations:
Thank you so much! I believe it does have to be even, but this at least gets me on the right path. Your explanation is extremely helpful. The big err I made was trying to visualize it first. Since this does need such specific values, you are right that I should have started by calculating them.
To achieve that, I am thinking I should create a slider restricted to even values. Then I can multiply that value by 10.5 and take it away from the overall length.
L-(10.5N)=x
X would give me the leftover amount, and I could divide that by the number of middle panels and it could tell me the leftover panel size. This way feels a lot less elegant than your script because it has more parameters, but it’s the simplest way I can think of. Let me know if you have any other ideas.
I’ll reply here if I get stuck again. I’m going to work on what I wrote above and something that will lay them all out.
Okay, it’s a little clunky, but it’s passable. I’m curious if you have any thoughts on how this could be optimized. It does require a human to check if the middle panel values are beyond the extremes (9 and 10.5). I took more of a brute force approach to getting the main panels to be an even amount. weirder_panels.gh (23.8 KB)
the Value List + Filter let you do that pretty fast
working with sliders is fine, we are both bruteforcing it, but while a slider lets you see only that particular solution for that value, a Serie of numbers can show you multiple solutions simultaneously… so I prefer series