Kolos Hetyéssy Software developer

Free tools / CAD DXF Quote API

Count the pierces in a DXF drawing

Pierce count drives cutting time as much as length does. Drop a DXF below to see how many pierces it really needs, contour by contour.

  • Free, no sign-up
  • Your file is never stored
  • Deterministic: no AI guesswork

Try it now

Your drawing is read in memory and discarded right after. The second sample tab, “Messy export”, has a rectangle drawn as loose lines and a cut-out with a 0.5 mm gap.

The live demo needs JavaScript, which seems to be switched off. The sample tabs show the engine's real output without it.

Rounded corners as polyline bulges, six round holes, and a slot drawn as four loose entities.

mounting-plate.dxf 55678 bytes

svg_preview

Result

Cut length
805.027 mm
Pierces
7
Parts / holes
1 / 6
Net area
14605.313 mm²
Bounding box
160.0 × 100.0 mm
Closed / open contours
7 / 0
JSON response POST /v1/analyze-dxf
{
  "api_version": "2.0",
  "unit_code": 4,
  "unit_name": "Millimeters",
  "active_layer_count": 2,
  "ignored_disabled_layer_count": 0,
  "clamped_z_anomaly_count": 0,
  "total_entity_count": 10,
  "pierce_count": 7,
  "closed_loop_count": 7,
  "total_cut_length": 805.0265,
  "bounding_box": {
    "min_x": 0.0,
    "min_y": 0.0,
    "max_x": 160.0,
    "max_y": 100.0,
    "width": 160.0,
    "height": 100.0,
    "bounding_area": 16000.0
  },
  "entity_counts_by_type": {
    "ARC": 2,
    "CIRCLE": 5,
    "LINE": 2,
    "LWPOLYLINE": 1
  },
  "layer_summary": {
    "0": {
      "entity_count": 10,
      "cut_length": 805.0265
    }
  },
  "bom_blocks": [],
  "mm_per_unit": 1.0,
  "open_contour_count": 0,
  "part_count": 1,
  "hole_count": 6,
  "net_area": 14605.3133,
  "duplicate_length_removed": 0.0,
  "total_cut_length_mm": 805.027,
  "net_area_mm2": 14605.313,
  "bounding_box_mm": {
    "min_x": 0.0,
    "min_y": 0.0,
    "max_x": 160.0,
    "max_y": 100.0,
    "width": 160.0,
    "height": 100.0,
    "bounding_area": 16000.0
  },
  "ignored_entities": {
    "invisible": 0,
    "on_disabled_layers": 0,
    "filtered_by_layer_option": 0,
    "corrupt_coordinates": 0,
    "unreadable": 0,
    "not_cut_geometry": {}
  },
  "file_info": {
    "dxf_version": "AC1032",
    "binary": false,
    "repaired": false
  },
  "warnings": [],
  "svg_preview": "<svg …> (shown above)"
}

A doubled line, a text, dimensions, a title frame (excluded with exclude_layers=FRAME) and a 0.5 mm gap.

messy-export.dxf 57412 bytes · ?exclude_layers=FRAME

svg_preview

Result

Cut length
1005.164 mm
Pierces
3
Parts / holes
1 / 1
Net area
22745.003 mm²
Bounding box
200.0 × 120.0 mm
Closed / open contours
2 / 1
Duplicate length removed
100.0 mm
Excluded by layer filter
1
Ignored DIMENSION
1
Ignored TEXT
1

1 contour(s) have open ends: the drawing may have gaps; each open path needs its own pierce.

Removed 100.0 units of duplicate/overlapping lines from the cut length.

JSON response POST /v1/analyze-dxf
{
  "api_version": "2.0",
  "unit_code": 4,
  "unit_name": "Millimeters",
  "active_layer_count": 4,
  "ignored_disabled_layer_count": 0,
  "clamped_z_anomaly_count": 0,
  "total_entity_count": 7,
  "pierce_count": 3,
  "closed_loop_count": 2,
  "total_cut_length": 1005.1637,
  "bounding_box": {
    "min_x": 0.0,
    "min_y": 0.0,
    "max_x": 200.0,
    "max_y": 120.0,
    "width": 200.0,
    "height": 120.0,
    "bounding_area": 24000.0
  },
  "entity_counts_by_type": {
    "CIRCLE": 1,
    "LINE": 5,
    "LWPOLYLINE": 1
  },
  "layer_summary": {
    "0": {
      "entity_count": 7,
      "cut_length": 1105.1637
    }
  },
  "bom_blocks": [],
  "mm_per_unit": 1.0,
  "open_contour_count": 1,
  "part_count": 1,
  "hole_count": 1,
  "net_area": 22745.0025,
  "duplicate_length_removed": 100.0,
  "total_cut_length_mm": 1005.164,
  "net_area_mm2": 22745.003,
  "bounding_box_mm": {
    "min_x": 0.0,
    "min_y": 0.0,
    "max_x": 200.0,
    "max_y": 120.0,
    "width": 200.0,
    "height": 120.0,
    "bounding_area": 24000.0
  },
  "ignored_entities": {
    "invisible": 0,
    "on_disabled_layers": 0,
    "filtered_by_layer_option": 1,
    "corrupt_coordinates": 0,
    "unreadable": 0,
    "not_cut_geometry": {
      "DIMENSION": 1,
      "TEXT": 1
    }
  },
  "file_info": {
    "dxf_version": "AC1032",
    "binary": false,
    "repaired": false
  },
  "warnings": [
    "1 contour(s) have open ends: the drawing may have gaps; each open path needs its own pierce.",
    "Removed 100.0 units of duplicate/overlapping lines from the cut length."
  ],
  "svg_preview": "<svg …> (shown above)"
}

