# Improved Populate Geometry?

Im trying to populate text onto irregular surfaces or inside curves and have it avoid the edges and other holes. Basically adding cutout labels onto sheet metal parts that already have holes.

Constraints:

• keep all of geometry inside of its boundary
• avoid obstacles like holes

Any ideas? I cant seem to find a work around.

Some geometry has rectangular cutouts so some type of surface population makes more sense

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.

Tried OpenNest, wont work since it only takes crvs as sheets and I need something to take surfaces since I have cutouts on my sheets. Maybe if I can find a nesting plugin that takes surfaces.

Create curves from surface edges? Are they planar surfaces?

I have the same problem
I solved it for small text (numbering which are engraved) with some components that I can share
For bigger text I didnâ€™t solve it yet. I will go to make my own custom program

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.

BrepFace_FitRectangle_V1.3dm (88.0 KB) BrepFace_FitRectangle_V1.gh (120.2 KB)

1 Like

planar however since there are cutouts and many holes inside of the surface creating curves from surface edges wont help since the nesting program wont know what to do with the curves inside

This seems to work, Ill try on my large script tomorrow and report back. Most sliders seem to just be random seeds in position but I think it does the trick (: thank you

Noticed this too haha, life sucks

Test it more and if it appears OK and you have additional constrains in mind (for instance: narrow the random point placement by following some other rule) notify.

BTW: Only rollTheBones is â€śdummyâ€ť (causing the C# to re- execute).

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.

Best,
e

Well â€¦ thereâ€™s a couple of ways to deal with that issue of yours. Get the attached that is using a second option (maybe Iâ€™ll add a 3rd [a â€śbiasâ€ť placement] at some future time):

BrepFace_FitRectangle_V1A.3dm (242.7 KB) BrepFace_FitRectangle_V1A.gh (129.8 KB)

BTW: If you want to â€ścutâ€ť the labels into the sheets youâ€™'l need stuff like this (Text>Curves) as well:

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.

3 ms for 2500 â€śpixels/piecesâ€ť (using on purpose a rather slow i5 and not //):

Thanks for this information. It useful