How to prepare nesting data

The nesting data consists of parts, material and rules specifying the parameters of nesting process. The parts are generated from design system or are imported from DXF files. Appropriate material is selected based on specifications and material availability. Once the parts and material are selected, nesting parameters and stop conditions should be specified. As input data to the NestingCenter API all parts, material and settings should be put in a JSON object. With all data collected, the client application sends a request to the Nesting Center API and starts layout calculations.

Nesting data object

Nesting data is a JSON object that contains data required to start the nesting process.
 

Property Description
Context A nesting context, contains nesting settings and the problem definition.
InputName The name of the input.
MachineNameClient The name of the client machine.
Problem A nesting problem, contains parts and raw plates.
Settings Nesting settings.
StopJson A nesting stop condition or null if there is no custom stop condition. The default value is null.

 

Nesting data example

{
  "Context": {
    "Settings": {},
    "Problem": {
      "Parts": [],
      "RawPlates": []
    }
  },
  "InputName": "Example",
  "MachineNameClient": "Demo",
  "StopJson": {}
}

Part

Nesting part is a JSON object that describes the part definition.

 

Property Description
Contours (Optional) The array of contours defining geometry of the part. The outer contour should be counterclockwise, and the optional inner contours (holes) clockwise. For more information about contours, see Part and material geometry.
Rectangular parts can be more easily defined using RectangularShape property.
MirrorControl An optional mirror control value. By default, the parts mirror control value is specified in the general settings and the option does not need to be used. The allowed values are [‘Never’, ‘Always’, ‘Allow’].
Name An optional name of the part.
Priority (Optional) The priority for the part. The high-priority parts are selected before placing the low-priority parts. The default value is 0.
Quantity Specifies the number of parts with the same geometry. The default value is 1.
RectangularShape (Optional) Specifies the part as a rectangle defined by Length and Width properties.
RefPt An optional reference point of the part, referred to by the transformation of the part in a nesting result.
RotationControl An optional rotation control setting. By default, the parts rotation control value is specified in the general settings and the option does not need to be used. If a part specific rotation control value is required then one of the following values can be set: [‘Never’, ‘Fixed180’, ‘Fixed90’, ‘Fixed90_270’, ‘Free’].
RotationTwist An optional rotation twist value, in degrees.

 

Part example

{
  "Parts": [
    {
      "Contours": [
        {
          "Vertices": [
            {
              "X": 0,
              "Y": 0
            },
            {
              "X": 100,
              "Y": 0
            },
            {
              "X": 100,
              "Y": 100
            },
            {
              "X": 0,
              "Y": 100
            }
          ]
        },
        {
          "Vertices": [
            {
              "X": 30,
              "Y": 50,
              "B": -1
            },
            {
              "X": 70,
              "Y": 50,
              "B": -1
            }
          ]
        }
      ],
      "Quantity": 1,
      "RefPt": {
        "X": 0,
        "Y": 0
      }
    },
    {
      "Contours": [
        {
          "Vertices": [
            { 
              "X": 0,
              "Y": 0
            },
            {
              "X": 100,
              "Y": 0
            },
            {
              "X": 0,
              "Y": 100
            }
          ]
        }
      ],
      "Quantity": 1,
      "RefPt": {
        "X": 0,
        "Y": 0
      }
    }
  ]
}

Raw plate

Nesting raw plate is a JSON object that describes material in which the parts are nested.

Property Description
Contours (Optional) The array of contours defining geometry of the raw plate. The outer contour should be clockwise, and the optional inner contours (obstacles) counterclockwise. For more information about contours, see Part and material geometry.
Rectangular sheets can be more easily defined using RectangularShape property.
CostCustom (Optional) The custom cost value for this raw plate or null if there is no custom cost value (in which case the area of the raw plate is used as cost). The layout with minimal total cost of the raw plates is used in results. The default value is null.
DimensionLimit (Optional) The dimension limit settings. By default, the dimension limit settings are specified in the general settings and the option does not need to be used. The dimension limit is applied as an additional rotation restriction, preventing narrow parts to rotate below the limit.
Name (Optional) The name of the raw plate.
Priority (Optional) The priority for the raw plate. The high-priority raw plates are selected before using the low-priority raw plates, regardless their area/cost custom. The default value is 0.
RectangularShape (Optional) Specifies the material as a rectangle defined by Length and Width properties.
Quantity Specifies the number of material sheets. The default value is 1.

 

Raw plate example

{
  "RawPlates": [
    { 
      "RectangularShape": {
        "Length": 2000,
        "Width": 1000
      },
      "Quantity": 1,
    }
  ]
}

Settings

Settings is a JSON object that contains nesting session settings.

