step-examples/12-13-writer-pathology/Wr044.stp
Sources
- FreeCAD #18078
- bug-reporter language: "exports geometry data as mm but tags file as inch — model scales up", "inch unit selected but values are still mm".
Sender
FreeCAD with OCCT 7.8.x where the user picks "inch" in the STEP-export unit drop-down but the writer skips the value-side conversion.
Description
The user selects inches in the STEP-export unit dialog. The writer emits a `LENGTH_UNIT` complex record claiming inches, but every `CARTESIAN_POINT` carries the original millimetre values verbatim with no scale division. A part the user authored as a 25.4 mm cube round-trips as a 25.4 inch (645 mm) cube; visibly 25.4× larger on re-import. The unit declaration and the numeric content disagree.
Reproducer recipe
minimal `MANIFOLD_SOLID_BREP` cube; `GEOMETRIC_REPRESENTATION_CONTEXT` with `LENGTH_UNIT` complex record `(LENGTH_UNIT() NAMED_UNIT(*) CONVERSION_BASED_UNIT('INCH', ..))`; `CARTESIAN_POINT` corner coordinates `(25.4, 25.4, 25.4)` (millimetre values, not inches).
Expected kernel behavior
Heal and accept: writer divides every coordinate by 25.4 when it changes the declared unit; or warn and accept by warning the user that values were not converted. Receivers should heal the mismatch when validation properties (volume, surface area) are present and contradict the declared unit; otherwise they have no way to know. Accepting unit/value disagreement without diagnostic is a coverage gap.
Notes
Subset of Wr035 but with concrete inch-vs-mm symptom. **See also**: Wr035, U015. Synonyms: "STEP file marked inch but model is mm-sized", "unit dropdown changes label only", "inch unit but coords are mm", "writer forgot to convert when changing unit". Provenance tier: writer-side (Q5 reclassification 2026-07-01).
Expected validation
occt=empty/empty gmsh=empty ifc=schema_n/a
Provenance tier
writer-side — defect not fully embodied in fixture bytes.
Byte assertions
contains(b'INCH')contains(b'CARTESIAN_POINT') and contains(b'25.4')
Tier-3 assertions
load == "ok"
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/* Wr044: inch unit declared in LENGTH_UNIT but coordinates are in millimetres */ 3/* FreeCAD #18078: user picks inch export unit; writer labels file as inch but */ 4/* emits mm coordinates unchanged (skips the divide-by-25.4 conversion pass) */ 5/* A 25.4 mm cube round-trips as a 25.4 inch (645 mm) cube â 25.4x too large */ 6HEADER; 7FILE_DESCRIPTION(('Wr044: inch unit declared but coordinates are in mm'),'2;1'); 8FILE_NAME('Wr044.stp','2026-06-20T00:00:00',(''),(''),'cad-research-suite','',''); 9FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }')); 10ENDSEC; 11DATA; 12/* DEFECT: LENGTH_UNIT declares INCH but all coordinates are millimetre values */ 13/* Correct inch file would have corner at (1.0, 1.0, 1.0) â 25.4mm / 25.4 */ 14#1=CARTESIAN_POINT('origin',(0.,0.,0.)); 15#2=CARTESIAN_POINT('corner-x',(25.4,0.,0.)); 16#3=CARTESIAN_POINT('corner-y',(0.,25.4,0.)); 17#4=CARTESIAN_POINT('corner-z',(0.,0.,25.4)); 18#5=CARTESIAN_POINT('corner-xyz',(25.4,25.4,25.4)); 19#6=DIRECTION('xdir',(1.,0.,0.)); 20#7=DIRECTION('zdir',(0.,0.,1.)); 21/* DEFECT: unit declared as INCH; coordinates are mm values (25.4 should be 1.0) */ 22#8=LENGTH_MEASURE_WITH_UNIT(LENGTH_MEASURE(25.4),#9); 23#9=(LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.)); 24#10=(CONVERSION_BASED_UNIT('INCH',#8) LENGTH_UNIT() NAMED_UNIT(*)); 25#11=GEOMETRIC_CURVE_SET('inch-unit-mm-coords-shape',(#1,#2,#3,#4,#5)); 26ENDSEC; 27END-ISO-10303-21;