SVGNest Documentation

repository·master·Indexed 25 days ago

https://github.com/jack000/svgnest

A free, open-source, browser-based vector nesting tool that uses a genetic algorithm and the No Fit Polygon (NFP) approach to pack irregular shapes into containers efficiently to minimize material waste.

Tokens
749
Snippets
0
Records
3
Agent score
33%

What's inside SVGNest

  1. How the SVGNest nesting algorithm works

    master

    SVGNest uses an orbital approach combined with a Genetic Algorithm (GA) for global optimization. The process is split into two main strategies:

    1. Placement Strategy (No Fit Polygon)

    To place parts without intersection, the algorithm uses the No Fit Polygon (NFP) concept.

    • NFP: Created by "orbiting" part B around part A such that they touch but do not intersect. The NFP contains all valid placement positions for B relative to A.
    • Inner Fit Polygon (IFP): Similar to NFP, but used to ensure the part stays within the boundaries of the bin.
    • Union of NFPs: When multiple parts are already placed, the algorithm takes the union of their NFPs to find valid empty spaces.

    2. Optimization Strategy (Genetic Algorithm)

    To find the best insertion order and rotations, a Genetic Algorithm is used.

    • Genes: The gene represents the insertion order of parts and their respective rotations.
    • Heuristic: The algorithm uses a "first-fit-decreasing" heuristic (placing larger parts first) as a starting point.
    • Fitness Function: The GA evaluates "fitness" based on:
      1. Minimizing unplaceable parts.
      2. Minimizing the number of bins used.
      3. Minimizing the width of all placed parts (to avoid long slivers of unused material).
  2. How to use SVGNest for vector nesting

    master

    SVGNest is a browser-based tool for packing irregular vector shapes into a container (bin) to minimize material waste.

    Preparation

    1. Ensure all parts in your SVG file have been converted to outlines.
    2. Ensure that no outlines in the source file overlap.

    Workflow

    1. Upload your SVG file to the tool.
    2. Select the bin: Choose one of the outlines in the uploaded SVG to act as the container (the material).
    3. Automatic Processing: All other outlines in the file are automatically treated as parts to be nested within the selected bin.

    Note: Running the tool is CPU intensive; mobile devices may experience performance issues.

  3. Configure SVGNest nesting parameters

    master

    You can tune the nesting behavior using the following configuration parameters:

    ParameterDescription
    Space between partsThe minimum distance to maintain between parts (useful for accounting for laser kerf or CNC offsets).
    Curve toleranceThe maximum error allowed for linear approximations of Bezier paths and arcs (in SVG units/pixels). Decrease this if curved parts appear to overlap.
    Part rotationsThe number of possible rotations to evaluate for each part (e.g., 4 for cardinal directions). Higher values improve results but slow down convergence.
    GA populationThe population size for the Genetic Algorithm.
    GA mutation rateThe probability of mutation for each gene or part placement (values between 1-50).
    Part in partWhen enabled, allows placing parts inside the holes of other parts. This is off by default due to high resource intensity.
    Explore concave areasWhen enabled, solves concave edge cases at the cost of performance and placement robustness.