Wr050 — Geometry coordinate values doubled on export (writer applies scale and unit-conversion both)

§12.13 writer-pathology (sub-class: units / coordinate scale)

P1 — silent data loss

round-trip writer

Sources

Sender

FreeCAD writer when both a Draft Scale operation and a unit conversion are in the pipeline; the writer composes them in series instead of choosing one path.

Description

A part the user dimensioned as 20 mm outer / 13 mm inner round-trips as 40 mm / 26 mm — every coordinate doubled. The writer applies both the source-document scale (which was already 1.0) and the export-unit conversion factor — but treats the document scale as if it were a coordinate-space transform on top. The output STEP carries doubled coordinates in a context that still claims millimetres. Distinct from Wr035 (×1000) and Wr044 (inch label only) by the specific 2× factor.

Reproducer recipe

STEP cube authored as 20 mm side; emit `CARTESIAN_POINT` coordinates of `(40.0, 40.0, 40.0)` with `LENGTH_UNIT` declaring SI MILLI METRE.

Expected kernel behavior

writer composes the Placement-and-unit pipeline once; refuses to chain document-scale into unit-conversion; emits a self-test that round-trips a known-volume primitive before writing user data.

Notes

**See also**: Wr035, U015, Wr044. Synonyms: "STEP export doubles all coordinates", "20mm becomes 40mm on import", "two-times scale factor on STEP export", "writer applies scale twice". Provenance tier: writer-side (Q5 full-corpus 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

Tier-3 assertions

Cross-references

Wr035, U015, Wr044

Live oracle output

No live oracle data — run _run_corpus to populate.

Fixture content

Show fixture bytes (with defect highlighting)
1ISO-10303-21;
2/* Wr050: geometry coordinate values doubled on export */
3/* FreeCAD #17729: writer applied both document scale (1.0) and unit conversion */
4/* factor in series — two-pass pipeline doubles every coordinate value */
5/* 20 mm cube → coordinates 40.0 in a context still claiming MILLI METRE */
6/* Receivers load a 40 mm cube (2× the producer's 20 mm intent) */
7HEADER;
8FILE_DESCRIPTION(('Wr050: coordinate values doubled by scale+unit-conversion both'),'2;1');
9FILE_NAME('Wr050.stp','2026-06-20T00:00:00',(''),(''),'cad-research-suite','','');
10FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }'));
11ENDSEC;
12DATA;
13/* DEFECT: coordinates are 40.0 — double the 20 mm original — but unit is MILLI METRE */
14/* Source was a 20 mm cube; correct coordinates would be (20.0, 20.0, 20.0) in mm */
15/* Writer composed document-scale (1.0) into unit-conversion, applying the factor twice */
16#1=CARTESIAN_POINT('origin',(0.,0.,0.));
17#2=CARTESIAN_POINT('corner-x',(40.0,0.,0.));
18#3=CARTESIAN_POINT('corner-y',(0.,40.0,0.));
19#4=CARTESIAN_POINT('corner-z',(0.,0.,40.0));
20#5=CARTESIAN_POINT('corner-xyz',(40.0,40.0,40.0));
21#6=DIRECTION('xdir',(1.,0.,0.));
22#7=DIRECTION('zdir',(0.,0.,1.));
23/* DEFECT: MILLI METRE declared; 40.0 values should be 20.0 for a 20 mm cube */
24#8=(LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.));
25#9=GEOMETRIC_CURVE_SET('doubled-coords-20mm-cube',(#1,#2,#3,#4,#5));
26ENDSEC;
27END-ISO-10303-21;