Data Objects

Learn about usage of Data Object in Toncut, using examples and clearly readable tables.

Profile

Profile refers to an optimization profile.

It describes the configuration for algorithms to be used and optimization limits, such as maximum time, maximum number of combination, etc.

An optimization profile allows users to specify the parameters and constraints for an optimization process, ensuring that the algorithms used are tailored to their specific needs and requirements.

The user can define up to 20 profiles, allowing them to test different optimization strategies to achieve the best results.

Attributes
  • name
    string mandatory

    The name of the optimization profile.

  • active
    bool mandatory

    Set it to true, to activate the profile. It will be used only if it is active.

  • algorithms
    object mandatory

    Configuration of algorithms to be used by the profile.

    Show Child Attributes

    Each algorithm is ignored if ai algorithm is enabled.

  • limits
    object

    Here we can define the conditions for early termination of global and/or single optimization.

    Show Child Attributes

  • stockOrder
    object

    Here we can specify the stock sequence strategy. This is of great importance and can significantly affect the quality of the results.

    These settings apply to all algorithms except ai.

    Show Child Attributes

  • advanced
    object

    Here we can change some advanced settings.

    Before you change anything here, make sure you understand what you are doing, as these settings may significantly change the quality of results and also time of the optimization process.

    Show Child Attributes

The profile object config

{
  "profiles": {
    "name": "fromSmall",
    "active": true,
    "algorithms": {
      "grouping": true,
      "deduction": true,
      "lastStockItem": true,
      "firstHit": true,
      "fast": false,
      "balance": false,
      "forking": {
          "enabled": false,
          "level": 1
      },
      "adaptive": {
          "enabled": true,
          "level": 5
      },
      "ai": {
          "enabled": false,
          "level": 0
      }
    },
    "limits": {
      "maxCombinations": {
          "enabled": false,
          "limit": 5000000
      },
      "maxTimeSingle": {
          "enabled": false,
          "limit": "5s"
      },
      "maxTime": {
          "enabled": false,
          "limit": "0s"
      },
      "goodEnoughWaste": {
          "enabled": false,
          "limit": "0.00%"
      }
    },
    "stockOrder": {
      "order": {
          "direction": "fromSmall",
          "switchToSmall": {
            "enabled": false,
            "minWaste": "0.20%"
          },
          "randomOrders": {
            "enabled": false,
            "count": 5
          },
          "randomDrawCount": 10
      },
      "adaptiveOrder": {
          "enabled": true,
          "minWaste": "0.15%",
          "maxTries": 3,
          "maxCycles": 1
      }
    },
    "advanced": {
      "dynamicMethodSwitch": {
          "enabled": true,
          "threshold": "1s"
      },
      "fastMethodForLastStockItems": {
          "enabled": true,
          "threshold": "0.80%"
      },
      "searchDirection": "auto",
      "searchPrecision": {
          "firstLevel": 2147483647,
          "nextLevels": 1
      }
    }
  }
}

Device

Device object represents a cutting device.

It specifies the features and limitations of the device.

