The TonCut Engine JSON API is a high-performance, programmable nesting and cutting optimization service designed for material cutting industries like glass, woodworking, and sheet metal fabrication. It translates complex linear and 2D material cutting problems into structured JSON data models, processing them through a robust optimization engine to achieve maximum material yields. Core Modes of Operation
The TonCut Engine operates as a local or service-based platform, offering two main architectural paradigms for integration:
Websocket Server Mode (Continuous Application Integration):The engine runs persistently as a Windows Service listening on a configured port. It is ideal for live client-server applications, manufacturing execution systems (MES), or web backends needing real-time computation over an active connection.
Command Line Mode (Batch Processing):The standalone software takes local input file paths, executes optimization tasks, and writes out JSON formatted results. This is ideal for script automation, Cron jobs, and ERP integrations handling bulk data at scheduled intervals. The API Data Model Structure
Integrating with TonCut relies on standard, human-readable data blocks grouped into strict Input and Output JSON objects.
┌──────────────────────────────────────────────────────────┐ │ INPUT JSON │ │ ┌──────────────────┐ ┌────────────────────────────────┐ │ │ │ Configuration │ │ Data Groups │ │ │ │ (Params/Margins) │ │ (Stocks/Sheets & Parts/Items) │ │ │ └──────────────────┘ └────────────────────────────────┘ │ └───────────────────────────┬──────────────────────────────┘ │ Sent to Engine ▼ ┌──────────────────────────────────────────────────────────┐ │ OUTPUT JSON │ │ ┌─────────────────────────────────────────────────────┐ │ │ │ Optimizations, Cut Coordinates, Wastage & Statistics│ │ │ └─────────────────────────────────────────────────────┘ │ └──────────────────────────────────────────────────────────┘ 1. Input JSON Schema
To execute a cutting optimization routine, developers feed a multi-layered JSON payload containing two primary categories:
Configuration (Optional): Defines machine behavioral boundaries. Examples include saw blade thickness (kerf width), trim margins for stock sheets, minimum reusable off-cut sizes, and grain direction locks. Data Groups (Required):
Stocks (Sheets / Bars): An array detailing available warehouse inventory materials, their dimensions (length/width), quantities, and material types.
Parts (Items to Cut): An array defining target parts to produce, indicating required dimensions, precise quantities, priorities, and rotation permissions. 2. Output JSON Schema
Once calculations resolve, the engine spits out a detailed structural evaluation report:
Placements: An array mapping out exact X/Y coordinate vectors for every item placed onto stock templates.
Cutting Sequences: Sequential step guidelines outlining which cuts should occur first to minimize material handling errors.
Waste Reports & Metrics: Data indicators highlighting material utilization efficiency ratios, total square footage wasted, and remnants large enough to return to stock inventory. Basic Implementation Workflow
Integrating the JSON API into custom enterprise apps involves three key technical phases: Step 1: Environment Setup
First, download and configure the installation binaries using the TonCut Installer. If choosing service mode, assign your dedicated Websocket port and provision local SSL certificates for secure local transport lines. Step 2: Marshalling Request Payloads
Construct an optimization query within your chosen tech stack (e.g., Python, C#, Node.js). Convert internal database items into a compliant nested JSON structure. Step 3: Transport and Resolution Handling
Via Websocket: Open a socket connection, send the raw stringified payload, and listen for the execution completion message.
Via CLI: Trigger a shell child-process feeding parameters to the engine executable (toncut.exe –input request.json –output response.json). Parse the output JSON programmatically to render diagrams, print cut sheets, or update ERP inventory tables.
Do you need guidance setting up the Windows Service websocket parameters programmatically? Or TonCut Engine – Documentation
Leave a Reply