step-examples/12-5-units/U031.stp
Sources
- 07-stepcode-ifcopenshell.md T025 (complex entity `( CONVERSION_BASED_UNIT('DEG',#9) NAMED_UNIT(*) PLANE_ANGLE_UNIT() )`)
- ISO 10303-21 Ed.3 §12.2.5
Description
Plane-angle units are typically encoded as a complex entity combining `CONVERSION_BASED_UNIT('DEG',#refToRadianMeasure)`, `NAMED_UNIT(*)`, and `PLANE_ANGLE_UNIT()`. Defects: members in non-alphabetical order; conversion factor wrong (not `pi/180`); name spelled `'DEGREES'` / `'deg'`; missing `PLANE_ANGLE_UNIT()` member entirely so kernel mistakes it for length.
Reproducer recipe
`#10=( CONVERSION_BASED_UNIT('DEG',#9) NAMED_UNIT(*) PLANE_ANGLE_UNIT() );` with `#9 = PLANE_ANGLE_MEASURE_WITH_UNIT(PLANE_ANGLE_MEASURE(0.0174533),#radian)` — and a variant with factor `1.0` (treats degrees as radians).
Expected kernel behavior
Heal and accept: normalize the space-separated complex record; verify factor ≈ pi/180 within tolerance; resolve via `PLANE_ANGLE_UNIT` membership rather than the `name` string.
Notes
**See also**: U004. Synonyms: "DEG vs RADIAN complex entity", "CONVERSION_BASED_UNIT('DEG') wrong factor", "PLANE_ANGLE_UNIT missing from complex", "STEP degree unit factor not pi/180", "complex angle unit malformed".
Expected validation
occt=empty/empty gmsh=empty ifc=schema_n/a
Byte assertions
contains(b"CONVERSION_BASED_UNIT('DEG'") or contains(b'PLANE_ANGLE_UNIT')matches(rb"CONVERSION_BASED_UNIT\('DEG'")
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 (with defect highlighting)
1ISO-10303-21; 2/* U031: CONVERSION_BASED_UNIT('DEG') factor is 1.0 instead of pi/180 */ 3/* Complex plane-angle entity: ( CONVERSION_BASED_UNIT('DEG',#9) NAMED_UNIT(*) PLANE_ANGLE_UNIT() ) */ 4/* DEFECT: PLANE_ANGLE_MEASURE(1.0) â treats degrees as radians (57.3x error) */ 5/* Correct factor: PLANE_ANGLE_MEASURE(0.01745329251994329) = pi/180 */ 6HEADER; 7FILE_DESCRIPTION(('U031: DEG complex entity with wrong conversion factor 1.0'),'2;1'); 8FILE_NAME('U031.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 coordinates in mm */ 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/* Radian SI base for angle */ 19#8=(NAMED_UNIT(*) PLANE_ANGLE_UNIT() SI_UNIT($,.RADIAN.)); 20/* DEFECT: factor is 1.0 â kernel will interpret degree-values as radians */ 21/* Correct: PLANE_ANGLE_MEASURE(0.01745329251994329) */ 22#9=PLANE_ANGLE_MEASURE_WITH_UNIT(PLANE_ANGLE_MEASURE(1.0),#8); 23/* Complex plane-angle entity with wrong factor reference */ 24#10=( CONVERSION_BASED_UNIT('DEG',#9) NAMED_UNIT(*) PLANE_ANGLE_UNIT() ); 25#11=(LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.)); 26#12=(NAMED_UNIT(*) SI_UNIT($,.STERADIAN.) SOLID_ANGLE_UNIT()); 27#13=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(0.001),#11, 28 'distance_accuracy_value','maximum model space distance between geometric entities'); 29#14=(GEOMETRIC_REPRESENTATION_CONTEXT(3) GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#13)) 30 GLOBAL_UNIT_ASSIGNED_CONTEXT((#11,#10,#12)) REPRESENTATION_CONTEXT('ctx','3D')); 31/* Model entity is GEOMETRIC_CURVE_SET â OCC returns empty shape */ 32#20=GEOMETRIC_CURVE_SET('deg-wrong-factor',(#1,#2,#3,#4,#5)); 33ENDSEC; 34END-ISO-10303-21;