And I am not able to find any solution for solid geometry packing. I see some circle packing techniques on the forum but that is only for 2d geometry. so maybe that will not come in use ( I guess).

so any suggestions on how should i solve this problem?

I try rigid body collide but this type of result is coming which is not desired

I didn’t look at your script, but it seems you have to first try to understand how you could do this object for real with your hands. For me it is an iterative process. Place a cylinder, then place another close … What is your logic to place the cylinder ?

yes, you are correct the fabrication process going to be similar as you mentioned.

but first, if we solve this self-intersection problem with Grasshopper (maybe using kangaroo). we will have an exact number of pieces according to size. and we can use an image sampler to generate some kinda pattern.

Kangaroo could surely be useful, but if you want to stay with cylinders aligned (all axis parallel) the computation is more simple. So for this kind of job I prefer to implement something with some code and Objects/Classes (C# for me).
A cylinder could be defined by 2 points P1, P2 (same Y Z, if on X axis ) and a radius.
A cylinder touches another cylinder if there X coordinates intersect and if distance between axis are less than the sum of radiuses.

Hello
I have no good references. I learned by doing and searching. But there are 3 things to study Coding , Algorithm and Libraries.
For the first there tons of tutorials for different languages.
For the second it is less simple as it depends on what you want to achieve. I thing it is best to learn by doing.
For the third it is mainly Rhinocommon library, but also Grasshopper, Kangaroo, … and many others you will have to discover. Not easy because it is quite huge.

I think the way I would approach this would be to split it into a series of 1 directional circle packing problems and 1 directional rectangle packings (each of which could be solved with kangaroo or scripting. I think you could even do each individual stage without either, but you’d probably still need a way to iterate, such as octopusLoop).

So first make a row of touching circles along one axis,
When these circles are extruded into cylinders they are rectangles in the orthogonal view - move these rectangles along one axis until they touch the existing ones,
then return to step one and repeat until you’ve filled the required area.