Hi!

I would like to create a script, where all the objects are placed in a defined area, without intersecting each other.

All the objects consist of a solid box and an offset curve defined by the height of the box. The offsets can override each other, like on the first screenshot, but they should not intersect with other solids. For now this only works if all the blocks have the same height and therefore the same offset. On the second screenshot you can see the offset intersecting the solid, caused by the different extrusion height. Ideally the elements would change their position whenever an intersection appears.

Is there a way to have solids with different heights, thus different offsets around them, to not intersect each other’s area (defined by the offset)?

Thank you for your help!

DFP_220411_Script01.gh (14.8 KB)

This belongs to an optimization class of problems called Packing problems. The fact that your container is a poly Curve is more or less irrelevant.

Anyway you’ll need to start with a class with suitable properties (i.e. a Brep, a footprint (as Curve) and the out boundary (as Curve)). Use the Curve.PlanarClosedCurveRelationship(crv1, crv2, plane, tol) R Method for RegionContainment checks.

These optimization problems are usually NP-hard and obviously are addressed **strictly via code**. See : Erich's Packing Center for some solved specific packing problems.

I have a variety of C# packing solutions solely for AEC purposes but are strictly internal to the practice. That said I can provide some hints IF your level of coding is mid to advanced (and you play ball with C#).

1 Like

Hanna Kovacs,

Galapagos, I say. Like this…

Packing solution v1 4-12-22.gh (19.2 KB)

This may not be exactly what you want, but it will move things around, coming up with various solutions. Galapagos is really cool and can help with these kinds of problems. You must take some time to set it properly.

Best of luck ,

Bill