ss=4.8; // shaft sixe
sh=10; //socket height
ns=6; //number of sockets
wt=0.8; //wall thickness
shs=6; //number of sides of shaft
eg=1.3; // extra gap between sockets

difference() {
for (i = [0:ns-1]) translate([0,(eg*i*ss),0]) cylinder(d=ss+2*wt,h=sh,$fn=40);
for (i = [0:ns-1]) translate([0,eg*i*ss,wt]) cylinder(d=ss,h=sh,$fn=shs);
} // end diff
play with that.
It's actually a script to generate strips of bit holders I print them from tpu.

Now if you lose the difference.
You get a single line of script that can generate any size hexagons with any size gap between them.
And another 'for' loop and you can then generate vertical columns of the horizontal rows.
A little algebra will offset the different rows. There is a way to tell if a number is odd oir even and then do something with it.
I'd do the below work around :-)

Or - what i';d do because I'm lazy.
Create two unioned already offset rows inbetween a 'for' operation. so you just duplicate the two already offset rows - however many times you like.

If you use a dual diameter cylinder, you also create the top wide hexagon he has in the drawing.