Use case · Laser Cutting & CNC

Read cut paths and material bounds from DWG/DXF before the job starts.

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.

Join the beta · Free 50/mo →Read the docs
01THE PROBLEM

CAD files arrive in every shape — your software needs clean data.

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.

02HOW CADLENS HELPS

Parse once, get cut paths, layers, and dimensions.

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:

  • vectorJson — polylines and arcs that make up cutting contours, with vertices and geometry for length calculation. Circles for interior cuts. Text entities for part labels or reference marks.
  • layersJson — layer names and entity counts so you can identify which layers hold cutting geometry vs. annotations, dimensions, or construction lines.
  • metadata.boundingBox — overall width and height of the drawing in metadata.units, so you can check whether the part fits the material sheet or machine bed without opening the file.
  • imageUrl — a PNG preview of the parsed drawing, ready to display to the operator or customer before committing to the job.
03API WORKFLOW

From file upload to cut-ready data in seconds.

A typical laser-cutting platform integration:

  1. Customer uploads a DWG or DXF. Your server posts it to 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.
  2. On completion, fetch GET /v1/jobs/{job_id}/result. Filter vectorJson entities by layer to isolate cut geometry.
  3. Sum polyline vertex distances and arc lengths for total cut length. Check metadata.boundingBox against your sheet size. Count closed polylines for contour count.
  4. Display the PNG preview from GET /v1/jobs/{job_id}/image to the operator for visual confirmation before queuing the job.
04RELEVANT DATA

Fields that drive cutting decisions.

The fields most relevant to laser cutting and CNC pre-flight:

  • entities[].type"polyline" and "arc" for cut paths; "circle" for interior holes or piercing points; "spline" where curved paths are drawn.
  • entities[].vertices{ x, y } array on polyline entities. The Euclidean distance between consecutive pairs gives the segment length in drawing units.
  • entities[].closedtrue when a polyline forms a closed contour (a complete cut loop). Open polylines may be lead-in/lead-out lines or annotation geometry.
  • entities[].layer — use with layersJson to filter cutting geometry from annotations, dimensions, and other non-cutting content.
  • metadata.units"mm", "in", or other CAD unit codes. Apply the correct conversion factor before comparing against machine bed dimensions.
  • metadata.boundingBox{ width, height } for part extents. Reject or warn if the part exceeds your sheet or bed size before queuing.
05EXAMPLE OUTPUT

What the result looks like for a cut profile.

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.

06LIMITATIONS

Things to account for.

CADLens returns the geometry as stored in the CAD file. A few things to keep in mind for cutting workflows:

  • Splines — returned as control points, not as polyline approximations. If your cutting software requires polylines, you will need to approximate the spline on your end or rely on DXF files that your customers have already exploded to polylines in their CAD tool.
  • Block inserts — geometry inside blocks is returned as an 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.
  • Lead-in / lead-out geometry — open polylines on the cut layer may be lead-in or lead-out lines added by the operator. CADLens surfaces them as open polylines; your logic must decide whether to include them in cut-length calculations.
  • Drawing units mismatch — some DXF files do not set the units header correctly. Always confirm metadata.units against the expected unit system for your region or customer.
07 — FAQ

Common questions.

Yes. CADLens returns polyline entities in vectorJson with a vertices array of {x, y} points. Sum the Euclidean distance between consecutive vertices for each polyline to get cut length per contour. Arc entities include center, radius, startAngle, and endAngle so arc-length contribution is also calculable. metadata.units tells you the unit system so you can convert to mm if needed.

Most laser-ready DXF files encode cutting paths on a dedicated layer (e.g. CUT, LASER, 0). The layersJson array gives you each layer name and entityCount. Filter vectorJson by entity.layer to isolate only the cutting geometry before summing lengths or counting contours.

CADLens will parse the file and return COMPLETED or FAILED status. On success you can inspect the result: check that closed polylines exist on the expected layers, that the bounding box fits your machine bed, and that no unsupported entity types (splines that your cutting software cannot handle) are present.

Polylines (type: "polyline") are sequences of straight line segments defined by a vertices array. Arcs (type: "arc") are circular curve segments defined by center {x, y}, radius, startAngle, and endAngle in degrees. Both can appear in cutting contours; some software also uses lwpolyline with bulge values for arcs-within-polylines, which CADLens normalises.

CADLens lets you add a programmatic pre-flight step before the file reaches your cutting software: validate geometry, estimate cut time and material, route jobs by sheet size or layer, and display a preview to the customer. It is not a replacement for your cutting software — it is a data layer on top of the file upload step.

Spline entities (type: "spline") are returned in vectorJson with their control points. Whether your cutting software can accept splines depends on its own DXF import capabilities. CADLens surfaces the raw entity data; it does not convert splines to polyline approximations.

JOIN THE BETA

Parse your first cut file. Free 50 parses/month.

Add a CAD pre-flight step to your laser or CNC workflow. No CAD libraries to install or maintain.

Join the beta · Free 50/mo Read the docs
— RELATED

Keep reading.