M097 — AP238 workingstep references a feature not on the workpiece

§12.8 mixed (sub-class: AP238 feature reference)

P1 — silent data loss

spec-violation

Sources

Sender

deduced — STEP-NC publisher exporting feature library shared across multiple parts without filtering

Description

A `MACHINING_WORKINGSTEP` references a `MACHINING_FEATURE` by id; the feature exists in the file but is associated with a different workpiece; the workingstep's setup machines workpiece A while the cited feature lives on workpiece B. The toolpath is computed against feature B's placement and crashes the tool against workpiece A. Bug-reporter language: "STEP-NC workingstep machines wrong feature", "AP238 feature on wrong part", "tool crash because wrong workpiece feature".

Reproducer recipe

Two `WORKPIECE`s declared; a `WORKINGSTEP` whose setup mounts workpiece A but whose `its_feature` belongs to workpiece B.

Expected kernel behavior

validate workingstep-feature-workpiece consistency; reject as malformed or warn that operation will miss its intended feature.

Notes

Synonyms: "AP238 wrong feature link", "workingstep cites foreign feature", "machining step targets wrong workpiece feature", "feature on different workpiece referenced". Synonyms: "AP238 wrong feature link", "workingstep cites foreign feature".

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/* M097: AP238 workingstep references a feature not on the workpiece */
3/* DEFECT: MACHINING_WORKINGSTEP its_feature belongs to WORKPIECE B, not WORKPIECE A */
4/* Setup mounts workpiece A; feature 'slot_on_b' lives on workpiece B */
5/* Controller executes toolpath against wrong workpiece coordinate frame — tool crash */
6/* Byte assertion: contains(b'AP238_STEP_NC_MIM') */
7/* Byte assertion: contains(b'MACHINING_WORKINGSTEP') */
8/* Byte assertion: count_entity_def(b'WORKPIECE') >= 2 */
9HEADER;
10FILE_DESCRIPTION(('M097: AP238 WORKINGSTEP feature on wrong workpiece'),'2;1');
11FILE_NAME('M097.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/* Byte assertion: count_entity_def(b'WORKPIECE') >= 2 */
30/* WORKPIECE A: the part mounted in the fixture — setup machines this one */
31#20=WORKPIECE('workpiece_A',(#14),$,$,$,$,$);
32/* WORKPIECE B: a different part from the shared feature library */
33#21=WORKPIECE('workpiece_B',(#14),$,$,$,$,$);
34/* MACHINED_FEATURE on workpiece B — the feature the publisher accidentally linked */
35#50=MACHINED_FEATURE('slot_on_b',$,$,$,$,$);
36/* MACHINED_FEATURE on workpiece A — the correct feature for this setup */
37#55=MACHINED_FEATURE('slot_on_a',$,$,$,$,$);
38/* Setup placement and SETUP mounting workpiece A */
39#60=AXIS2_PLACEMENT_3D('fixture_origin',CARTESIAN_POINT('',(0.,0.,0.)),
40  DIRECTION('',(0.,0.,1.)),$);
41#61=SETUP('fixture_a',#60,(#20),$);
42/* Machining tool */
43#70=MACHINING_TOOL('endmill_6mm',$,$,$);
44/* Machining operation targeting slot_on_b (workpiece B's feature) */
45#75=MACHINING_OPERATION('mill_slot_a',#70,$,$,$,$,$,$,#50,$,$);
46/* Byte assertion: contains(b'MACHINING_WORKINGSTEP') */
47/* DEFECT: MACHINING_WORKINGSTEP its_feature = #50 ('slot_on_b') from WORKPIECE B */
48/* Setup #61 mounts WORKPIECE A; the feature must be on WORKPIECE A (e.g. #55) */
49/* Referencing #50 from WORKPIECE B causes toolpath to target wrong coordinate frame */
50#80=MACHINING_WORKINGSTEP('step_a',#50,#75,$);
51#90=WORKPLAN('main',(#80),$,$,$);
52/* GEOMETRIC_CURVE_SET IS the model entity — OCC yields empty */
53#300=GEOMETRIC_CURVE_SET('ap238-workingstep-feature-on-wrong-workpiece',
54  (#20,#21,#50,#55,#61,#70,#75,#80,#90));
55/* Product chain */
56#400=APPLICATION_CONTEXT('mechanical design');
57#401=PRODUCT_CONTEXT('',#400,'mechanical');
58#402=PRODUCT('M097','M097','M097',(#401));
59#403=PRODUCT_DEFINITION_FORMATION('','',#402);
60#404=PRODUCT_DEFINITION_CONTEXT(#400,'design');
61#405=PRODUCT_DEFINITION('','',#403,#404);
62#406=PRODUCT_DEFINITION_SHAPE('','',#405);
63#407=SHAPE_REPRESENTATION('',(#300),#14);
64#408=SHAPE_DEFINITION_REPRESENTATION(#406,#407);
65ENDSEC;
66END-ISO-10303-21;