Attributes
  • id
    int mandatory

    Unique device id.

  • title
    string mandatory

    Device title.

  • materialKind

    MaterialKindenum

    mandatory

    Specifies the material kind this device is made for.

  • slants
    object 1D only

    Specifies support for miter cuts in 1D materials.

    Show Child Attributes

  • canCrossCuts
    bool 2D onlydef: false

    Set it to true if the device allows the cuts to cross each other.

  • fullCutsOnly
    bool 2D onlydef: true

    Set it to true if only full cuts (from edge to edge) are allowed.

  • stripCutting

    StripCuttingenum

    2D onlydef: none

    Set it to byLength or byWidth if the device cuts in strips (e.g. for panel saw).

    It makes sense only if fullCutsOnly option is set to true.
    It may be used together with maxCutDepth option.

  • minCutWidth
    lengthdef: 0

    The minimum distance between two cuts.

    Setting this value makes sense when cutting glass – you don't want to have two parallel cuts too close to each other, because then breaking off can be significantly more difficult.

    Please note that this is not a kerf that can be set in the material group settings.

  • edgingCuts

    EdgingCutsenum

    2D onlydef: optimal

    Edging method.

  • originEdgingCuts

    OriginEdgingCutsenum

    2D onlydef: default

    Edging method for the top and left edges.

  • firstCutDirection

    CutDirectionenum

    2D onlydef: any

    Specifies whether the first cut will be done horizontally or vertically. Note that it is overwritten if strip cutting is turned on.

    It's important to note that setting the correct firstCutDirection can be crucial when used in conjunction with the maxCutDepth option.

  • maxCutDepth
    object 2D only

    Specifies maximum cut depth level the device is supporting.
    The picture below shows what is the cut depth level:

    CutDepth

    It makes sense only if fullCutsOnly is set to true.

    Show Child Attributes

  • maxCutLengthByLength
    object

    Maximum horizontal cut length.
    It can also be used when cutting in strips - then it allows to limit the width of the strip.

    This option is especially useful when the device is a guillotine.

    Show Child Attributes

  • maxCutLengthByWidth
    object 2D only

    Maximum vertical cut length.
    It can also be used when cutting in strips - then it allows to limit the width of the strip.

    This option is especially useful when the device is a guillotine.

    Show Child Attributes

{
  "devices": [
    {
      "title": "Device 1D",
      "materialKind": "1d",
      "slants": {
          "supported": true,
          "leftMeasurement": "fromMiddleToRight",
          "rightMeasurement": "fromMiddleToLeft"
      },
      "minCutWidth": 0,
      "edgingCuts": "optimal",
      "maxCutLengthByLength": {
          "enabled": false,
          "limit": 10000
      },
      "id": 1
    }
  ]
}

StandardStockItem

The StandardStockItem object is used to define standard dimensions and default characteristics of stock items.

For each material you can define list of standard stock items.

Attributes
  • id
    int mandatory

    Unique id of a StandardStockItem.

  • title
    string

    Title of a StandardStockItem.

  • length
    length mandatory

    Length of a StandardStockItem.

  • width
    length mandatory 2D only

    Width of a StandardStockItem.

  • structure

    Structuresset

    2D onlydef: []

    The structure of the StandardStockItem.

  • edging
    object

    Edging configuration.

    Show Child Attributes


Material

The Material object defines material group.

Each piece or StockItem must belong to a material group.

Thanks to this, the program knows which pieces are to be placed on which stock items.

