M103 — AP238 tool trajectory passes through workpiece body before designated cut

§12.8 mixed (sub-class: AP238 toolpath collision)

P1 — silent data loss

crash spec-violation

Sources

Sender

deduced — CAM publisher emitting trajectory with omitted retract height

Description

A `TRAJECTORY`'s approach segment passes from the tool-change position straight through the workpiece volume to reach the feature start; i.e., the line segment from `(0,0,200)` to `(50,30,-5)` intersects the workpiece body at `(50,30,0)`. The implicit retract is missing. The controller either crashes the tool against the workpiece or performs an unintended plunge. Bug-reporter language: "AP238 tool collision", "STEP-NC plunge through part", "approach trajectory hits workpiece".

Reproducer recipe

`TRAJECTORY` whose first segment is a straight `LINE` from `(0,0,200)` to `(50,30,-5)`, with workpiece geometry occupying the box `(0.100, 0.100, 0.50)`.

Expected kernel behavior

collision-check toolpath against workpiece envelope; reject the trajectory or warn loudly.

Notes

Synonyms: "AP238 tool crash", "trajectory through part", "missing retract".

Expected validation

occt=shape(1)/shape(1) gmsh=shape(1) 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/* M103: AP238 tool trajectory passes through workpiece body before designated cut */
3/* DEFECT: TRAJECTORY approach LINE from (0,0,200) to (50,30,-5) intersects workpiece */
4/* Workpiece occupies box (0..100, 0..100, 0..50) — approach hits at (50,30,0) */
5/* Missing retract height — controller crashes or plunges unintentionally */
6/* Violates ISO 10303-238 §6.2 toolpath safety / clearance invariants */
7/* Byte assertion: contains(b'AP238_STEP_NC_MIM') */
8/* Byte assertion: contains(b'TRAJECTORY') */
9HEADER;
10FILE_DESCRIPTION(('M103: AP238 TRAJECTORY approach passes through workpiece'),'2;1');
11FILE_NAME('M103.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/* Tool-change position: above workpiece at Z=200 */
30#20=CARTESIAN_POINT('tool_change_pos',(0.,0.,200.));
31/* DEFECT: Feature start at Z=-5 (below workpiece surface at Z=0) */
32/* Approach from (0,0,200) to (50,30,-5) crosses workpiece surface at (50,30,0) */
33#21=CARTESIAN_POINT('feature_start',(50.,30.,-5.));
34/* Approach direction: from tool_change_pos toward feature_start */
35/* Vector: (50-0, 30-0, -5-200) = (50, 30, -205), normalized */
36#22=DIRECTION('approach_dir',(0.2357,0.1414,-0.9661));
37#23=VECTOR('approach_vec',#22,212.2);
38/* DEFECT: LINE approach segment passes through workpiece body */
39/* Workpiece box (0..100, 0..100, 0..50): line crosses Z=0 at (50,30,0) — inside box */
40/* Correct fix: add retract to Z=200 above feature, then plunge to feature start */
41#24=LINE('approach_line',#20,#23);
42/* Byte assertion: contains(b'TRAJECTORY') */
43/* TRAJECTORY wraps the approach line — defect propagates to motion planning */
44#25=TRAJECTORY('approach_traj',(#24),$,$,$);
45/* Target machined feature */
46#50=MACHINED_FEATURE('pocket_c',$,$,$,$,$);
47/* End mill used for the pocket operation */
48#60=MACHINING_TOOL('endmill_10mm',$,$,$);
49/* MACHINING_OPERATION references the unsafe trajectory #25 as its toolpath */
50#70=MACHINING_OPERATION('mill_pocket_c',#60,$,$,$,$,$,$,#50,$,$);
51/* Workingstep and workplan */
52#80=MACHINING_WORKINGSTEP('pocket_c_step',#50,#70,$);
53#90=WORKPLAN('main',(#80),$,$,$);
54/* GEOMETRIC_CURVE_SET IS the model entity — OCC yields empty */
55#300=GEOMETRIC_CURVE_SET('ap238-tool-trajectory-passes-through-workpiece-body',
56  (#20,#21,#24,#25,#50,#60,#70,#80,#90));
57/* Product chain */
58#400=APPLICATION_CONTEXT('mechanical design');
59#401=PRODUCT_CONTEXT('',#400,'mechanical');
60#402=PRODUCT('M103','M103','M103',(#401));
61#403=PRODUCT_DEFINITION_FORMATION('','',#402);
62#404=PRODUCT_DEFINITION_CONTEXT(#400,'design');
63#405=PRODUCT_DEFINITION('','',#403,#404);
64#406=PRODUCT_DEFINITION_SHAPE('','',#405);
65#407=SHAPE_REPRESENTATION('',(#300),#14);
66#408=SHAPE_DEFINITION_REPRESENTATION(#406,#407);
67ENDSEC;
68END-ISO-10303-21;