M107 — AP238 cutting tool diameter declared as zero or negative

§12.8 mixed (sub-class: AP238 tool dimension)

P1 — silent data loss

spec-violation

Sources

Sender

deduced — STEP-NC publisher emitting tool template with default zero values

Description

A milling tool's diameter `MEASURE_WITH_UNIT` carries the numeric value `0.0` (or worse, a negative). The controller either rejects the file or generates a toolpath with zero radial offset, producing contour-on-contour passes with no material removal. Bug-reporter language: "AP238 tool zero diameter", "STEP-NC milling tool size missing", "zero diameter cutter".

Reproducer recipe

`MEASURE_WITH_UNIT(POSITIVE_LENGTH_MEASURE(0.0), mm_unit)` attached as the diameter of a milling tool referenced by a `MACHINING_OPERATION`.

Expected kernel behavior

reject zero/negative tool diameters as malformed; or warn loudly.

Notes

Synonyms: "zero-diameter tool", "AP238 tool dimension missing", "milling tool diameter is zero or negative", "STEP-NC bad tool size", "cutting tool has no radial offset".

Expected validation

occt=empty/empty gmsh=empty ifc=schema_n/a

Byte assertions

Tier-3 assertions

Live oracle output

No live oracle data — run _run_corpus to populate.

Fixture content

Show fixture bytes (with defect highlighting)
1ISO-10303-21;
2/* M107: AP238 cutting tool diameter declared as zero or negative */
3/* DEFECT: POSITIVE_LENGTH_MEASURE(0.0) — zero diameter violates positivity */
4/* Controller rejects or generates contour-on-contour passes with no material removal */
5/* Violates ISO 10303-238 §5.7 cutting_tool_dimension positivity rules */
6/* Byte assertion: contains(b'AP238_STEP_NC_MIM') */
7/* Byte assertion: contains(b'POSITIVE_LENGTH_MEASURE(0.0)') */
8HEADER;
9FILE_DESCRIPTION(('M107: AP238 cutting tool diameter declared as zero'),'2;1');
10FILE_NAME('M107.stp','2026-06-21T00:00:00',(''),(''),'cad-research-suite','','');
11/* Byte assertion: contains(b'AP238_STEP_NC_MIM') */
12FILE_SCHEMA(('AP238_STEP_NC_MIM { 1 0 10303 238 1 0 0 }'));
13ENDSEC;
14DATA;
15#1=APPLICATION_CONTEXT('step_nc_mim');
16#2=APPLICATION_PROTOCOL_DEFINITION('international standard',
17  'ap238_step_nc_mim',2007,#1);
18/* Standard unit context — mm */
19#10=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
20#11=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
21#12=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
22#13=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(0.001),#10,
23  'distance_accuracy_value','maximum model space distance between geometric entities');
24#14=(GEOMETRIC_REPRESENTATION_CONTEXT(3)
25  GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#13))
26  GLOBAL_UNIT_ASSIGNED_CONTEXT((#10,#11,#12))
27  REPRESENTATION_CONTEXT('nc','3D'));
28/* Byte assertion: contains(b'POSITIVE_LENGTH_MEASURE(0.0)') */
29/* DEFECT: diameter = 0.0 mm — violates POSITIVE_LENGTH_MEASURE constraint */
30/* A milling cutter with zero diameter cannot remove any material */
31/* Typical cause: CAM system using uninitialised tool template default value */
32#21=MEASURE_WITH_UNIT(POSITIVE_LENGTH_MEASURE(0.0),#10);
33/* Machined feature — a slot requiring nonzero tool radius offset */
34#50=MACHINED_FEATURE('slot_a',$,$,$,$,$);
35/* DEFECT: MILLING_CUTTER with zero diameter — cannot produce radial offset */
36/* Tool template left at default 0.0; should be e.g. 12.0 mm for this slot op */
37#60=MILLING_CUTTER('endmill_bad',$,$,#21,$,$,$,$);
38/* MACHINING_OPERATION references zero-diameter tool #60 */
39#70=MACHINING_OPERATION('op_slot',#60,$,$,$,$,$,$,#50,$,$);
40#80=MACHINING_WORKINGSTEP('step_slot',#50,#70,$);
41#90=WORKPLAN('main',(#80),$,$,$);
42/* GEOMETRIC_CURVE_SET IS the model entity — OCC yields empty */
43#300=GEOMETRIC_CURVE_SET('ap238-cutting-tool-diameter-zero-or-negative',
44  (#21,#50,#60,#70,#80,#90));
45/* Product chain */
46#400=APPLICATION_CONTEXT('mechanical design');
47#401=PRODUCT_CONTEXT('',#400,'mechanical');
48#402=PRODUCT('M107','M107','M107',(#401));
49#403=PRODUCT_DEFINITION_FORMATION('','',#402);
50#404=PRODUCT_DEFINITION_CONTEXT(#400,'design');
51#405=PRODUCT_DEFINITION('','',#403,#404);
52#406=PRODUCT_DEFINITION_SHAPE('','',#405);
53#407=SHAPE_REPRESENTATION('',(#300),#14);
54#408=SHAPE_DEFINITION_REPRESENTATION(#406,#407);
55ENDSEC;
56END-ISO-10303-21;