A MINSERT array of a bracket block with nested press-in nut blocks and attributes.

nested-sheet.dxf 56328 bytes

svg_preview

Result

Cut length
1403.575 mm
Pierces
18
Parts / holes
6 / 12
Net area
10975.532 mm²
Bounding box
200.0 × 90.0 mm
Closed / open contours
18 / 0

bom_blocks

BlockQuantityLayerAttributes
BRACKET 6 0 –
PEM_NUT_M4 12 0 PART = CLS-M4-1
JSON response POST /v1/analyze-dxf
{
  "api_version": "2.0",
  "unit_code": 4,
  "unit_name": "Millimeters",
  "active_layer_count": 2,
  "ignored_disabled_layer_count": 0,
  "clamped_z_anomaly_count": 0,
  "total_entity_count": 31,
  "pierce_count": 18,
  "closed_loop_count": 18,
  "total_cut_length": 1403.5752,
  "bounding_box": {
    "min_x": 10.0,
    "min_y": 10.0,
    "max_x": 210.0,
    "max_y": 100.0,
    "width": 200.0,
    "height": 90.0,
    "bounding_area": 18000.0
  },
  "entity_counts_by_type": {
    "CIRCLE": 12,
    "INSERT": 13,
    "LWPOLYLINE": 6
  },
  "layer_summary": {
    "0": {
      "entity_count": 18,
      "cut_length": 1403.5752
    }
  },
  "bom_blocks": [
    {
      "block_name": "BRACKET",
      "layer": "0",
      "quantity": 6,
      "sample_attributes": {}
    },
    {
      "block_name": "PEM_NUT_M4",
      "layer": "0",
      "quantity": 12,
      "sample_attributes": {
        "PART": "CLS-M4-1"
      }
    }
  ],
  "mm_per_unit": 1.0,
  "open_contour_count": 0,
  "part_count": 6,
  "hole_count": 12,
  "net_area": 10975.532,
  "duplicate_length_removed": 0.0,
  "total_cut_length_mm": 1403.575,
  "net_area_mm2": 10975.532,
  "bounding_box_mm": {
    "min_x": 10.0,
    "min_y": 10.0,
    "max_x": 210.0,
    "max_y": 100.0,
    "width": 200.0,
    "height": 90.0,
    "bounding_area": 18000.0
  },
  "ignored_entities": {
    "invisible": 0,
    "on_disabled_layers": 0,
    "filtered_by_layer_option": 0,
    "corrupt_coordinates": 0,
    "unreadable": 0,
    "not_cut_geometry": {}
  },
  "file_info": {
    "dxf_version": "AC1032",
    "binary": false,
    "repaired": false
  },
  "warnings": [],
  "svg_preview": "<svg …> (shown above)"
}

How it works

  1. Export the part as DXF and drop it into the box above.
  2. The pierce count is one per closed contour plus one per open path, after loose lines and arcs have been joined into contours.
  3. If the result has open contours, check the warning: a gap in the drawing costs an extra pierce, and often means a mistake in the drawing.

Why counting entities gives the wrong number

Many home-made DXF tools count one pierce per LINE, ARC or CIRCLE entity. For a part exported from CAD as loose segments that overestimates badly, and for a polyline it is right only by accident. Here the count follows the geometry:

Drawing Entities Pierces
Rectangle drawn as 4 lines 4 1
Plate with 4 round holes and a slot drawn as 2 lines + 2 arcs 10 7 (outline, 4 holes, bore, slot)
Cut-out polyline with a 0.5 mm gap 1 1, plus a gap warning

The second row is the “Mounting plate” sample above, and its numbers are the engine’s real output. In a test sheet with 2,500 holes the engine reported 2,501 pierces: the outline plus every hole.

Questions

Why is the pierce count not the number of entities?

A rectangle drawn as four separate lines is still one contour, so it needs one pierce, not four. The engine joins lines, arcs and polylines that touch into contours first, then counts one pierce per contour.

What happens with gaps in the drawing?

A contour that does not close is an open path. Each open path needs its own pierce, and the result includes a warning that the drawing may have gaps.

What about parts that share an edge (common-line cutting)?

Shared edges are handled: parts laid out to share a cut are not reported as gaps, and the shared edge is counted once in the cut length.

Does it tell parts and holes apart?

Yes, by nesting: a closed contour inside another is a hole, and a contour inside a hole counts as a part again. The result has the number of parts and holes and the net area.

Is my drawing stored?

No. The demo service reads it in memory and discards it right after sending the result back.

Need it in your own software?

The same engine is available as an API: whole files instead of a preview, every export format, automation.

CAD DXF Quote API →

Related tools

Free toolCAD DXF Quote API

DXF cut length calculator

Exact cut length of a DXF for laser, waterjet, plasma or CNC quotes, duplicates counted once.