M074 — AP238 left-handed setup coordinate frame on multi-axis machine

§12.8 mixed (sub-class: AP238 axis system handedness)

P1 — silent data loss

spec-violation

Sources

Sender

deduced — STEP-NC publisher with axis-direction sign error

Description

A `SETUP`'s csys is built from an `AXIS2_PLACEMENT_3D` whose `axis` (Z) and `ref_direction` (X) yield `Y = Z × X` pointing in the opposite direction from the intended right-handed Y. On a 3-axis machine the consequence is a mirrored part; on a 5-axis machine, all rotary motions invert and the resulting geometry is the geometric mirror of the design. Bug-reporter language: "machined part is mirrored", "5-axis output is the reflection of the design", "STEP-NC axis frame wrong-handed".

Reproducer recipe

`AXIS2_PLACEMENT_3D` with `axis = DIRECTION(0,0,-1)` and `ref_direction = DIRECTION(1,0,0)` used as a setup origin; combined with a multi-axis `MACHINING_WORKINGSTEP`.

Expected kernel behavior

validate handedness via cross-product sign; reject as malformed or honor the explicit frame and warn.

Notes

Synonyms: "mirrored toolpath", "left-handed coordinate system", "axis2_placement Z flipped".

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/* M074: AP238 left-handed setup coordinate frame on multi-axis machine */
3/* DEFECT: AXIS2_PLACEMENT_3D with axis (0,0,-1) yields left-handed Y = Z x X = (0,-1,0) */
4/* On 5-axis machine: all rotary motions invert, part is mirror of design */
5/* Byte assertion: contains(b'AP238_STEP_NC_MIM') */
6/* Byte assertion: contains(b'MACHINING_WORKINGSTEP') */
7/* Byte assertion: contains(b'SETUP') */
8HEADER;
9FILE_DESCRIPTION(('M074: AP238 left-handed setup csys on 5-axis machine'),'2;1');
10FILE_NAME('M074.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 3 1 1 1 }'));
13ENDSEC;
14DATA;
15#1=APPLICATION_CONTEXT('numerical_control_machining');
16#2=APPLICATION_PROTOCOL_DEFINITION('international standard',
17  'numerical_control_machining',2007,#1);
18/* Standard unit context */
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('ctx','3D'));
28/* Setup origin */
29#20=CARTESIAN_POINT('setup_origin',(0.0,0.0,0.0));
30/* DEFECT: Z-axis direction is (0,0,-1) — negated Z */
31/* Implied Y = Z x X = (0,0,-1) x (1,0,0) = (0,-1,0) — left-handed frame */
32#21=DIRECTION('z_inverted',(0.0,0.0,-1.0));
33#22=DIRECTION('x',(1.0,0.0,0.0));
34/* AXIS2_PLACEMENT_3D: axis=(0,0,-1), ref_direction=(1,0,0) => left-handed */
35#23=AXIS2_PLACEMENT_3D('setup_csys',#20,#21,#22);
36/* Byte assertion: contains(b'SETUP') */
37/* SETUP referencing the left-handed csys */
38#30=SETUP('part_setup',$,$,$,#23);
39/* Byte assertion: contains(b'MACHINING_WORKINGSTEP') */
40/* MACHINING_WORKINGSTEP — 5-axis workingstep referencing the bad setup */
41#40=MACHINING_WORKINGSTEP('ws1',$,$,$,#30);
42/* GEOMETRIC_CURVE_SET IS the model entity — OCC yields empty */
43#50=GEOMETRIC_CURVE_SET('ap238-left-handed-setup-csys-5axis-mirror',
44  (#20,#23,#30));
45/* Product chain */
46#100=APPLICATION_CONTEXT('mechanical design');
47#101=PRODUCT_CONTEXT('',#100,'mechanical');
48#102=PRODUCT('M074','M074','M074',(#101));
49#103=PRODUCT_DEFINITION_FORMATION('','',#102);
50#104=PRODUCT_DEFINITION_CONTEXT(#100,'design');
51#105=PRODUCT_DEFINITION('','',#103,#104);
52#106=PRODUCT_DEFINITION_SHAPE('','',#105);
53#107=SHAPE_REPRESENTATION('',(#50),#14);
54#108=SHAPE_DEFINITION_REPRESENTATION(#106,#107);
55ENDSEC;
56END-ISO-10303-21;