Repository navigation
STEP export: shelled revolved bodies export instead of panicking - #1496
Merged
bherbruck merged 3 commits intoOct 16, 2026
Merged
Conversation
… refusal
A shell or an offset moves a revolved cylinder or cone face by a scale across
its axis that differs from the scale along it. truck's writer took only
uniform scales and refused the rest by returning fmt::Error, and truck_step
turned that into a panic with to_string() ("a Display implementation returned
an error unexpectedly"): STEP export of a shelled revolved body failed, and the
browser build aborts on any panic (robustness seeds 19 and 24).
- truck_step formats the writer with write! and turns a refusal into
"not supported yet: STEP export of this body (<the writer's reason>)".
- The vendored writer takes any transform that commutes with turning about the
surface's axis: across the axis a similarity onto the plane across the image
axis, any scale along it. The transformed profile revolved about the
transformed axis is then exactly the surface. Other transforms are refused as
before.
Tests: a revolved body scaled 1.5 across and 0.5 along its axis round-trips;
one scaled along a single cross direction never panics on export; seeds 19 and
24 (shrunk to three steps each) export and read back as the same solid. The two
kernel tests fail without the change with the seeds' panic.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
STEP export of a shelled revolved body failed, and the failure was a panic.
vendor/truck-stepio/src/out/geometry.rs) only took uniform scales for a transformed surface of revolution. It refused the rest by returningfmt::Error.truck_step(crates/kernel/src/step.rs) calledto_string()on the writer, which panics on thatErr("a Display implementation returned an error unexpectedly").guardcatches the panic: the user sees "kernel internal error" and cannot export. The web build aborts on any panic.How it was found. I round-tripped the robustness designs through STEP (export, then import). Seeds 19 and 24 hit it. Each shrinks to three commands: a three-quarter revolve of a rectangle, then a sphere cut or a chamfer, then a shell.
The fix has two parts:
truck_stepformats the writer withwrite!and turns a refusal intoKernelError::Failed("not supported yet: STEP export of this body (<the writer's reason>)").vendor/README.mdrecords the vendored change.Validation
Kernel tests:
step_in::tests::revolved_faces_scaled_across_the_axis_round_trip: a three-quarter revolve, scaled 1.5 across and 0.5 along its axis, exports and reads back with the same volume and area (the existing strictround_triphelper).step_in::tests::revolved_faces_skewed_never_panic_on_export: scaled along one cross direction only, so no longer a surface of revolution. Export never panics. It either returns an error that says "not supported yet", or writes a file that round-trips.Engine tests:
crates/engine/tests/step_export_regressions.rsruns seeds 19 and 24 as engine commands. Both export and read back closed, with no warnings, and volume and area within 0.1 %.Lint:
cargo clippy --profile ci -p solidcraft-kernel -p solidcraft-engine --all-targets -- -D warningsandcargo fmt --all -- --checkare clean.Wider runs:
stepin its name passes. That includes those from feat: STEP import takesupfor Y-up files andnamesfor the bodies' names #1312, which changed STEP import. This was run on the branch merged with main, and again with the other STEP export fix (STEP export: a merged partial cylinder keeps its cylinder (silent volume loss) #1497, merged faces keep their cylinder) applied as well.Not run:
cargo xtask ci.cargo xtask wasm: there is no wasm32 target in my environment. The change adds no platform code.Screenshots of the behavior (when observable)
Not attached. Before: File → Export STEP on the seed 19 design fails with "kernel internal error". After: it writes a file that reads back with the same volume and area.
Integration status
Merged
upstream/mainat 0872eb9, including #1312's STEP import changes, with no conflicts. The validation above ran after the merge.