Skip to content

feat(exchange): export_step_in for bodies in a unit other than metres - #35

Open
Basnederveen wants to merge 1 commit into
OpenGeometry-io:mainfrom
Bas-Automation-Services:feat/step-model-unit
Open

Basnederveen wants to merge 1 commit into
OpenGeometry-io:mainfrom
Bas-Automation-Services:feat/step-model-unit

Conversation

@Basnederveen

Copy link
Copy Markdown

What

export_step takes a body's coordinates as metres and scales them to the file unit. A body built in millimetres had no way to say so: exporting it as millimetres multiplied every coordinate by 1000, so a 100 mm plate came out 100 m wide.

export_step_in(brep, model_unit, unit) takes the unit the body is built in ("metre" or "millimetre") and scales from it to the file unit once. export_step(brep, unit) keeps its behaviour and delegates with model_unit = "metre".

  • The scale is a fixed table (1, 1000, 1e-3), so metre bodies export the same digits as before.
  • The file unit check and its message are unchanged; an unknown model unit is InvalidGeometry too.
  • export_bodies gets the model unit as a parameter. The world graph passes "metre", so world-graph STEP export (and its binding) behaves as before. A model-unit option there could follow if wanted.

Tests

  • New exchange::step::tests::a_body_in_millimetres_exports_unscaled_in_millimetres: a millimetre body exported to millimetres is the metre export digit for digit except the SI_UNIT prefix; the default path still scales; millimetre to metre scales the report's bounds by 1e-3; unknown file or model units are refused.
  • cargo fmt --check, cargo clippy --all-targets -D warnings: clean.
  • cargo test --all-targets --no-fail-fast (with CI=true, Windows x86_64): 786 pass, 0 fail, 1 ignored. Clean main gives 785 pass, 0 fail, the same 1 ignored; the extra test is the new one.
  • npm run check:source, check:duplicates, check:cycles: clean. check:api not run (needs the SDK build); no TypeScript or binding signature changes.

Files

  • main/opengeometry/src/exchange/step/mod.rs
  • main/opengeometry/src/exchange/step/tests.rs
  • main/opengeometry/src/exchange/mod.rs
  • main/opengeometry/src/world_graph/export.rs

🤖 Generated with Claude Code

export_step takes a body's coordinates as metres and scales them to the
file unit. A body built in millimetres had no way to say so: exporting
it as millimetres multiplied every coordinate by 1000 (a 100 mm plate
came out 100 m wide).

export_step_in(brep, model_unit, unit) takes the unit the body is built
in ("metre" or "millimetre") and scales from it to the file unit once.
export_step keeps its behaviour and delegates with model_unit = "metre".
The scale is a fixed table, so metre bodies export the same digits as
before. export_bodies takes the model unit; the world graph passes
"metre".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VFZvqx1RmXzPtbL9VXP4H7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant