# Distributing rectangle panels along the curve (and possible use of attractors)

Hi All
I’ve been trying to do this for some time and I feel like I almost got it, but not quite! What I’m trying to do is two things:

1. I would like to distribute panels along curves in such way, that I could specify:

1a. width of the panel

1b. gap between the panels

1c. and ideally height of the panel

… and grasshopper would calculate the best fit for that curve. So going from the midpoint of that curve in both direction would be important for symmetry and even distributions. I’ve attached my messy grasshoper file where I’ve been trying different sollution but I bet there is much simpler way to do it!

I feel like I’m on the right track with divide curve and array and distribute but it looks like I’m just missing some elements! Arggh I keep thinking about this, can someone help please??

1. The 2nd thing (less urgent) I’m trying to do, is similar to the above, but with the use of attractor instead, so I could move the attractor point left and right, and the panels distribution would be denser where the attractor is, and less dense far away from the attractor.

playing with a panel3.3dm (64.6 KB) Playing with a panel3.gh (35.8 KB)

given the total length of the curve on which the panels will be distributed, you can either input:
-number of panels, gap between panels -> and get the width of each panel
or
-number of panels, width of each panel -> and get the gap between each panel

panels start to be distributed at the very start point / until the very end point of a line?
or do each distribution start and end with a gap? is that gap the very same that is calculated between the panels? or is it a different value?

Hi @inno

All great questions!

For instance, if my curve was 6400mm, and I would input panel width to be 1200mm, I would like grasshopper to distribute these panels evenly on my curve (so in this example, I could have either:

a) 1200mm panels + 100mm gaps in between + no gaps at the ends
b) or 1200mm panels + 75 gaps + two 50mm gaps at the end

The gaps at the end don’t matter for me, ideally I wouldn’t have them, but if the number is funky I don’t mind having some small gaps at the end. But the gaps in between the panels needs to be all the same and ideally round numbers.

this might not be the best of the solution, but it does the job given a line, number of panels and panel width
custom_gapz.gh (18.3 KB)

no gaps at start/end:

equal gaps everywhere:

custom gaps at start/end:

I just saw your reply! Thank you for looking into that @inno ! I will check it out tomorrow morning, but it looks like you got the solution there!

Thank you @inno for coming up with a great solution for my last question! I wonder if you might be able to suggest a solutions this time as well? (or anyone else on this forum):

I’d like to distribute curves (or boxes, it doesn’t matter) along another curve.

Let’s imagine my curve is 8640mm long (it will change every time so being able to connect rhino curve or type length would be fab). I can distribute either 16 no boxes, each one of them 540mm wide OR I can have 13 no. boxes 580mm wide + 2 no boxes 550mm wide. This way I ‘utilised’ the curve fully, and have no gaps between the boxes, and no gaps at the ends. Perfect.

Is there a way to give Grasshopper the curve so then the grasshopper would figure different combinations of these box arrangements in such way to have either no gaps at the ends (like I did above), or just tiny minimal gaps at the ends (there will be never any gaps in between the boxes). A slider so I could play with the results would be cool, but the main thing is so the Grasshopper would be only allowed to create combinations based on the 3 widths: either 530 / 540 / 550mm OR 540 / 550 / 560mm. (But the less boxes the better! So if that length can be achieved with only 1 width - eg. 16 @ 540 - that’s great).

At the moment I’m just trying to figure out how to do it in a straight line, in the future I’d love to be able to distribute these boxes along arching curves as well. I’m using Rhino 6 if it makes any difference.

Any help would be much appreciated!