step-examples/12-5-units/U039.stp
Sources
- bug-reporter language: "STEP angles 57x larger than expected", "PMI angles wrong by factor of pi/180", "rotation 1.57 read as 90"
- deduced from `CONVERSION_BASED_UNIT('DEG',..)` defects in U031 plus value-side disagreement
Sender
deduced — multi-source writer pipelines where one subsystem stores angle attributes in degrees and another in radians, with a single PLANE_ANGLE_UNIT context binding both
Description
A `PLANE_ANGLE_UNIT` context is declared as degrees via a `CONVERSION_BASED_UNIT('DEG',#x)` complex entity. Numeric angle attributes elsewhere in the same file are stored as radians (e.g. a rotation of 1.5708 radians intended as 90°). A receiver that takes the unit declaration at face value reads 1.5708° (a tiny rotation, off by a factor of pi/180 ≈ 57.3); a receiver that hard-assumes radians for any PLANE_ANGLE_MEASURE silently produces the right number for the wrong reason. Symmetrical defect: unit declared `RADIAN` but values stored as degrees (90.0 read as 90 radians ≈ 5157°). The angular twin of U001's mm-vs-inch length defect. Bug-reporter language: "STEP rotation off by 57x", "angles too small", "PMI angle reads 1.57° not 90°", "1 radian or 1 degree?".
Reproducer recipe
a `PLANE_ANGLE_UNIT` context declared as `CONVERSION_BASED_UNIT('DEGREE',#refRadianMeasure)` (factor pi/180); a `MEASURE_REPRESENTATION_ITEM` carrying `PLANE_ANGLE_MEASURE(1.5708)` whose author intended 90° but emitted the radian value. Counter-fixture: `RADIAN` unit declared, value `90.0` stored.
Expected kernel behavior
surface the disagreement when the value's magnitude is implausible for the declared unit (e.g. an angle of 90 rad is unphysical); reject as malformed when out-of-range, or warn and convert per the declared unit. The unit declaration is authoritative; receivers that hard-assume one over the other hide the producer-side defect.
Notes
Angular twin of U001 (mm vs inches). **See also**: U031, Pmi067. Synonyms: "STEP angle wrong by 57x", "deg/rad confusion", "rotation off by pi/180". Provenance tier: bytes-only (Q5 full-corpus 2026-07-01).
Expected validation
occt=empty/empty gmsh=empty ifc=schema_n/a
Provenance tier
bytes-only — defect not fully embodied in fixture bytes.
Byte assertions
contains(b"CONVERSION_BASED_UNIT('DEGREE'") or contains(b"CONVERSION_BASED_UNIT('DEG'")contains(b'PLANE_ANGLE_MEASURE(1.5708') or contains(b'PLANE_ANGLE_MEASURE(90.0')
Tier-3 assertions
shape_null == True
Cross-references
Live oracle output
No live oracle data — run _run_corpus to populate.
Fixture content
Show fixture bytes
1ISO-10303-21; 2/* U039: PLANE_ANGLE_UNIT declared DEGREE but value 1.5708 is in radians */ 3/* DEFECT: producer emitted radian value; declared unit is DEGREE */ 4/* Correct receiver: read 1.5708 as 1.5708 degrees (off by factor pi/180 from intent) */ 5/* Buggy receiver (hard-codes radians): silently reads 1.5708 rad = 90 deg by accident */ 6HEADER; 7FILE_DESCRIPTION(('U039: DEGREE unit declared but 1.5708 radian value stored'),'2;1'); 8FILE_NAME('U039.stp','2026-06-20T00:00:00',(''),(''),'cad-research-suite','',''); 9FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }')); 10ENDSEC; 11DATA; 12/* Geometry: part with mm coordinates */ 13#1=CARTESIAN_POINT('origin',(0.,0.,0.)); 14#2=CARTESIAN_POINT('corner-x',(50.0,0.,0.)); 15#3=CARTESIAN_POINT('corner-y',(0.,50.0,0.)); 16#4=CARTESIAN_POINT('corner-z',(0.,0.,25.0)); 17#5=CARTESIAN_POINT('corner-xyz',(50.0,50.0,25.0)); 18/* SI radian base â required as the conversion reference for DEGREE */ 19#8=(NAMED_UNIT(*) PLANE_ANGLE_UNIT() SI_UNIT($,.RADIAN.)); 20/* Correct DEGREE conversion factor: pi/180 = 0.01745329251994329 */ 21#9=PLANE_ANGLE_MEASURE_WITH_UNIT(PLANE_ANGLE_MEASURE(0.01745329251994329),#8); 22/* DEGREE plane-angle unit declared with correct pi/180 factor */ 23#10=(CONVERSION_BASED_UNIT('DEGREE',#9) NAMED_UNIT(*) PLANE_ANGLE_UNIT()); 24#11=(LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.)); 25#12=(NAMED_UNIT(*) SI_UNIT($,.STERADIAN.) SOLID_ANGLE_UNIT()); 26#13=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(0.001),#11, 27 'distance_accuracy_value','maximum model space distance between geometric entities'); 28#14=(GEOMETRIC_REPRESENTATION_CONTEXT(3) GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#13)) 29 GLOBAL_UNIT_ASSIGNED_CONTEXT((#11,#10,#12)) REPRESENTATION_CONTEXT('ctx','3D')); 30/* DEFECT: PLANE_ANGLE_MEASURE(1.5708) â author intended 90 deg but stored pi/2 radians */ 31/* With DEGREE unit declared, a conformant receiver reads this as 1.5708 degrees */ 32/* A receiver hard-coding radians silently gets 90 degrees â hiding the defect */ 33#20=MEASURE_REPRESENTATION_ITEM('rotation_angle',PLANE_ANGLE_MEASURE(1.5708),#10); 34/* Model entity is GEOMETRIC_CURVE_SET â OCC returns empty shape */ 35#30=GEOMETRIC_CURVE_SET('deg-declared-radian-stored',(#1,#2,#3,#4,#5)); 36ENDSEC; 37END-ISO-10303-21;