Maybe you could use one of the nesting plugins for this? Might have to fudge it a bit because it sounds like instead of nesting lots of objects onto one sheet, you are nesting lots of objects onto lots of small “sheets” of material.
Label means a boundary (a Rectangle3d as Curve) that has some clearance (if required) from the BrepFace Loops and there’s no ccx events. If so … you can start from the attached (add text as curves, split etc etc). You can attempt solving it via K2 as well.
BTW: How it works: For a given BrepFace in the List while attempt < attempts get a random point rpt in a BrepFace and test the rectangle (at point rpt with Intervals x,y from xSize, ySize) for clearance (optional) and ccx events (mandatory) VS all the BrepFace Loops (as Curves). If OK return the rectangle if not rotate it (rotStep) at rpt and test it again while total rotation < maxAngle. If the whole procedure fails (Try: increase attempts OR decrease sizes OR skip clearance OR raise maxAngle) retun null.
BTW: If you have lot’s of BrepFaces the “smart” way could be: do a 1st pass and then try more passes by using more attempts only for the BrepFaces that failed to yield a rectangle. Or maybe get the flat Box per BrepFace divide acc the sizes and test in one go the rectangles.
Have been busy but I have had time to test with a couple hundred parts and it works really well. Thankful people like you upload such great things.
You’ve saved me a whole days worth of work on just this project. Does everything I want it to but if I had to nit pick then it would be nice to justify the text in some general region of the brep (middle left top bottom right), almost like Word does with text. But again not a priority just good to keep things consistent for assembly. I need to learn C or python, seems extremely useful for GH.
BTW: Another way is to “pixelate” (or create flat voxels) your BrepFace with a user defined “resolution” and then find the max Rectangle in the resulting Matrix (or the max Square or - best - a List of candidates in descending order of sizes etc etc). This approach could work on any non planar BrepFace. It’s very fast, mind: since it takes 1 ms for the abstact Matrix shown (// could speed things even more) … you have liberties to exploit a lot of scenarios.