Part and material geometry
Nesting is a process of creating a layout for geometrical shapes in the specified raw material sheets. Typically, nested parts are represented with irregular shapes and material is defined as rectangular sheet. Parts often contain holes. Depending on the nesting settings other smaller parts can be nested inside bigger parts holes.
Part geometry is defined by curves forming closed contours. For a simple shape without holes, part geometry is a single outer contour. When the part contains holes, it is built from an outer contour and number of inner contours representing holes or restricted area.
Shape definition
As input to the Nesting Center API the geometrical data should be collected in JSON object. Each part or material object contains array of contours under property "Contours". Usually the first element in the array is the outer contour and the remaining array elements represent the inner contours. Contours can be classified as oriented clockwise or counterclockwise. In nesting computations it is important to define elements with correct orientation.
Rules for contour directions:

Parts
The outer contour should be counterclockwise and the inner contours should be clockwise. 
Material
The outer contour should be clockwise and the inner contours should be counterclockwise.
A contour is composed of line and arc segments.
A contour vertex is defined by an (X, Y) position and optional arc bulge.
A line segment starts at the given vertex (X, Y) position and ends at the following vertex (X, Y) position.
An arc segment starts at the given vertex (X, Y) position and ends at the following vertex (X, Y) position when a nonzero bulge is specified. The bulge is the tangent of 1/4 of the angle for the arc between the starting vertex and the ending vertex. If a bulge is positive it means that the arc direction is counterclockwise. If a bulge is negative it means that the arc direction is clockwise.
Part example
{
"Contours": [
{
"Vertices": [
{
"X": 0,
"Y": 0
},
{
"X": 250,
"Y": 0,
"B": 0.6
},
{
"X": 250,
"Y": 200
},
{
"X": 0,
"Y": 200
}
]
},
{
"Vertices": [
{
"X": 150,
"Y": 100,
"B": 1
},
{
"X": 250,
"Y": 100,
"B": 1
}
]
}
]
}
Complex shapes
Nesting Center API supports elements with complex shapes consisting of multiple lines, arcs, splines and elliptical arcs. The part property "ContoursEx” contains array of closed contours defined as Curve2CompositeClosed. Each element is described by “Type” and “Data” properties. There are following types of geometry: PolylineBulge, EllipticalArc2, Nurbs2.
PolylineBulge
Describes a curve composed of line and arc segments defined by sequence of vertices.
EllipticalArc2
Describes an ellipse defined by properties “Centre”, “MajorAxis”, “Ratio” and the arc range defined by “Start” and “Sweep” angle.
Nurbs2
Describes a spline curve defined by properties "ControlPoints", "Knots", "Weights".
Complex part example
{
"ContoursEx": [
{
"Type": "Curve2CompositeClosed",
"Data": {
"Chunks": [
{
"Type": "PolylineBulge",
"Data": {
"Vertices": [
{
"X": 250,
"Y": 200
},
{
"X": 0,
"Y": 200
},
{
"X": 0,
"Y": 0
},
{
"X": 250,
"Y": 0
}
]
}
},
{
"Type": "Nurbs2",
"Data": {
"ControlPoints": [
{
"X": 250,
"Y": 0
},
{
"X": 300,
"Y": 0
},
{
"X": 400,
"Y": 100
},
{
"X": 300,
"Y": 200
},
{
"X": 250,
"Y": 200
}
],
"Knots": [ 0, 0, 0, 0, 141, 282, 282, 282, 282 ],
"Weights": [ 1, 1, 1, 1, 1 ]
}
}
]
}
}
]
}