Property Description
DimensionLimit (Optional) The dimension limit for the raw plates or null if there is no dimension limit. The default value is null.
DistancePartPart (Optional) The minimum allowed distance between two parts. The default value is 0.
DistancePartRawPlate (Optional) The minimum allowed distance between a part and an edge of a raw plate. The default value is 0.
GroupLayouts (Optional) Multiple identical layouts can be represented in the nesting result either as a single nested raw plate with a specified quantity value or as individual nested raw plates. The default setting is ‘false’, indicating that each layout is treated as a distinct nested raw plate.
MirrorControl (Optional) The mirror control setting for parts. The default value is Never (mirroring not allowed) = [‘Never’, ‘Always’, ‘Allow’].
NestingInHoles (Optional) A value specifying whether nesting in holes is allowed. The default value is true.
NestingMode (Optional) The nesting mode specifies the type of nesting layout. General purpose layouts achieve optimal material utilization. Strips mode generates specialized layouts for profile nesting. The default value is General = [‘General’, ‘Strips’].
PlacementDirection (Optional) A value specifying the placement direction. The default value is LeftDown = [‘LeftDown’, ‘LeftUp’, ‘DownRight’, ‘DownLeft’, ‘RightUp’, ‘RightDown’, ‘UpLeft’, ‘UpRight’].
RotationControl (Optional) The rotation control settings for parts. The default value is Free (parts can be rotated by any angles) = [‘Never’, ‘Fixed180’, ‘Fixed90’, ‘Free’].
RotationTwist (Optional) The rotation twist limit for parts. The default value is 0 (indicating no twist rotation).
SettingsStrips (Optional) The Strips nesting mode specific settings: Sorting = [‘Width’, ‘Length’].

 

Settings example

{
  "Settings": {
    "DistancePartPart": 0,
    "DistancePartRawPlate": 0,
    "MirrorControl": "Allow",
    "NestingInHoles": true,
    "RotationControl": "Fixed90"
  }
}

Stop conditions

Stop conditions is a JSON object that contains nesting stop conditions.

 

Property Description
AllPartsNested A value specifying whether nesting stops on the first result with all input parts nested. The default value is false.
Scrap A value specifying that nesting stops on the first result where scrap is less than the value, or null if this stop condition is disabled. The value, if specified, is in the [0, 1] range, with zero representing no scrap and one representing 100% scrap. The default value is null. This stop condition, as opposed to Scrap2, works against scrap values which exclude the rest plate (unused) length in one of the nested raw plates from total material area used. It is useful for production nesting, to let the nesting engine work on maximizing the rest plate until a satisfactory scrap value is reached. For pre-nesting, however, using Scrap may result in a premature stop (a big rest plate may give good scrap value, while the parts can possibly be nested into a subset of available raw plates with smaller total area/cost). Consider using Scrap2 for pre-nesting inputs instead.
Scrap2 A value specifying that nesting stops on the first result where scrap is less than the value, or null if this stop condition is disabled. The value, if specified, is in the [0, 1] range, with zero representing no scrap and one representing 100% scrap. The default value is null. This stop condition, as opposed to Scrap, works against scrap values which consider area of whole raw plates (no rest plates); in other words, a raw plate is considered wholly used even if there is only one small part nested. This condition makes perfect sense for pre-nesting, where we don’t care about rest plates and want to minimize total area/cost of used raw plates. For production nesting, Scrap may be preferred instead.
SmartStop A value specifying whether the smart stop condition is enabled. If the smart stop condition is enabled, nesting stops automatically if there is little chance that the current result will be subject to further significant improvements. The default value is false.
Timeout A value specifying that nesting stops after given amount of time, or null if the timeout stop condition is disabled. The value, if not null, is in milliseconds, and must be non-negative. The default value is null.

 

Stop conditions example

{
  "StopJson": {
    "AllPartsNested": true,
    "SmartStop": true,
    "Timeout": 5000
  }
}

 

File

A complete JSON file, which can be used as a template.
 

Complete example

{
  "Context": {
    "Settings": {
      "DistancePartPart": 0,
      "DistancePartRawPlate": 0,
      "MirrorControl": "Allow",
      "NestingInHoles": true,
      "RotationControl": "Fixed90"
    },
    "Problem": {
      "Parts": [
        {
          "Contours": [
            {
              "Vertices": [
                {
                  "X": 0,
                  "Y": 0
                },
                {
                  "X": 100,
                  "Y": 0
                },
                {
                  "X": 100,
                  "Y": 100
                },
                {
                  "X": 0,
                  "Y": 100
                }
              ]
            },
            {
              "Vertices": [
                {
                  "X": 30,
                  "Y": 50,
                  "B": -1
                },
                {
                  "X": 70,
                  "Y": 50,
                  "B": -1
                }
              ]
            }
          ],
          "Quantity": 1,
          "RefPt": {
            "X": 0,
            "Y": 0
          }
        },
        {
          "Contours": [
            {
              "Vertices": [
                { 
                  "X": 0,
                  "Y": 0
                },
                {
                  "X": 100,
                  "Y": 0
                },
                {
                  "X": 0,
                  "Y": 100
                }
              ]
            }
          ],
          "Quantity": 1,
          "RefPt": {
            "X": 0,
            "Y": 0
          }
        }
      ],
      "RawPlates": [
        {
          "RectangularShape": {
            "Length": 2000,
            "Width": 1000
          },
          "Quantity": 1
        }
      ]
    }
  },
  "InputName": "Example",
  "MachineNameClient": "Demo",
  "StopJson": {
    "AllPartsNested": true,
    "SmartStop": true,
    "Timeout": 5000
  }
}