M100 — AP238 spindle-on issued after first tool-workpiece contact

§12.8 mixed (sub-class: AP238 process ordering)

P1 — silent data loss

spec-violation

Sources

Sender

deduced — STEP-NC publisher concatenating canned cycles in wrong order

Description

A workplan's `MACHINING_OPERATION` chain begins with a `CUTTING_OPERATION` (tool descends into workpiece) and only afterwards issues `SPINDLE_SPEED` / `START_SPINDLE`. The first contact occurs with the spindle stopped, breaking the tool or marring the workpiece surface. Bug-reporter language: "AP238 spindle starts after cut begins", "STEP-NC contact without spindle", "machining without spindle on".

Reproducer recipe

A `WORKPLAN` listing a `DRILLING_OPERATION` *before* any explicit spindle-control operation.

Expected kernel behavior

validate that spindle is commanded on before first cutting contact; warn or reject.

Notes

Synonyms: "spindle off during cut", "AP238 ordering hazard", "missing spindle-on prefix".

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/* M100: AP238 spindle-on issued after first tool-workpiece contact */
3/* DEFECT: DRILLING_OPERATION precedes any spindle-control operation */
4/* Spindle stopped at first tool-workpiece contact — breaks tool or mars surface */
5/* Violates ISO 10303-238 §6.4 spindle / coolant / approach ordering */
6/* Byte assertion: contains(b'AP238_STEP_NC_MIM') */
7/* Byte assertion: contains(b'DRILLING_OPERATION') */
8/* Byte assertion: contains(b'WORKPLAN') */
9HEADER;
10FILE_DESCRIPTION(('M100: AP238 DRILLING_OPERATION before spindle-on'),'2;1');
11FILE_NAME('M100.stp','2026-06-21T00:00:00',(''),(''),'cad-research-suite','','');
12/* Byte assertion: contains(b'AP238_STEP_NC_MIM') */
13FILE_SCHEMA(('AP238_STEP_NC_MIM { 1 0 10303 238 1 0 0 }'));
14ENDSEC;
15DATA;
16#1=APPLICATION_CONTEXT('step_nc_mim');
17#2=APPLICATION_PROTOCOL_DEFINITION('international standard',
18  'ap238_step_nc_mim',2007,#1);
19/* Standard unit context — mm */
20#10=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
21#11=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
22#12=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
23#13=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(0.001),#10,
24  'distance_accuracy_value','maximum model space distance between geometric entities');
25#14=(GEOMETRIC_REPRESENTATION_CONTEXT(3)
26  GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#13))
27  GLOBAL_UNIT_ASSIGNED_CONTEXT((#10,#11,#12))
28  REPRESENTATION_CONTEXT('nc','3D'));
29/* Target machined feature — a drilled hole */
30#50=MACHINED_FEATURE('hole_a',$,$,$,$,$);
31/* 10mm drill bit — will break if spindle is not rotating at contact */
32#60=MACHINING_TOOL('drill_10mm',$,$,$);
33/* Byte assertion: contains(b'DRILLING_OPERATION') */
34/* DEFECT: DRILLING_OPERATION is the first (and only) operation in the workplan */
35/* No spindle-on control operation precedes this cutting operation */
36/* When controller executes this, spindle is stopped during plunge — tool breaks */
37#70=DRILLING_OPERATION('drill_plunge',#60,$,$,$,$,$,$,#50,$,$);
38/* First workingstep in the WORKPLAN — no spindle-on workingstep before this */
39#80=MACHINING_WORKINGSTEP('drill_step',#50,#70,$);
40/* Byte assertion: contains(b'WORKPLAN') */
41/* WORKPLAN has only the drilling step — missing a spindle-on step as first entry */
42/* Correct ordering: spindle-on workingstep FIRST, then drilling workingstep *)  */
43#90=WORKPLAN('main',(#80),$,$,$);
44/* GEOMETRIC_CURVE_SET IS the model entity — OCC yields empty */
45#300=GEOMETRIC_CURVE_SET('ap238-spindle-on-after-first-tool-workpiece-contact',
46  (#50,#60,#70,#80,#90));
47/* Product chain */
48#400=APPLICATION_CONTEXT('mechanical design');
49#401=PRODUCT_CONTEXT('',#400,'mechanical');
50#402=PRODUCT('M100','M100','M100',(#401));
51#403=PRODUCT_DEFINITION_FORMATION('','',#402);
52#404=PRODUCT_DEFINITION_CONTEXT(#400,'design');
53#405=PRODUCT_DEFINITION('','',#403,#404);
54#406=PRODUCT_DEFINITION_SHAPE('','',#405);
55#407=SHAPE_REPRESENTATION('',(#300),#14);
56#408=SHAPE_DEFINITION_REPRESENTATION(#406,#407);
57ENDSEC;
58END-ISO-10303-21;