Attributes
  • id
    int mandatory

    Unique id of a material group.

  • deviceId
    int mandatory

    Id of a cutting device used to cut this material group.

  • title
    string mandatory

    Title of the material group.

  • kind

    MaterialKindenum

    mandatory

    Specifies the type of the material.

  • width
    length mandatory 1D only

    Specifies the width of the material.

  • thickness
    length mandatory

    Specifies the thickness of the material.

  • canHaveStructure
    bool 2D onlydef: false

    Specifies whether the material group can have a structure.

  • colorable
    booldef: false

    Specifies whether the pieces can have different colors. It doesn't influence the optimization process.

  • canRotate
    bool 1D onlydef: false

    Specifies whether the pieces of this material group can be rotated.

    Rotation
  • canMirror
    bool 1D onlydef: false

    Specifies whether the pieces of this material group can be reversed (back to front).

    Mirror
  • surplus
    lengthdef: 0

    This setting defines the default surplus for pieces, meaning the amount by which each cut element will be enlarged on all sides.

    For instance, if a piece is 300x200 and the surplus is set to 2, the optimizer will use a size of 304x204.

    In the case of 1D materials, this applies, of course, only to the length.

  • surplusEditable
    booldef: true

    This setting determines whether the surplus can be adjusted in the piece configuration.

    If set to false, any surplus specified by the piece will be disregarded and the one defined in material group will be used.

  • margin
    lengthdef: 0

    This setting determines the default margin for pieces, which is the amount by which each cut element will be reduced on all sides.

    For instance, if a piece is 300x200 and the margin is set to 2, the optimizer will use 296x196.

    In the case of 1D materials, this applies, of course, only to the length.

  • marginEditable
    booldef: true

    This setting determines whether the margin can be adjusted in the piece configuration.

    If set to false, any margin specified by the piece will be disregarded and the one defined in material group will be used.

  • defaultEdging
    lengthdef: 0

    Specifies default edging for new stock items.

  • cuttingDimensions

    Dimensionsenum

    mandatory2D only

    Specifies what should be the piece size that will be used for cutting.

  • canBeVeneered
    bool 2D onlydef: false

    Specifies whether pieces of the material group can be veneered.

  • kerf
    length mandatory

    Specifies the size of the kerf, i.e. the width of the waste line left by the cutting device.

    Kerf image
  • allowEdgeCuts
    booldef: false

    Specifies whether it is possible to do something that we call the “edge cutting”.

    If you have 2mm to cut off and the kerf is 3mm, then you kind of have to "take off" those 2mm with just the saw blade - that's edge cutting.

    It is ignored if minCutWidth property of used cutting device is greater than zero.

  • reuseWaste
    object

    It defines the criterion for qualifying waste as usable.
    Usable waste is one that goes to the warehouse for later use.

    Show Child Attributes

  • stackCutting
    object

    It defines the stack cutting rules.

    Show Child Attributes

  • standardStockItems

    The list of standardStockItems for the material group.

{
  "materials": [
    {
      "deviceId": 1,
      "title": "Material 1D",
      "kind": "1d",
      "width": 100,
      "thickness": 100,
      "canRotate": true,
      "canMirror": true,
      "surplus": 0,
      "surplusEditable": true,
      "margin": 0,
      "marginEditable": true,
      "defaultEdging": 0,
      "kerf": 0,
      "allowEdgeCuts": true,
      "reuseWaste": {
          "minLongerLength": 200,
          "edging": {
            "enabled": false,
            "default": 0
          }
      },
      "canBeVeneered": true,
      "id": 3
    }
  ]
}

Veneer

The Veneer object specifies characteristics of a veneer.

Attributes
  • id
    int mandatory

    Unique id of the veneer.

  • title
    string mandatory

    Title of the veneer.

  • width
    length mandatory

    Width of the veneer.

  • thickness
    length mandatory

    Thickness of the veneer.

  • surplus
    length mandatory

    The surplus is automatically added when the demand for the amount of veneer is calculated. Please note that the surplus is added twice.

  • maxMaterialThickness
    length mandatory

    The maximum thickness of the material for which this veneer can be used.

2D input

{
"veneers": [
    {
      "title": "Oak",
      "width": 22,
      "thickness": 1.5,
      "maxMaterialThickness": 18,
      "id": 1
    }
  ]
}

Piece

The Piece object describes piece.

