# Distribute objects optimaly

So I've got a file with loads of simple objects. This will later be used to cut out these shapes out of plastic. So, using the material optimally is of outmost importance. I was wondering if there is any script or plugin that could automaticly arrange the objects within the artboard so they could fit best.

• Unless your "simple objects" are squares and all of the same size, this is an undecided problem for the general case. Nov 9, 2016 at 10:51
• Yeah, all my objects are absolutely different. Nov 9, 2016 at 10:57
• Optimally or somewhat optimally? Optimality is unfortunaltely at its simplest a variation of the traveling salesman problem and can not be solved in a efficient manner for large sets. However somewhat optimally canbe done. Its one of those things where if you invented a efficent poof your be world famous, and rich. Nov 9, 2016 at 12:49

While this is indeed a undecided problem that does not mean you can not do a solver that is somewhat good, albeit not optimal. There is a nifty tool called:

That does this for you. So lets say I have the following shapes that i want to fit in bin on right:

And i drop that in svgnest and let it run for a while I get:

Which has a 44% utilization of stock. The longer you let it run the better results you get but like I said optimal is a hard problem. For example svg nest only does x degree turns on objects.

• What do you mean by "an undecided problem"? It is not a decision problem, and even if it were it wouldn't be undecidable, but merely NP-complete (I think). Nov 9, 2016 at 19:01
• Im not sure if its NP complete either, im trying to avoid the technical aspects for reasons external to this discussion. If i would need to guess its NP complete if there is some way to dicretisze the problem but if not i think its even harder since in that case there might not even be a possibility to enumerate. But im not going into this deeper. Nov 9, 2016 at 19:23

Use a photo mosaic application. For example, I use Shape Collage to load hundreds (if not thousands) of unique, transparent PNGs. Then the software lets you control the final output size (your sheet size) and how close to proximity each shape is (with or without overlapping) and if you wish for each piece to be scaled. The application re-adjusts all the pieces every time you tweak a setting.

It takes a handful of tries to get the formula just right.