Load Calculator API
- Version 1.1
Request
The request is made using the POST method at the link with API key in URL query:
https://www.searates.com/stuffing/api?key=YOUR-API-KEY
The request header must contain:
Content-type: application/json
The Load Calculator API request is generated in JSON format and consists of 5 main sections (articles):
Options
Precision and weight units and length settings
Length Accuracy
How does rounded accuracy work? Sets the step size simplifies object placement.
Allows you to equalize the difference in height, width, length of different boxes.
Example calculations for lengthAccuracy = 4
Example of a box
Groups
Groups are an array of JSON objects arranged in a strict order, which is taken into account when stuffing containers. The closer to the beginning of the array the group, the earlier it will be stuffed.
A group can contain a pallet setting for a group.
Pallets
The quantity of pallets is infinite. You cannot limit the number of pallets. Only one type of pallet can be used per group. If no pallets are specified, the group will be loaded without using pallets.
length: Number
width: Number
height: Number
maxHeight
layers
fill
rollPlacement
loadType
order
Pallet stacking & stuffing settings
“auto”
“wallLength”
“wallWidth”
“floor”
“auto”
“volume_asc”
“volume_desc”
“square_asc”
“square_desc”
“mps_asc”
“mps_desc”
“vps_asc”
“vps_desc”
Priority of cargo placement order.
You can set volume, floor square, mps (mass per square) or vps (volume per square) in ascending or descending order priority.
Items
List of objects to load. The order of the object in the list does not matter. The algorithm will select objects based on stuffing options, container loading rules, and built-in algorithms.
The system uses 2 main types of supported objects: box and roll.
Box Object
BOX object. Describes the types of loadable objects such as box, big bag, and sacks.
length: Number
width: Number
height: Number
One box size.
Length*Width*Height
tiltLength
tiltWidth
topweight
layers
maxHeight
Box Stacking & Stuffing options
Roll Object
ROLL object.
Describes the types of loadable objects such as barrel, pipe, and roll.
radius: Number
height: Number
One roll size.
Radius*Height
tilt
topweight
layers
maxHeight
Box Stacking & Stuffing options
Containers
In this section, you can set a fixed quantity of containers that fill up earlier than auto containers.
It is also assumed that no containers will be specified. Then only the automatic container will be used.
“auto”
“wallLength”
“wallWidth”
“floor”
“auto”
“volume_asc”
“volume_desc”
“square_asc”
“square_desc”
“mps_asc”
“mps_desc”
“vps_asc”
“vps_desc”
Priority of cargo placement order.
You can set volume, floor square, mps (mass per square) or vps (volume per square) in ascending or descending order priority.
Container Space
Auto Containers
The main difference between automatic containers and regular containers is that they are infinite. Only one type of container from the list will be used for stuffing. The algorithm determines which type will be used for loading automatically. Groups for loading such containers cannot be specified.
“auto”
“wallLength”
“wallWidth”
“floor”
Container Space
Images
Creation of 3D images of the container.
If the images field is not specified or is null. Then the generation will not be performed.
Generating images slow down the request processing speed by about 5-10 times.
Images are returned in png format encoded with base64 algorithm as text.
The maximum image size is 1000x800 pixels.
Response
The response comes in JSON format.
Response generation time can take from 0 to 60 seconds.
In case the response takes a long time, try disabling image generation by setting images: null.
Result fields:
Result
The result field contains a list of stuffed containers of the following format:
Objects categories
The "agg:" prefix indicates that this category is an aggregator and can contain objects.
Container Spaces
Container Spaces describes the spaces within a container. Regular containers have one such section. There can be 2 or 3 of them in ULD containers.
x: Number
y: Number
z: Number
x: 1
y: 1
z: 1
x: 0
y: 0
z: 0
x: 0
y: 0
z: 0
Children objects: pallets, boxes, and rolls
There are only 3 types of children objects: pallets, boxes, and rolls.
Only pallets can have children inside, consisting of boxes and rolls.
All 3 groups of objects have a complex characteristic, which shows how many such objects (copies) are located nearby - this can be called a cluster or a stack.
For example, if complex = {x: 2, y: 3, z: 4}, then this means that there are 2 such objects along the X-axis, 3 along the Y-axis, and 4 along the Z-axis. In total, such objects consist of a whole stack (cluster, large box), 2x3x4 in size, consisting of 12 objects.
If we consider the complex of rolls (barrels), then their X and Y are always equal to 1, but Z >= 1. That is, there can be several rolls (barrels) located on top of each other.
“box”
“roll”
x: Number
y: Number
z: Number
x: Number [1…N]
y: Number [1…N]
z: Number [1…N]
The dimension of a cluster or stack of similar objects. How many similar objects are located along the axes.
qty = complex.x * complex.y * complex.z
x: Number
y: Number
z: Number
x: Number
y: Number
z: Number
“obj:cargo”
“agg:pallet”
x: Number
y: Number
z: Number
How read complex objects
Here we see the sample complex object, that contains 24 equal boxes (4*3*2 = 24).
Response contains only one instance of object. You may clone 23 objects manually.
Sample code for clone objects:
for (let x = 0; x < pallet.complex.x; ++x) {
for (let y = 0; y < pallet.complex.y; ++y) {
for (let z = 0; z < pallet.complex.z; ++z) {
for (let j in pallet.children) {
let obj = pallet.children[j];
let location = {
x: pallet.location.x + obj.location.x + x * palletSize.x,
y: pallet.location.y + obj.location.y + y * palletSize.y,
z: pallet.location.z + obj.location.z + z * palletSize.z,
};
switch (obj.form) {
case 'box':
let boxData = {
size: obj.size,
complex: obj.complex,
location: location,
uid: obj.uid,
};
createBox(scene, boxData);
break;
case 'roll':
let rollData = {
height: obj.size.height,
radius: obj.size.radius,
complex: obj.complex,
location: location,
uid: obj.uid,
};
createCylinder(scene, rollData);
break;
}
}
}
}
}
Ignore
List of objects that were ignored during loading. Ignoring is either due to oversizing or because of overweight.
Errors
List of errors that occurred during loading.
There are 3 types of errors: warning (loading continues), ignore (setting is incorrect and ignored, loading continues) and break (as a result of which loading stops).