M072 — AP238 toolpath_curve open chain claimed as closed contour

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

P1 — silent data loss

crash

Sources

Sender

deduced — STEP-NC CAM post-processor

Description

A `TRAJECTORY` references a `COMPOSITE_CURVE` whose `self_intersect = .F.` and which is consumed as a closed contouring pass, but the underlying `COMPOSITE_CURVE_SEGMENT` chain does not actually close in 3D (the last segment's endpoint != the first segment's startpoint). Bug-reporter language: "toolpath should close but doesn't", "contour pass leaves a gap", "STEP-NC malformed toolpath_curve".

Reproducer recipe

A `COMPOSITE_CURVE` listing two `COMPOSITE_CURVE_SEGMENT`s that form an "L" (e.g. line p1->p2, line p2->p3), referenced by a `TRAJECTORY` as if it were a closed loop.

Expected kernel behavior

validate continuity / closure of the segment chain before treating as a closed contour; emit a synthesized closing segment, or reject as malformed, or treat as an open pass.

Notes

Synonyms: "non-closed toolpath", "trajectory doesn't loop", "AP238 contour pass not closed", "open toolpath claimed as closed".

Expected validation

occt=signal(11)/signal(11) gmsh=signal(11) ifc=schema_n/a

Byte 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/* M072: AP238 TRAJECTORY references open COMPOSITE_CURVE as closed contour */
3/* DEFECT: L-shaped chain (p1->p2->p3) does not close; p3 != p1 */
4/* Byte assertion: contains(b'AP238_STEP_NC_MIM') */
5/* Byte assertion: contains(b'COMPOSITE_CURVE') */
6/* Byte assertion: contains(b'TRAJECTORY') */
7HEADER;
8FILE_DESCRIPTION(('M072: AP238 toolpath_curve open chain claimed as closed contour'),'2;1');
9FILE_NAME('M072.stp','2026-06-21T00:00:00',(''),(''),'cad-research-suite','','');
10/* Byte assertion: contains(b'AP238_STEP_NC_MIM') */
11FILE_SCHEMA(('AP238_STEP_NC_MIM { 1 0 10303 238 3 1 1 1 }'));
12ENDSEC;
13DATA;
14/* Standard unit context */
15#10=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
16#11=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
17#12=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
18#13=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(0.001),#10,
19  'distance_accuracy_value','maximum model space distance between geometric entities');
20#14=(GEOMETRIC_REPRESENTATION_CONTEXT(3)
21  GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#13))
22  GLOBAL_UNIT_ASSIGNED_CONTEXT((#10,#11,#12))
23  REPRESENTATION_CONTEXT('ctx','3D'));
24/* L-shaped open chain: p1(0,0,0) -> p2(10,0,0) -> p3(10,10,0) */
25/* The chain does NOT close: p3(10,10,0) != p1(0,0,0) */
26#20=CARTESIAN_POINT('p1',(0.,0.,0.));
27#21=CARTESIAN_POINT('p2',(10.,0.,0.));
28#22=CARTESIAN_POINT('p3',(10.,10.,0.));
29/* Line seg 1: p1 -> p2 (along X axis) */
30#23=DIRECTION('dir_x',(1.,0.,0.));
31#24=VECTOR(#23,10.);
32#25=LINE('seg1_line',#20,#24);
33/* Line seg 2: p2 -> p3 (along Y axis) */
34#26=DIRECTION('dir_y',(0.,1.,0.));
35#27=VECTOR(#26,10.);
36#28=LINE('seg2_line',#21,#27);
37/* COMPOSITE_CURVE_SEGMENTs forming the L shape */
38#30=COMPOSITE_CURVE_SEGMENT(.CONTINUOUS.,#25);
39#31=COMPOSITE_CURVE_SEGMENT(.CONTINUOUS.,#28);
40/* Byte assertion: contains(b'COMPOSITE_CURVE') */
41/* COMPOSITE_CURVE: self_intersect=.F., open chain claimed as closed by TRAJECTORY */
42#32=COMPOSITE_CURVE('l_shaped_toolpath',(#30,#31),.F.);
43/* Byte assertion: contains(b'TRAJECTORY') */
44/* TRAJECTORY references the open composite curve as a closed contour */
45#40=TRAJECTORY('contour_pass','closed contouring trajectory',(),(),#32,$);
46/* WORKPLAN wrapping the trajectory */
47#50=WORKPLAN('main_program','AP238 STEP-NC workplan',(),$,());
48/* GEOMETRIC_CURVE_SET IS the model entity — OCC yields empty */
49#60=GEOMETRIC_CURVE_SET('ap238-toolpath-open-chain-claimed-closed',
50  (#32,#40,#20,#21,#22,#25,#28));
51/* Product chain */
52#70=APPLICATION_CONTEXT('mechanical design');
53#71=PRODUCT_CONTEXT('',#70,'mechanical');
54#72=PRODUCT('M072','M072','M072',(#71));
55#73=PRODUCT_DEFINITION_FORMATION('','',#72);
56#74=PRODUCT_DEFINITION_CONTEXT(#70,'design');
57#75=PRODUCT_DEFINITION('','',#73,#74);
58#76=PRODUCT_DEFINITION_SHAPE('','',#75);
59#77=SHAPE_REPRESENTATION('',(#60),#14);
60#78=SHAPE_DEFINITION_REPRESENTATION(#76,#77);
61ENDSEC;
62END-ISO-10303-21;