Optimize surface using blocks

Good Morning,

I need help finding a program in GH or with a plugin that allows me to optimize a surface using rectangular blocks.
From a surface to be able to adjust block height and select a GAP to ensure that the surface is between the blocks.
Maybe with the images you understand better.
I need it to optimize the material expense in cnc machining, currently I do that manually from the 3d design.
I appreciate the help, thanks.
Block PU2
Block PU

Hmm … indeed is a way. However given the orientation of the foam material (I guess “along” given CNC x/y/z axis) maybe a recursive voxel approach could(?) be more suitable (or just a list of oriented BoundingBoxes on a per object basis). BTW: In this captured sequel the nose and the wings are treated as a single mesh.


Or (rather better): Get boxes on a per object basis (where the plane is the suitable CNC plane). Get the lowest Z corner per box and find the minZpt. In order to optain boxes with a common (low) base: create a new box using the same Intervals in X/Y and a new Interval in Z (minZpt.Z, box.Z.T1). Check (not required in fact) and make Valid the new box. Then is a matter of a classic double loop for the bool subdivision(s):

3 Likes




Good afternoon, I think the best result is option 2. That would allow me to obtain the block sizes, cut the polyurethane foam and mount the stock to be machined with the cnc. optimizing foam consumption.
how can i make that code? I don’t have that much level of programming in Rhino …

Thanks for the help!

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)

Update:

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)

Update:

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)

Good night,

I have been testing GH scripts and I have some doubts:

  • Is it suitable for surfaces or polysurfaces? Or should I turn it into meshes?
  • Once applied on the surface, it becomes physical blocks? To be able to take measurements of the blocks.

Let’s say what I need is to give a block measure in Z, for example. And a maximum for X and Y.
So seeing the blocks and measuring (Since there will be blocks that do not have the maximum measurements) I can cut them and bond them with adhesive to form the final block.

Thanks for your help.

Yes. Any surface type.

You “Bake” the (calculated) geometry into Rhino, then it becomes regular CAD surfaces/objects, and yes, you can measure them as usual.

Hopefully I understood what you meant.

// Rolf

A block (called Box) is derived from Methods the likes of object.GetBoundingBox(bool) or Box(plane, Interval, Interval, Interval) or some others. In plain English: given a GeometryBase type of thing (Mesh/Brep) Rhino can yield an engulfing oriented Box (but better safe than sorry: INFLATE the Box a bit).

A Box/BoundingBox has various Properties: among them the Intervals in X, Y, Z thus you can get the Interval Lengths and do the maths (comparisons) that you need.

In your case the 1M question is the pieces policy:

  1. Results are only Boxes or
  2. Results may be Breps as well (due to a given subtraction).

For the former if a given short Box is subtracted from a tall Box the result would be 3 boxes (the “legs” [2 or 1] and the top). But what if the legs are thiner that a given limit? In this case the short is splitted in 2. But what if the pieces are thiner than a given limit? Are we allowed to unite the tall with the thin box piece(s)? (and remove the short from the collection) etc etc.

Again: for solving this (in real-life) you’ll need a recursive (something that calls itself until something happens and stops) code that does business solely via Box Intervals (Rhino SDK exposes some handy Methods for Interval comparisons). Avoid at any cost solid ops that are relatively slow AND have no meaning: since you need to measure the results (their sizes) for validity … well … is obvious that you need Intervals. Appears easy but is a quite challenging task.

You’ll need constrains as well: min Volume, min Size, max Foam block size and maybe a few more.

An then … comes the pain: are the pieces the optimum ones given some available standard foam sizes? I.e. is the total vaste the minimum possible?

This is a classic 3d packing puzzle and is only solvable via code (not a very simple one).

1 Like

Hey there,
I am working with voxelization and would need someones help, I have this code that works good with brep selection,but I want to upgrade it so I have full control over pixel ,box size and can change then to rectangular shape( make them appear exact dimensions as I wan 5.3x11.8x3.5). Right now at the moment when I try to do it, the division between the pixels are destroyed and it wont array along the brep nicely. In attached documents you can find grasshopper code and the rhino file with brep and outcome.voxel.gh (21.1 KB) brep AT.3dm (750.5 KB)