Here’s a rough solution for you.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/ki7Jd.png)
Since you want a face centered cubic packing pattern for your spheres, we will use nested instancing to construct your arrangement.
First, we notice that a single level of your pattern uses a hexagonal packing method. Given if all spheres are the same size, then the packing pattern is most likely a regular hexagon packing method (all sides and angles are the same). A regular hexagon packing pattern can simply be broken down into an equilateral triangle grid, which is what we will construct. The main parameters we will set up are the Length between each sphere’s center (because the entire structure will be built on this length), $N$ number of points in a row, $M$ number of rows in a level, and $L$ number of levels in your structure.
To begin, we will construct a node group called Increment Line
. This line of points will expand from the origin by increments of a selected value and will be the base of what we use for our nested instancing. To make it flexible, we will make it adjustable to the three axes with 1: X-axis, 2: Y-axis, and 3: Z-axis.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/Z8hQe.png)
Our next node group to construct will be called Cyclic Instancing
. Because your pattern alternates between two or more instances in a particular order, I set up the Instance on Points
node to instance in a given order.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/zFIMi.png)
To arrange the equilateral triangle pattern of one level, every second row would have $N-1$ spheres from the first row of $N$ spheres. Since we know that the arrangement is an equilateral triangle pattern, we can calculate the distance between each row as the height of an equilateral triangle.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/Cs1GX.png)
Note: Did you notice how points in the second row sit directly perpendicular to the midpoints of the lengths below? That’s because the Increment Lines we use expand equally in both directions.
Finally, to arrange for the face centered cubic packing pattern, I rearranged every second level’s rows with $N-1$ spheres first and $N$ spheres second and every third level's rows with $N$ spheres first and $N-1$ spheres second. I also offset the levels to sit directly above the centers of the equilateral triangles. To calculate the distance of each level, I found the height a regular tetrahedron.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/tIaph.png)
Note: I deleted a row for every second and third level to keep the structure from going beyond our established length.
To construct the inverted structure of these spheres, I simply reconstructed a prism with the lengths and parameters we made along the way.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/2T65M.png)
For some extra parameters, I made the radius of the spheres uniformly adjustable with a custom radius. If left to be $0$, then the default radius of the spheres would be ½ of the length selected. I also built a switch for the Mesh Boolean
node because calculating the Inverse, as Chris mentioned, is extra slow!
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/zemEk.gif)
Hope this was helpful.
![](https://cdn.statically.io/img/blend-exchange.com/embedImage.png?bid=bRxQGznJ)
Blender 4.0.2