Think this: assume that you have the boxes with a common (in Z) bottom. Like in the last pic above with the F1 body items. That’s the easy part (you’ll need a variety of checks mind with regard the min acceptable Volume and Size (in terms of the min box domain Length in x,y.z)).
The tricky part is to … er … achieve shapes out of the boxes kinda a tetris game: ie find a logical way to cut/slice/trim/whatever the boxes in order to get a collection of “tetris like” pieces that - if glued together - could result a realistic working “combo”. Obviously you’ll need ccx connectivity, layouts and the likes.
Attempting to do that via boolean union ops it won’t work at all: for instance imagine a taller (Z) box that has a base that is fully contained inside an other shorter (Z) box: this means that you should subtract the tall from the short and have a portion of the tall box that is sitting on top of the other. Or imagine boxes contained each other (remove the contained from the candidate List). Or imagine boxes that share a common side (due to some symmetric parts) : you sould union these prior doing anything further (and remove the 2 boxes from the collection). But what if there’s tolerance issues meaning that the sides are “almost” equal but not “exactly” equal? How to union them properly?
A puzzle exactly like the tetris pieces (but way more challenging).
Bad news: you can’t do that kind of stuff with components: you’ll need code (that is way above an average level of knowledge) … and a very fast one: for instance instead of doing boolean solid ops you can perform arithmetic comparisons using solely the boxes Domains etc etc.
I’ll investigate if I can find a C# with a similar Solver that is not strictly internal to the practice … and if things go well I’ll post it this Monday.
In the mean time get this (without the critical part: the Solver). The small C# to the right does the ccx connectivity tree and because is using solely Domain ops is real-time fast. See the Volume/Size filters as well (and what the info panel has to say). Note: the C# works with meshes (but I could add a GeometryBase capability: i.e. Breps or Meshes).
Box_FromMeshes_V1.3dm (6.5 MB)
Box_FromMeshes_V1.gh (121.2 KB)
Added a GeometryBase capability (Breps/Meshes) and importantly a Box inflate var. This is critical : what if the R Method used has not fully engulfed the object? What if the CNC needs some space more? That sort of stuff.
Box_FromGeomBase_V1.gh (124.2 KB)
Added an entry level (just an indication in fact) take on a quite complex puzzle: what to take from what (and why):
Interval_CcxRelations_V1.gh (114.9 KB)