TightLinearPacking.gh (1.2 MB)
I want to create a grasshopper program for packing curved meshes tightly in a line. I don’t
want to use box packing as a tighter pack can be achieved through having each piece sit inside the curvature of it’s adjacent part. I would like the script to operate by placing the first of a set of meshes at 0,0,0 then placing the second mesh next to it 1mm away from touching. This placement could be found by iteratively moving it away from the first mesh till it doesn’t clash with the first placed mesh. Once the second mesh’s position in the line is found, the other meshes will also follow this same process. How can I make a grasshopper program that loops like this for each referenced mesh till they are all in a tightly packed line?
Is this possible to create within grasshopper without coding? If not, what language would be best to learn for this task?
Hi @James_McManus
could you post a picture of the expected outcome? The meshes are very curvy and you have a couple of plug-ins there that I don’t have. So it’s was hard to understand the expected results.
If you know the order of parts, and you just need to pack them tightly, then two scenarios come to mind:
- Kangaroo with dynamic spring forces pulling each mesh closer to each other, while evaluating the intersection criteria.
- Anemone loop, doing the same thing, but iteratively
If you do not know the optimal packing order, then it gets a bit more complicated. You would need to test and find the optimal order somehow, and after that do the packing. OpenNest might be of help there, although I think it mainly considers boxes in 3D.
1 Like
I am unsure of the order of the parts. Finding the optimal order would be great, but I still would be happy with having them in any order as it would still be a big improvement on my current nesting process used for these parts. The attached image shows the desired result of having them packed tightly in a random order without touching.
Thanks Toni for your suggestions, I will give them a shot right now.