2

I wrote a script that makes a design for a laser cutter. I want to optimize the layout to reduce waste and make the most of expensive Perspex material. I lay out the pieces so their bounding boxes have 2 mm distance from each other and fit within a 400x600mm sheet. This first picture shows the result of the script, which loses space in the tail of the cursive "j" and in between the "1"'s:

Layout of pieces before optimization and with lost material

This next picture shows some manual optimization: I moved pieces left of the cursive "j" to the right and rotated and squeezed together the "1"'s. Notice how I was able to fit the full "p" and an extra "1" in the same space:

Layout of pieces after optimization and with all material used

I imagine designing such an algorithm would be very involved, but does Inkscape or Illustrator have a way to do this automatically, e.g. "take these SVG's and fit as many as you can into a 400x600mm rectangle"?

Update (July 7, 2018): After the suggestions of @BillyKerr and @Testujin, I tried SVGnest.com. The website had several problems.

First, it ignores stroke width: compare the size of the 1's in the original SVG in the top panel below to their size in the bottom panel. It also changes the original beziergon: compare the "j" in cursive and script, the "a", and the "oe" (French letter) between top and bottom:

SVG file before SVGnest SVG file after SVGnest

Second, the algorithm breaks apart compound paths, such as the outside of the "a" from its hole. The first picture below shows in Illustrator that the "a" is a single compound path, not a group. The second picture shows the result of SVGnest.

Illustrator: the letter "a" is a single path SVGnest breaks apart paths

Third, the site runs JavaScript on the client: for a sheet of 400 x 600 mm acrylic with around 40 letters, it was taking 350% CPU with an estimate of over 30 minutes to complete.

A minor point is that the algorithm gets stuck when the material is too large for the objects. The status after 80 iterations was the same as after 1 iteration, with pieces all over:

SVGnest stuck when material is too large

2
  • There are commercial nesting solutions that work better... But because this has economic impact, they are not cheap.
    – joojaa
    Commented Jul 7, 2018 at 11:01
  • The link by Tetsujin suggests DeepNest and Blank Slate. Do you recommend other commercial solutions?
    – emonigma
    Commented Jul 7, 2018 at 13:11

2 Answers 2

5

Your keyword is "nesting".

In manufacturing industry, Nesting refers to the process of laying out cutting patterns to minimize the raw material waste. Examples include manufacturing parts from flat raw material such as sheet metal.

There is software available, free & paid, that will do the task for you.

I found this comparison - The Definitive Guide To Nesting Software For Laser Cut Designs - although it is also an advert for their own template service, it seems a reasonable rough guide, start-point.

It's not something I have great experience with, but I'd certainly give their freeware suggestion a try - SVGnest

3
  • yes, the concept is exactly "nesting". I tried SVGnest with mixed results that I wrote in the question. I will try some other procedures on SVGnest and the other two paid services from your link.
    – emonigma
    Commented Jul 7, 2018 at 9:36
  • 1
    I found a solution with SVGnest after much testing and I am very happy with the result. I tried the other two sites mentioned in the Ponoko article and they failed. Given that both you and Billy Kerr suggested SVGnest and that I would have some content to add to each answer, I'm not sure which answer to accept or whether to write one myself. I'm new on the GraphicDesign site, what do you think?
    – emonigma
    Commented Jul 14, 2018 at 17:28
  • All I did was figure out the search term & find a site with an explanation. tbh, if you used that info to hone a proper solution, then post your own 'final & proper solution' & mark it as the accepted answer. Like Billy, I don't need the invisible internet points; I would much rather a good question had a good answer, marked up as such.
    – Tetsujin
    Commented Jul 14, 2018 at 18:43
5

SVGnest(dot)com should be enough to do the job, and it's free, although there may be scripts/extensions available for Illustrator/Inkscape. I have no affiliation with the SVGnest website.

Anyway, here's an example of what SVGnest can do.

enter image description here

10
  • I've seen others ask for the feature, but I also don't know of any Inkscape extension that can do it.
    – Moini
    Commented Jul 5, 2018 at 13:07
  • @BillyKerr I tested SVGnest and edited the question. SVGnest changed my beziergons and broke apart my compound paths. How did you get your result to maintain the holes in the letters and to respect the Bezier curves?
    – emonigma
    Commented Jul 7, 2018 at 8:38
  • @mmorin I didn't do anything special - the text I made was just turned to outlines and ungrouped. I used Inkscape to create the initial SVG.
    – Billy Kerr
    Commented Jul 7, 2018 at 9:08
  • @BillyKerr funny, I also tested creating the file in Inkscape and SVGnest still went bananas with the paths. Which font are you using?
    – emonigma
    Commented Jul 12, 2018 at 16:29
  • @mmorin - I can't remember the font, but the font was converted to outlines before I used SVGnest. Also, I saved it as a Plain SVG, not an Inkscape SVG.
    – Billy Kerr
    Commented Jul 12, 2018 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.