Skip to main content

Nesting - read parts without nesting them

POST 

/api/v1/cad/pro/nesting/inspect

Reads the parts of uploaded STEP files as nesting would and reports each one's file, kind, outline size, area and cut length, or why it cannot be nested. Requires the 'cad' API key scope. Returns 202 with a task ID; the NestingInspection is delivered as the metadata result.

Request​

Responses​

Task accepted

Reference​

POST /api/v1/cad/pro/nesting/inspect

Reads the parts of uploaded STEP files as nesting would and reports each one's file, kind, outline size, area and cut length, or why it cannot be nested. Requires the 'cad' API key scope. Returns 202 with a task ID; the NestingInspection is delivered as the metadata result.

Request body​

Content type: application/json (required)

FieldTypeRequiredDescription
stepFileIdsarray of stringyesIDs of previously uploaded STEP files (.step, .stp or gzip-compressed .stpz), at most 50 and 200 MB together. Parts are read file after file, as each file's product structure gives them: every placement of a part (a product) is a part, and a file with no assembly is its one part. Within a part, every solid is a part of its own, in the order they sit, and whatever else it holds stays one part after them (an unfolded flat pattern with its bend lines, a drawing's outline with its holes); a part with no edge is skipped, and a request whose files give no part at all is refused. Parts are read into the Y-up working space the report uses. options.parts[i] pairs with the i-th part over all files, at most 5000, and the report names each part's file.
fileUnitmm | cm | m | innoA unit of length: 'mm' (millimetres), 'cm' (centimetres), 'm' (metres) or 'in' (inches).
optionsobjectnoThe settings that change how parts are read (tolerance, xDirection); no stock is needed. Every length is in the parts' units: millimetres on the nesting routes, which read their STEP files in millimetres, and the unit a pipeline models its shapes in for an occtPro.nesting step.
options.sheetsarray of objectno
options.partsarray of objectnoThe options of each part, in the order of the parts; the list may not be longer than the parts there are. A null entry, and every part past the end of the list, takes the defaults. All copies together stay within 100000, every part counting its quantity, or 1 when it has no entry or its entry gives none: the entries given are checked when the request arrives, and the total over every part once the parts are read. The request body may grow by 256 bytes for each of the 5000 parts nesting takes, so the options of every part fit, each with its quantity, a few fixed angles, a flip, a priority and an x direction.
options.spacingnumbernoThe least distance kept between any two parts, in the parts' units (millimetres for parts read from STEP files), measured on their true shapes. Defaults to 0, where parts that tile exactly may touch.
options.marginnumbernoThe band along each sheet's edges that no part enters, in the parts' units (millimetres for parts read from STEP files). Defaults to 0.
options.timeBudgetSecondsnumbernoHow long the search may run; the best layout found by then is returned. Defaults to 10 seconds, at most 120.
options.tolerancenumbernoHow far the straight chords that stand in for curved edges may stray from them, in the parts' units (millimetres for parts read from STEP files); the spacing still holds on the true curves. Defaults to 0.1.
options.evaluationBudgetintegernoStop after this many placements are tried, which makes a run repeatable for one seed; the time budget still applies. 0 means no limit.
options.seedintegernoThe seed of the search's random choices. Defaults to 1.
options.sheetGapnumbernoThe gap between sheets as they are laid out in a row in the output, in the parts' units (millimetres for parts read from STEP files). Defaults to a tenth of the widest sheet.

Responses​

StatusDescription
202Task accepted
400Validation error
403Insufficient scope
500Server error

Example request​

curl -X POST "https://api.bitbybit.dev/api/v1/cad/pro/nesting/inspect" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ ... }'

Authentication: send your key in the x-api-key header. The full machine-readable specification is at openapi.json.