I wanted to give a try with booleans to see if it could make it easy.
And i struggled a lot more than i thought simply because Blender booleans are really bad.
Anyways, here’s what i did :
First add a plane and add 26 loop cuts (CTRL+R)
Then add 26 loops cuts on the other axis
Go into Face selection mode and select those faces then delete them
Select those faces and delete them
Go into Edge selection mode then click on the bottom menu on Select -> Non manifold
Unselect the boundary of the mesh
Press CTRL+I to invert the edge selection and press X -> Edge to delete them
Extrude those on an axis , and make sure the mesh will be longer than a default cube
Select all and press F so Blender automatically close all those unclosed tubes (required of the booleans would do a bad job)
Select all , press W -> Remove Doubles and press CTRL+N to recalculate the normals just in case (always good reflex to have to do this regularly during your modelling sessions to avoid nasty surprises)
Now on another layer add a Cube and go to edit mode, then subdivide that cube 3 or 4 times (or the booleans would fail very badly)
Check with the 2 layers if you have your tubular object placed correctly with your cube
Ok, enable only the layer with the cube so it’s easier to see what’s going on, then add a Boolean modifier
Set the modifier to Difference , then at the target select the tubular object
That’s good, apply the Boolean modifier.
Now is where the boolean would fail if we use it for the other sides of the cube, to avoid that problem, add a Remesh modifier set to Sharp and the octree set to 6 (you don’t want to use 5 or later boolean would just miss some faces)
Apply the Remesh modifier
Back to the tubular object, rotate it on an axis so we’ll be able to boolan another side of the cube, after rotating it make sure to press CTRL+A -> Rotation&Scale to apply the rotation and scale in case you scaled the object instead of edit mode before (or good luck with the booleans )
Select only the layer with the cube to make it easier to see, then add a boolean modifier to it, set it to Difference , then target the tubular object again
It will take a longer time for you to wait until it’s done (due to the increased amount of vertices on the cube, thanks or no thanks to the remesh modifier, and because Blender booleans are slow unfortunately) but it will work
Apply the boolean modifier now
Next step, Remesh modifier again, with the same settings as before, or next booleans would fail.
Apply the remesh modifier.
Back to the tubular object, rotate it again so it get into the last side of the cube, then press CTRL+A -> Rotation&Scale to apply rotation&scale
Look only on the layer with the Cube, again so you see easier, add a Boolean modifier, set it to Difference and target again the tubular object, then wait until Blender is finished with the slow booleans
Apply the boolean modifier (and wait again, slow , slow booleans …)
Now to complete it, add a final Remesh modifier, same setting as before, and apply that modifier
This last remesh modifier is to get rid of some bad boolean topology that could have screwed up a face or two.
Now you object is finished.