Attributes
  • id
    int mandatory

    Unique piece id.

  • materialId
    int mandatory

    The ID of the material group from which this piece will be cut.

  • identifier
    string

    The user defined identifier of the piece. It must be Code128 barcode compatible.

  • color
    string

    Color of the piece.

  • description
    string

    Description of the piece.

  • length
    length mandatory

    The net length of the piece.

    Keep in mind that for 1D shapes, it is always the total length, including slants:

  • width
    length mandatory 2D only

    The net width of the piece.

  • shapeType

    ShapeTypeenum

    def: none

    Type of the shape of the piece.

  • shape
    object

    Depending on shapeType it may contain different format.

    For the moment only LinearShape is supported.

  • quantity
    int mandatory

    Specifies quantity of pieces.

  • structure

    Structuresset

    2D onlydef: [none,byLength,byWidth]

    Specifies acceptable structures of the piece.
    Usually you want to specify only one value here, e.g. byLength.

    But, sometimes you don’t care what structure a piece will have – then you can set it to “none,byLength,byWidth”.

  • priority
    int def: 1

    Priority of the piece. It can be any positive integer number. TonCut will use higher-priority pieces even if they cause larger waste.

    The priority can also be expressed as a string, where:

    • normal corresponds to priority 1.
    • high corresponds to priority 10.
    • critical corresponds to priority 100.

  • surplus
    lengthdef: 0

    Specifies the surplus, meaning the amount by which the piece size will be enlarged on all sides.

    For instance, if a piece is 300x200 and the surplus is set to 2, the optimizer will use a size of 304x204.

    In the case of 1D materials, this applies, of course, only to the length.

  • margin
    lengthdef: 0

    Specifies the margin, which is the amount by which the piece size will be reduced on all sides.

    For instance, if a piece is 300x200 and the margin is set to 2, the optimizer will use 296x196.

    In the case of 1D materials, this applies, of course, only to the length.

  • veneers
    object 2D only

    Specifies which veneers should be used.

    Show Child Attributes

{
  "pieces": [
    {
      "materialId": 3,
      "identifier": "",
      "length": 500,
      "shapeType": "linear",
      "quantity": 15,
      "priority": "normal",
      "description": "",
      "surplus": 0,
      "margin": 0,
      "shape": {
          "leftAngle": 45,
          "rightAngle": 25
      },
      "id": 1
    },
    {
      "materialId": 3,
      "identifier": "",
      "length": 532,
      "shapeType": "linear",
      "quantity": 12,
      "priority": "normal",
      "description": "",
      "surplus": 0,
      "margin": 0,
      "shape": {
          "leftAngle": 35,
          "rightAngle": -25
      },
      "id": 2
    }
  ]
}

LinearShape

The LinearShape object describes slant angles for the linear (1D) pieces or waste.

The angles given here are always measured in the same way, regardless of the cutting device settings.

  • leftAngle
    angle mandatory

    Left slant angle measured from middle to right.

    fromMiddleToRight
  • rightAngle
    angle mandatory

    Right slant angle measured from middle to left.

    fromMiddleToLeft

StockItem

The StockItem object describes a StockItem.

Attributes
  • id
    int mandatory

    Unique StockItem id.

  • materialId
    int mandatory

    The ID of the material group the StockItem is made from.

  • identifier
    string

    The user defined identifier of the StockItem.
    It must be Code128 barcode compatible.

  • description
    string

    Description of the StockItem.

  • priority

    StockPriorityenum

    def: normal

    Priority of the StockItem.

  • length
    length mandatory

    Length of the StockItem.

  • width
    length mandatory 2D only

    Width of the StockItem.

  • quantity
    int mandatory

    If stack cutting is enabled for the Material, it specifies the quantity of stacks. Otherwise, it indicates the quantity of stock items.

    The meaning of the quantity property varies depending on whether stack cutting is enabled or disabled.

  • stackSize
    int

    The stack size. Note that stack cutting applies only to stock items with standard dimensions.

    Applies only to material groups with enabled stack cutting. See the stackCutting property of the Material data object.

  • structure

    Structureenum

    2D onlydef: none

    Specifies the structure of the StockItem.

  • edging
    object

    Edging configuration.

    Show Child Attributes

{
  "stock": [
    {
      "materialId": 3,
      "identifier": "",
      "description": "",
      "priority": "normal",
      "length": 6000,
      "quantity": 10,
      "edging": {
          "left": 0,
          "right": 0
      },
      "id": 2
    }
  ]
}

ResultPiece

This object describes location and transformation of a piece
that was placed on a cutting.

Here is how 2D piece is positioned depending on its transformation:

Linear pieces are positioned in a different way. Besides that they have additional transformation (mirror).

