• Stars
    star
    10
  • Rank 1,807,489 (Top 36 %)
  • Language
    Java
  • Created 9 months ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The free and open source solution for nesting problem.

NestApp

The online platform for Nest algorithm.

screen of working

How to use?

Visit Nest2D

What is Nest Problem?

Given a square piece of material and some letters to be laser-cut:

We want to pack all the letters into the square, using as little material as possible. If a single square is not enough, we also want to minimize the number of squares used.

In the CNC world this is called "nesting", and software that does this is typically targeted at industrial customers and very expensive.

example

for more detail , please go to SVGNest

The repository based on few github project, I keep the original history of commits.

Also, i have some plane to modify the project. The project will be support DXF file. The SVG format available only for the preview. The project will be migrate to Kotlin fully or majority.

Fill free to create issues or pull requests. The main goal of the project is mainly free and open source solution for nesting problem. I try to find the way to compensate the price of cloud server. You Star of the project can help to apply to some open source program.

Credits:

Referenced Paper

Extended Attributes of Polygon

When one polygon is constructed , its default Rotation attr is 0 , which means we will fix it during our Nest Program. We can set it as 4 and this polygon may rotate in 90°,180°,270°. If we set Rotation attr as N, this polygon may these rotation angles (360/N) *k , k= 0,1,2,3,...N

Meanwhile you can use bid to help you identify the polygons. It is useful when we get nest result.

      polygon.bid = id;
      polygon.setRotation(4);

Hollow Polygon

For those hollow polgyons, Nest4J provides a simple way to express by 2d coordinate system. If one polygon is inside in another by their coordinates, the Nest4J will detact it automaticly.

Configuration

Before we start to nest , you can set configuration.

Config config = new Config();
config.SPACING =0;
config.POPULATION_SIZE =5;
Attr Description Default
SPACING the distance of each plygons on bin 0
POPULATION_SIZE the number of population in GA algorithm 10
MUTATION_RATE the rate of mutate in GA algorithm 10%
USE_HOLE allow to put polygons into hollow polygons false

start to nest

When we configure the bin, the material list and the configuration, we can start to nest.

Nest nest = new Nest(bin, polygons, config, 2);
List<List<Placement>> appliedPlacement = nest.startNest();

Placement

Placement is our unit of final result , which represents a polygon with a specific bid placed into a rotation angel and relative coordiates to its bin of top left corner.

public class Placement {
    public int bid;
    public Segment translate;
    public double rotate;


    public Placement(int bid, Segment translate, double rotate) {
        this.bid = bid;
        this.translate = translate;
        this.rotate = rotate;
    }

    public Placement() {
    }
}