Calculate the optimal number of dielines (num_x and num_y) that can fit on a sheet for each available nesting template. This endpoint helps you determine the most efficient nesting template for your sheet dimensions before creating a nesting.
| dieline_id string |
The unique identifier of the dieline for which to calculate efficiencies. required
Example: "di_fwe4iu3vngty" |
||||||||||||
| variables object |
Key-value pairs including values for sheet dimensions that define the layout for calculating efficiencies. required
|
Represents the calculated efficiencies (optimal num_x and num_y) for each nesting template available for the specified dieline and sheet dimensions.
| type string | "nesting_template_efficiencies" | ||||||||||||
| dieline_id string |
The unique identifier of the dieline.
Example: "di_fwe4iu3vngty" |
||||||||||||
| dieline_template_id string |
Unique identifier for the dieline template that this dieline is based on.
Example: "becf-30203" |
||||||||||||
| variables object |
The variables used for the calculation.
{
"unit": "mm",
"sheet_width": 1000.0,
"sheet_height": 700.0,
"sheet_margin_top": 15.0,
"sheet_margin_bottom": 20.0,
"sheet_margin_side": 10.0
}
|
||||||||||||
| efficiencies object |
A map of nesting template IDs to their calculated efficiencies. Each key is a nesting template ID (e.g., "lt_xyz123abc" for LayoutTemplate or "lg_abc456def" for LayoutTemplateGroup), and each value is an object containing:
Note: Templates that cannot calculate efficiency (e.g., missing output formulas) will have a null value. |
||||||||||||
| nesting_templates array |
An array of nesting template objects, each containing all the information needed to create a nesting. This allows you to select the most efficient template and create a nesting in a single workflow without making a separate call to list nesting templates.
Each nesting template object contains:
See the Nesting Templates documentation for full details on the nesting_template object structure. |
||||||||||||
| nesting_template_components array |
A unique list of all nesting template components across all templates. Each component represents a part of the dieline that can be nested (e.g., "Hard cardboard of the box").
Each component object contains:
|
curl -i -X POST \
https://api.diecuttemplates.com/dielines/di_fwe4iu3vngty/nesting-template-efficiencies \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR_DIELINES_API_KEY_HERE>" \
-H "Dielines-Api-Version: 1.0" \
-d '{
"variables": {
"unit": "mm",
"sheet_width": 1000.0,
"sheet_height": 700.0,
"sheet_margin_top": 15.0,
"sheet_margin_bottom": 20.0,
"sheet_margin_side": 10.0
}
}'
require 'uri'
require 'net/http'
require 'openssl'
url = URI('https://api.diecuttemplates.com/dielines/di_fwe4iu3vngty/nesting-template-efficiencies')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Content-Type'] = 'application/json'
request['Dielines-Api-Version'] = '1.0'
request['Authorization'] = 'Bearer <YOUR_DIELINES_API_KEY_HERE>'
params = {
"variables": {
"unit": "mm",
"sheet_width": 1000.00,
"sheet_height": 700.00,
"sheet_margin_top": 15.00,
"sheet_margin_bottom": 20.00,
"sheet_margin_side": 10.00
}
}
request.body = params.to_json
response = http.request(request)
puts response.read_body
$url = 'https://api.diecuttemplates.com/dielines/di_fwe4iu3vngty/nesting-template-efficiencies';
$data = [
"variables" => [
"unit" => "mm",
"sheet_width" => 1000.00,
"sheet_height" => 700.00,
"sheet_margin_top" => 15.00,
"sheet_margin_bottom" => 20.00,
"sheet_margin_side" => 10.00
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Dielines-Api-Version: 1.0',
'Authorization: Bearer <YOUR_DIELINES_API_KEY_HERE>'
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
} else {
echo 'Response: ' . $response;
}
curl_close($ch);
application/json {
"nesting_template_efficiencies": {
"type": "nesting_template_efficiencies",
"dieline_id": "di_fwe4iu3vngty",
"dieline_template_id": "becf-30203",
"variables": {
"unit": "mm",
"sheet_width": 1000.0,
"sheet_height": 700.0,
"sheet_margin_top": 15.0,
"sheet_margin_bottom": 20.0,
"sheet_margin_side": 10.0
},
"efficiencies": {
"lt_NJYkRajK70": {
"num_x": 9,
"num_y": 8,
"efficiency": {
"value": 72.0,
"type": "percentage"
}
},
"lt_2lY22jOYP6": {
"num_x": 7,
"num_y": 6,
"efficiency": {
"value": 58.5,
"type": "percentage"
}
},
"lg_xyz789abc": null
},
"nesting_templates": [
{
"type": "nesting_template",
"id": "lt_NJYkRajK70",
"nesting_template_components": [
{
"type": "nesting_template_component",
"id": "hard-cardboard-of-the-box",
"name": "Hard cardboard of the box",
"category": "hard_cardboard"
}
],
"variables": [
{
"type": "dieline_template_variable",
"name": "sheet_width",
"description": "Width of the sheet",
"data_type": "length",
"required": true,
"children": []
},
{
"type": "dieline_template_variable",
"name": "sheet_height",
"description": "Height of the sheet",
"data_type": "length",
"required": true,
"children": []
},
{
"type": "dieline_template_variable",
"name": "sheet_margin_top",
"description": "Margin from the top edge of the sheet",
"data_type": "length",
"required": false,
"children": []
},
{
"type": "dieline_template_variable",
"name": "sheet_margin_bottom",
"description": "Margin from the bottom edge of the sheet",
"data_type": "length",
"required": false,
"children": []
},
{
"type": "dieline_template_variable",
"name": "sheet_margin_side",
"description": "Margin from both left and right edges of the sheet",
"data_type": "length",
"required": false,
"children": []
},
{
"type": "dieline_template_variable",
"name": "num_x",
"description": "Number of dielines on the x axis.",
"data_type": "integer",
"required": false,
"children": []
},
{
"type": "dieline_template_variable",
"name": "num_y",
"description": "Number of dielines on the y axis",
"data_type": "integer",
"required": false,
"children": []
},
{
"type": "dieline_template_variable",
"name": "margin_x",
"description": "Horizontal spacing ",
"data_type": "length",
"required": false,
"default_value": {
"value": "0.0",
"unit": "mm"
},
"children": []
},
{
"type": "dieline_template_variable",
"name": "margin_y",
"description": "Vertical spacing",
"data_type": "length",
"required": false,
"default_value": {
"value": "0.0",
"unit": "mm"
},
"children": []
}
],
"images": [
{
"type": "svg",
"url": "https://example.com/nesting_template.svg"
}
],
"links": [
{
"rel": "create_nesting",
"href": "/dielines/di_fwe4iu3vngty/nestings/lt_NJYkRajK70",
"method": "POST"
}
]
},
{
"type": "nesting_template",
"id": "lt_2lY22jOYP6",
"nesting_template_components": [
{
"type": "nesting_template_component",
"id": "hard-cardboard-of-the-box",
"name": "Hard cardboard of the box",
"category": "hard_cardboard"
}
],
"variables": [
{
"type": "dieline_template_variable",
"name": "sheet_width",
"description": "Width of the sheet",
"data_type": "length",
"required": true,
"children": []
},
{
"type": "dieline_template_variable",
"name": "sheet_height",
"description": "Height of the sheet",
"data_type": "length",
"required": true,
"children": []
},
{
"type": "dieline_template_variable",
"name": "sheet_margin_top",
"description": "Margin from the top edge of the sheet",
"data_type": "length",
"required": false,
"children": []
},
{
"type": "dieline_template_variable",
"name": "sheet_margin_bottom",
"description": "Margin from the bottom edge of the sheet",
"data_type": "length",
"required": false,
"children": []
},
{
"type": "dieline_template_variable",
"name": "sheet_margin_side",
"description": "Margin from both left and right edges of the sheet",
"data_type": "length",
"required": false,
"children": []
},
{
"type": "dieline_template_variable",
"name": "num_x",
"description": "Number of dielines on the x axis.",
"data_type": "integer",
"required": false,
"children": []
},
{
"type": "dieline_template_variable",
"name": "num_y",
"description": "Number of dielines on the y axis",
"data_type": "integer",
"required": false,
"children": []
}
],
"images": [
{
"type": "svg",
"url": "https://example.com/nesting_template.svg"
}
],
"links": [
{
"rel": "create_nesting",
"href": "/dielines/di_fwe4iu3vngty/nestings/lt_2lY22jOYP6",
"method": "POST"
}
]
}
],
"nesting_template_components": [
{
"type": "nesting_template_component",
"id": "hard-cardboard-of-the-box",
"name": "Hard cardboard of the box",
"category": "hard_cardboard"
}
]
}
}
| message string |
High level error message. Example: "Validation failed for one or more variables" More detailed error messages can be included in the "errors" object. |
||
| errors object |
|
application/json {
"message": "Validation failed for one or more variables",
"errors": [
{
"message": "sheet_width and sheet_height are required"
}
]
}