CADLens parses DWG, DXF, and DWF files into structured vector JSON so laser cutting and CNC platforms can extract polyline cut paths, estimate total cut length, validate file geometry, and show a preview — all before touching the cutting machine.
Customers upload DWG or DXF files produced in different CAD tools, saved in different versions, with geometry spread across layers named by convention (or by accident). Before a job can be quoted, scheduled, or sent to the machine, someone needs to verify the file: is the geometry closed, does it fit the bed, how long is the cut path, which layer is the cut layer?
Parsing DWG/DXF reliably in your own backend requires maintaining a CAD library that handles dozens of format versions and entity types. CADLens handles that complexity and returns a single stable JSON schema your business logic can act on.
Submit the uploaded file to POST /v1/parse. The response from GET /v1/jobs/{job_id}/result gives you everything needed to pre-flight a cutting job:
metadata.units, so you can check whether the part fits the material sheet or machine bed without opening the file.A typical laser-cutting platform integration:
POST /v1/parse with Authorization: Bearer <api_key>. For files under ~2 MB, include wait=true to receive the result synchronously. For larger files, register a webhook_url and handle the completion callback.GET /v1/jobs/{job_id}/result. Filter vectorJson entities by layer to isolate cut geometry.metadata.boundingBox against your sheet size. Count closed polylines for contour count.GET /v1/jobs/{job_id}/image to the operator for visual confirmation before queuing the job.The fields most relevant to laser cutting and CNC pre-flight:
"polyline" and "arc" for cut paths; "circle" for interior holes or piercing points; "spline" where curved paths are drawn.{ x, y } array on polyline entities. The Euclidean distance between consecutive pairs gives the segment length in drawing units.true when a polyline forms a closed contour (a complete cut loop). Open polylines may be lead-in/lead-out lines or annotation geometry.layersJson to filter cutting geometry from annotations, dimensions, and other non-cutting content."mm", "in", or other CAD unit codes. Apply the correct conversion factor before comparing against machine bed dimensions.{ width, height } for part extents. Reject or warn if the part exceeds your sheet or bed size before queuing.A simplified extract from a /v1/jobs/{job_id}/result response for a DXF laser-cut bracket (schema version 2024-01):
{
"schemaVersion": "2024-01",
"metadata": {
"units": "mm",
"boundingBox": { "width": 300.0, "height": 150.0 }
},
"layersJson": [
{ "name": "CUT", "colorHex": "#FF0000", "entityCount": 6 },
{ "name": "DIMS", "colorHex": "#CCCCCC", "entityCount": 14 }
],
"vectorJson": [
{
"type": "polyline",
"layer": "CUT",
"closed": true,
"vertices": [
{ "x": 0.0, "y": 0.0 },
{ "x": 300.0, "y": 0.0 },
{ "x": 300.0, "y": 150.0 },
{ "x": 0.0, "y": 150.0 }
]
},
{
"type": "circle",
"layer": "CUT",
"center": { "x": 25.0, "y": 25.0 },
"radius": 5.0
},
{
"type": "arc",
"layer": "CUT",
"center": { "x": 275.0, "y": 75.0 },
"radius": 12.5,
"startAngle": 0,
"endAngle": 180
}
]
}From this: outer perimeter = 2 × (300 + 150) = 900 mm; one circular hole (radius 5 mm, circumference ≈ 31.4 mm); one semicircular arc cut (radius 12.5 mm, length ≈ 39.3 mm). Total cut length ≈ 970.7 mm. Part fits within a 300 × 150 mm blank.
CADLens returns the geometry as stored in the CAD file. A few things to keep in mind for cutting workflows:
insert entity (insertion point, block name, scale, rotation) rather than exploded. If parts are saved as block references, your code must resolve the geometry from the insert data.metadata.units against the expected unit system for your region or customer.Add a CAD pre-flight step to your laser or CNC workflow. No CAD libraries to install or maintain.