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 mandatoryThe name of the optimization profile.
active
bool mandatorySet it to
true
, to activate the profile. It will be used only if it is active.algorithms
object mandatoryConfiguration of algorithms to be used by the profile.
Show Child Attributes
Each algorithm is ignored if
ai
algorithm is enabled.limits
objectHere we can define the conditions for early termination of global and/or single optimization.
Show Child Attributes
stockOrder
objectHere 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
objectHere 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
Profile object
Device
Device object represents a cutting device.
It specifies the features and limitations of the device.
Attributes |
---|
id
int mandatoryUnique device id.
title
string mandatoryDevice title.
materialKind
mandatoryMaterialKind
enum Material kind device's made for
Allowed values
1d
1D materials like profiles, pipes, rods, beams, etc.
2d
2D materials like glass, panels, fabric, aluminum, cardboard, etc.
Specifies the material kind this device is made for.
slants
object 1D onlySpecifies support for miter cuts in 1D materials.
Show Child Attributes
canCutAnyShapes
bool 2D onlydef: falseSet it to
true
if the device allows cutting of non-rectangular shapes (e.g. circles, polygons, etc.).Available only with Ultimate license!It forces special true-nesting algorithm that may be slower than the standard one.canCrossCuts
bool 2D onlydef: falseSet it to
true
if the device allows the cuts to cross each other.Ignored ifcanCutAnyShapes
is enabled.fullCutsOnly
bool 2D onlydef: trueSet it to
true
if only full cuts (from edge to edge) are allowed.Ignored ifcanCutAnyShapes
is enabled.stripCutting
2D onlydef: noneStripCutting
enum Strip cutting direction
Allowed values
none
No strip cutting.
byLength
Horizontal strips.
byWidth
Vertical strips.
Set it to
byLength
orbyWidth
if the device cuts in strips (e.g. for panel saw).It makes sense only if
fullCutsOnly
option is set totrue
.
It may be used together withmaxCutDepth
option.Ignored ifcanCutAnyShapes
is enabled.minCutWidth
lengthdef: 0The 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
2D onlydef: optimalEdgingCuts
enum Specifies the edging method
Allowed values
optimal
An optimal edging method ensures precise and accurate cutting of edges, resulting in clean, smooth, and well-defined boundaries while minimizing any unintended removal or distortion of the desired elements.
horizontalFirst
A "HorizontalFirst" edging method involves cutting off the horizontal edges first, followed by the vertical edges.
verticalFirst
A "VerticalFirst" edging method refers to a technique where the vertical edges are cut off before the horizontal edges.
Edging method.
originEdgingCuts
2D onlydef: defaultOriginEdgingCuts
enum Edging method for the top and left edges.
Allowed values
default
Nothing changes and edges will be cut off as described in
edgingCuts
property description.twoFullCuts
Top and left edges will be cut off as full cuts (from edge to edge)
Edging method for the top and left edges.
firstCutDirection
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 themaxCutDepth
option.Ignored ifcanCutAnyShapes
is enabled.maxCutDepth
object 2D onlySpecifies maximum cut depth level the device is supporting.
The picture below shows what is the cut depth level:Ignored ifcanCutAnyShapes
is enabled.It makes sense only if
fullCutsOnly
is set totrue
.Show Child Attributes
maxCutLengthByLength
objectMaximum 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.
Ignored ifcanCutAnyShapes
is enabled.Show Child Attributes
maxCutLengthByWidth
object 2D onlyMaximum 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.
Ignored ifcanCutAnyShapes
is enabled.Show Child Attributes
costs
objectDefines cost parameters for cost-based optimization. See cmdAddJob's
bestSolutionCriterion
input parameter for more details.Available only with Enterprise license!Show Child Attributes
customData
anyCustom data that will be directly passed to
customData.device
property in Cutting.It can be any JSON compatible data, for example:
{ "myId": "932422" }
,"932422"
, or932422
.Available only with Enterprise license!
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 mandatoryUnique id of a StandardStockItem.
title
stringTitle of a StandardStockItem.
length
length mandatoryLength of a StandardStockItem.
width
length mandatory 2D onlyWidth of a StandardStockItem.
structure
2D onlydef: []Structures
set The structure of the StandardStockItem
Allowed values
none
The material has no structure.
byLength
The structure is horizontal (along length).
byWidth
The structure is vertical (along width).
The structure of the StandardStockItem.
edging
objectEdging 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 mandatoryUnique id of a material group.
deviceId
int mandatoryId of a cutting device used to cut this material group.
algorithm
stringAllows selection of custom algorithms.
Available only with Enterprise license!title
string mandatoryTitle of the material group.
kind
mandatoryMaterialKind
enum Type of the material
Allowed values
1d
1D materials like profiles, pipes, rods, beams, etc.
2d
2D materials like glass, panels, fabric, aluminum, cardboard, etc.
Specifies the type of the material.
width
length mandatory 1D onlySpecifies the width of the material.
thickness
length mandatorySpecifies the thickness of the material.
canHaveStructure
bool 2D onlydef: falseSpecifies whether the material group can have a structure.
colorable
booldef: falseSpecifies whether the pieces can have different colors. It doesn't influence the optimization process.
canRotate
bool def: falseSpecifies whether the pieces of this material group can be rotated.
canMirror
bool def: falseSpecifies whether the pieces of this material group can be reversed (back to front).
qualityLevel
2D onlyQualityLevel
enum Shape path simplification quality level
Allowed values
precission
Highest quality, but slowest.
compromise
Good quality and speed.
speed
Lowest quality, but fastest.
Specifies the quality level used for shape path simplification.
It influences the speed of the optimization process and the quality of the results.
Applies only to true-shape nesting algorithm.surplus
lengthdef: 0This 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: trueThis setting determines whether the surplus can be adjusted in the piece configuration.
If set tofalse
, any surplus specified by the piece will be disregarded and the one defined in material group will be used.margin
lengthdef: 0This 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: trueThis 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: 0Specifies default edging for new stock items.
cuttingDimensions
mandatory2D onlyDimensions
enum Piece size used for cutting
Allowed values
net
The size specified by length & width of the piece will be used.
Note that surplus and margin may be applied if they are specified.gross
The size of the piece will be increased by the thickness of the veneers used.
Specifies what should be the piece size that will be used for cutting.
canBeVeneered
bool 2D onlydef: falseSpecifies whether pieces of the material group can be veneered.
kerf
length mandatorySpecifies the size of the kerf, i.e. the width of the waste line left by the cutting device.
allowEdgeCuts
booldef: falseSpecifies 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.cutShift
object 2D onlyControls automatic shifting of adjacent material segments to prevent blade-overtravel damage when a perpendicular cut must extend beyond the target piece (e.g. stone cutting).
Show Child Attributes
reuseWaste
objectIt defines the criterion for qualifying waste as usable.
Usable waste is one that goes to the warehouse for later use.Show Child Attributes
stackCutting
objectIt defines the stack cutting rules.
Show Child Attributes
weightOfSqM
weight 2D onlydef: 0Weight of a square meter of the material.
weightOfMeter
weight 1D onlydef: 0Weight of a meter of the material.
costs
objectDefines cost parameters for cost-based optimization. See cmdAddJob's
bestSolutionCriterion
input parameter for more details.Available only with Enterprise license!Show Child Attributes
standardStockItems
list(StandardStockItem)The list of standardStockItems for the material group.
customData
anyCustom data that will be directly passed to
customData.material
property in Cutting.It can be any JSON compatible data, for example:
{ "myId": "932422" }
,"932422"
, or932422
.Available only with Enterprise license!
Veneer
The Veneer object specifies characteristics of a veneer.
Attributes |
---|
id
int mandatoryUnique id of the veneer.
title
string mandatoryTitle of the veneer.
width
length mandatoryWidth of the veneer.
thickness
length mandatoryThickness of the veneer.
surplus
length def: 0The surplus is automatically added when the demand for the amount of veneer is calculated. Please note that the surplus is added twice.
maxMaterialThickness
length mandatoryThe maximum thickness of the material for which this veneer can be used.
2D input
Piece
The Piece object describes piece.
Attributes |
---|
id
int mandatoryUnique piece id.
materialId
int mandatoryThe ID of the material group from which this piece will be cut.
identifier
stringThe user defined identifier of the piece. It must be Code128 barcode compatible.
color
stringColor of the piece.
description
stringDescription of the piece.
length
length mandatoryThe net length of the piece.
Keep in mind that for 1D shapes, it is always the total length, including slants:width
length mandatory 2D onlyThe net width of the piece.
shapeType
def: noneShapeType
enum Shape of the piece
Allowed values
none
No shape, the same as rectangle.
rectangle
Just rectangle, so no additional shape definition is necessary.
linear
1D shape with slants. The shape property contains slant values.
any
Any shape. You can define any shape using the shape property - convex or concave, or even with holes.
slantRect
Rectangle with one slanted corner.
L
L-shaped piece.
rightTriangle
Right triangle.
slopeRect
Rectangle with one sloped edge.
trapezoid
Trapezoid shape.
octagon
Octagonal shape.
ellipse
Elliptical shape.
circle
Circular shape.
ring
Ring shape (circular with a hole).
Type of the shape of the piece.
shape
objectDepending on
shapeType
it may contain different format. See Shapes for more information.rotationStep
angledef: 30°Specifies the rotation step. For instance, if it is set to 90, the piece can be rotated only by 0, 90, 180, or 270 degrees.
rotation
angledef: 0°Specifies the initial rotation of the piece. It is useful when you want to have some pieces rotated by default.
mirror
booldef: falseSpecifies whether the piece is mirrored (back to front).
quantity
int mandatorySpecifies quantity of pieces.
structure
2D onlydef: [none,byLength,byWidth]Structures
set Structure of the piece
Allowed values
none
The material has no structure.
byLength
The structure is horizontal (along length).
byWidth
The structure is vertical (along width).
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: 1Priority 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 priority1
.high
corresponds to priority10
.critical
corresponds to priority100
.
Note that when using cost-based optimization, the priority is used as a hint only. It helps the optimizer to start the optimization process, but it is ignored when calculating the quality of the solution.
group
int def: 0Identifier of the destination rack (or pallet) for the piece. The optimizer is free to mix and interleave cuts from different groups in any sequence; only the
order
rule (see below) must be respected within each individual group. Group0
is fully unrestricted: pieces assigned to it may be cut at any moment, in any order, and can break the internal ordering rules that apply to the other groups.order
int def: 0In-group cutting priority. For every non-zero
group
, pieces with a lowerorder
value must leave the cutting line before pieces with a higher value in the same group. If several pieces share the sameorder
, their relative sequence is unconstrained as long as they all precede higher numbers and follow lower numbers in that group. This property is ignored for pieces in group0
.Cross-group deadlock risk: Certain combinations of
order
values across different groups can create circular dependencies (e.g. group 1 needsorder=2
cut before group 2’sorder=1
, while group 2 simultaneously requires the reverse), preventing some pieces from ever being scheduled. Validate order sequences to ensure that no such deadlocks exist.costs
objectDefines cost parameters for cost-based optimization. See cmdAddJob's
bestSolutionCriterion
input parameter for more details.Available only with Enterprise license!Show Child Attributes
surplus
lengthdef: 0Specifies 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: 0Specifies 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 onlySpecifies which veneers should be used.
This parameter is only used if the
shapeType
is specified asnone
orrectangle
and the material group allows veneering (i.e. itscanBeVeneered
property is set totrue
).If
shapeType
is set torectangle
, the veneers specified here will override the veneers in shape definition!Show Child Attributes
customData
anyCustom data that will be directly passed to
customData
property in ResultPiece.It can be any JSON compatible data, for example:
{ "myId": "932422" }
,"932422"
, or932422
.Available only with Enterprise license!
StockItem
The StockItem object describes a StockItem.
Attributes |
---|
id
int mandatoryUnique StockItem id.
materialId
int mandatoryThe ID of the material group the StockItem is made from.
identifier
stringThe user defined identifier of the StockItem.
It must be Code128 barcode compatible.description
stringDescription of the StockItem.
priority
def: normalStockPriority
enum Priority of the StockItem
Allowed values
normal
The StockItem is handled normally.
low
The stock is handled with lower priority – the program will try to avoid it.
Priority of the StockItem.
Note that when using cost-based optimization, the priority is used as a hint only. It helps the optimizer to start the optimization process, but it is ignored when calculating the quality of the solution.
length
length mandatoryLength of the StockItem.
width
length mandatory 2D onlyWidth of the StockItem.
quantity
int mandatoryIf 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
intThe 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
2D onlydef: noneStructure
enum Structure of the StockItem
Allowed values
none
The material has no structure.
byLength
The structure is horizontal (along the length).
byWidth
The structure is vertical (along the width).
Specifies the structure of the StockItem.
edging
objectEdging configuration.
Show Child Attributes
defects
list(Defect)Defines list of defects.
Only the true-shape nesting algorithm currently handles defects. Contact us if you need a defect-aware algorithm.costs
objectDefines cost parameters for cost-based optimization. See cmdAddJob's
bestSolutionCriterion
input parameter for more details.Available only with Enterprise license!Show Child Attributes
customData
anyCustom data that will be directly passed to
customData.stock
property in Cutting.It can be any JSON compatible data, for example:
{ "myId": "932422" }
,"932422"
, or932422
.Available only with Enterprise license!
Defect
This object describes location of stock item's defect.
Attributes |
---|
x
lengthX-coordinate of the defect’s upper-left corner, measured from the stock origin (0 mm, 0 mm) along the primary length (X) axis.
y
lengthY-coordinate of the defect’s upper-left corner, measured from the stock origin along the width (Y) axis.
length
lengthHorizontal extent of the defect parallel to the X axis.
width
lengthVertical extent of the defect parallel to the Y axis.
ResultPiece
This object describes location and transformation of a piece that was placed on a cutting.
Normally you don't have to know how the shapes are transformed,
as we are providing the shape
property, which is already transformed.
But, just in case it is needed for whatever reason, here is how the transformation works.
Here is how 2D piece is positioned depending on its rotation:
Linear pieces are positioned in a different way.
The order of transormation is:
- Rotation - rotation is done around the origin point
[0, 0]
of the shape. - Mirror - a flip around the
Y
axis. - theY
coordinates are simply multiplied by-1
. - Translation - the shape is moved to its target position, so its
[0, 0]
is placed on[x, y]
position.
Attributes |
---|
pieceId
intID of the piece.
x
lengthX position of the piece.
y
lengthY position of the piece.
rotation
angleSpecifies the rotation angle of the piece.
Note that in previous versions of the JSON format (older than
3
), we hadrotated
boolean property instead. The way the pieces are transformed is different for 1D and 2D materials.For 1D materials, it is easy. The piece may be rotated by 0° or 180°. If it is rotated, the
rotation
property will be180°
, otherwise it will be0°
. It works like before.But, for 2D materials, it is different now. The rotation is always done around the origin point of the piece.
See also the transformation order above.
mirrored
boolSpecifies if the piece was reversed (back to front).
See also the transformation order above.
shape
stringThe shape of the piece after rotation and mirror transformations were applied. See Shapes for more information.
The shape is in SVG path format.
bbox
objectThe bounding box of the piece including all modificators: net/gross dimensions, surplus and margin.
Show Child Attributes
customData
anyCustom data passed directly from
customData
property in Piece.Available only with Enterprise license!
Waste
The Waste object describes a waste item.
Attributes |
---|
x
lengthX position of the waste.
y
lengthY position of the waste.
length
lengthLength of the waste.
width
lengthWidth of the waste.
identifier
stringAutomatically generated identifier string.
usable
boolSpecifies whether the waste is usable.
shapeType
ShapeType
enum Shape of the waste
Allowed values
none
No shape, the same as rectangle.
rectangle
Just rectangle, so no additional shape definition is necessary.
linear
1D shape with slants. The shape CustomProperty contains slant values.
Type of the shape of the waste.
shape
objectDepending on
shapeType
it may contain different format.For the moment only LinearShape is supported.
Cut
Cut object describes a cut to be made.
At the moment, we only support straight cuts in the form of segments.
Attributes |
---|
type
CutType
enum Type of the cut
Allowed values
line
A straight cut segment between two points.
curve
A cubic bezier curve cut between two points with two control points.
Type of the cut.
startX
lengthStart X position of the cut.
startY
lengthStart Y position of the cut.
endX
lengthEnd X position of the cut.
endY
lengthEnd Y position of the cut.
startXp
lengthFirst control point's X position for cubic bezier curve.
startYp
lengthFirst control point's Y position for cubic bezier curve.
endXp
lengthSecond control point's X position for cubic bezier curve.
endYp
lengthSecond control point's Y position for cubic bezier curve.
needShift
boolSignals that the material segments produced by this cut must be shifted apart immediately after the tool passes. May be set to
true
only when the Material optioncutExcess > 0
.None of the standard algorithms currently handle segment shifting. Contact us if you need such an algorithm.
Cutting
The Cutting object describes single cutting.
Attributes |
---|
stockItemId
int mandatoryID of the StockItem for which this cut is made.
quantity
int mandatoryIf 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.stackSize
intIf stack cutting is enabled for the material, it indicates the size of a single stack.
statistics
object mandatoryStatistics of the entire cutting.
Show Child Attributes
pieces
list(ResultPiece) mandatoryA list of all pieces placed on the cutting, including their positions and transformations.
rest
list(Waste) mandatoryA list of all Waste items, including their positions and sizes.
cuts
list(Cut) mandatoryA list of Cut objects.
cost
priceTotal estimated production cost for the entire nesting job, calculated from the Device, Material and StockItem
costs
parameters (machine time, tool wear, material price, etc.).Available only with Enterprise license!gain
priceTotal profit for the nesting job, defined as income (selling price) minus
cost
. When cost-based optimisation is enabled, solutions are ranked by the highest positivegain
.Available only with Enterprise license!customData
objectCustom data passed directly from
customData
properties in Device, Material and StockItem.Available only with Enterprise license!Show Child Attributes