Attributes
  • pieceId
    int

    ID of the piece.

  • x
    length

    X position of the piece.

  • y
    length

    Y position of the piece.

  • rotated
    bool

    Specifies if the piece was rotated.

    Rotation
  • mirrored
    bool

    Specifies if the piece was reversed (back to front).

    Mirror

    Temporarily 1D only.

{
  "pieces": [
    {
      "pieceId": 3,
      "x": 0,
      "y": 0,
      "rotated": false,
      "mirrored": false
    },
    {
      "pieceId": 3,
      "x": 820,
      "y": 0,
      "rotated": true,
      "mirrored": false
    },
    {
      "pieceId": 3,
      "x": 1613.2,
      "y": 0,
      "rotated": false,
      "mirrored": false
    },
    {
      "pieceId": 3,
      "x": 2433.2,
      "y": 0,
      "rotated": true,
      "mirrored": false
    }
  ]
}

Waste

The Waste object describes a waste item.

Attributes
  • x
    length

    X position of the waste.

  • y
    length

    Y position of the waste.

  • length
    length

    Length of the waste.

  • width
    length

    Width of the waste.

  • identifier
    string

    Automatically generated identifier string.

  • usable
    bool

    Specifies whether the waste is usable.

  • shapeType

    ShapeTypeenum

    Type of the shape of the waste.

  • shape
    object

    Depending on shapeType it may contain different format.

    For the moment only LinearShape is supported.

{
  "rest": [
    {
      "x": 0,
      "y": 0,
      "length": 0,
      "width": 100,
      "shapeType": "linear",
      "shape": {
          "leftAngle": "0.00rad",
          "rightAngle": "0.00rad"
      },
      "identifier": "",
      "usable": false
    },
    {
      "x": 5952.8,
      "y": 0,
      "length": 74,
      "width": 100,
      "shapeType": "linear",
      "shape": {
          "leftAngle": "0.26rad",
          "rightAngle": "0.00rad"
      },
      "identifier": "",
      "usable": false
    }
  ]
}

Cut

Cut object describes a cut to be made.

At the moment, we only support straight cuts in the form of segments.

Attributes
  • startX
    length

    Start X position of the cut.

  • startY
    length

    Start Y position of the cut.

  • endX
    length

    End X position of the cut.

  • endY
    length

    End Y position of the cut.

{
  "cuts": [
    {
      "startX": 820,
      "startY": 0,
      "endX": 793.2,
      "endY": 100
    },
    {
      "startX": 1613.2,
      "startY": 0,
      "endX": 1613.2,
      "endY": 100
    },
    {
      "startX": 2433.2,
      "startY": 0,
      "endX": 2406.4,
      "endY": 100
    },
    {
      "startX": 3226.4,
      "startY": 0,
      "endX": 3226.4,
      "endY": 100
    }
  ]
}

Cutting

The Cutting object describes single cutting.

Attributes
  • stockItemId
    int

    ID of the StockItem for which this cut is made.

  • quantity
    int

    If stack cutting is enabled for the material, it indicates the number of stacks the cutting should be performed for. Otherwise, it indicates the number of times the cutting should be performed.

    The meaning of the quantity property varies depending on whether stack cutting is enabled or disabled.

  • statistics
    object

    Statistics of the entire cutting.

    Show Child Attributes

  • pieces

    A list of all pieces placed on the cutting, including their positions and transformations.

  • rest
    list(Waste)

    A list of all Waste items, including their positions and sizes.

  • cuts
    list(Cut)

    A list of Cut objects.

{
  "cuttings": [
    {
      "stockItemId": 2,
      "quantity": 3,
      "statistics": {
        "1d": {
          "length": 6000,
          "usedLength": 5939.4,
          "wasteLength": 60.6,
          "unusedLength": 0,
          "cutCount": 8,
          "cutsLength": 817.64466576987
        }
      },
      // ...
    }
  ]
}