Skip to content

feat: STEP import takes up for Y-up files and names for the bodies' names - #1312

Merged
bherbruck merged 1 commit into
tangency-labs:mainfrom
NOWN-DEV:feat/step-import-up-and-names
Oct 15, 2026
Merged

bherbruck merged 1 commit into
tangency-labs:mainfrom
NOWN-DEV:feat/step-import-up-and-names

Conversation

@NOWN-DEV

Copy link
Copy Markdown
Contributor

Closes #1265.

Change

Missing. Two things about a STEP file from another CAD system could not be said to the commands that import it (doc.open, file.insert_step, and the MCP open tool).

  • Which way is up. Many systems write Y up, so the part lies on its back in SolidCraft's Z-up space. The window offers to stand it up after opening (Y-up STEP files import lying on their backs (add Y-up / Z-up orientation) #3), but a script or an agent had to find the names of the bodies and add a solid.move of 90 degrees about X itself.
  • What the bodies are called. A body is named after its solid in the file. Some systems fill the solid's name with the last feature that made it (Cut-Extrude3), so the bodies of an assembly come in with names that say nothing about their parts, while the importer reads the product (the part) and the assembly occurrence (the instance) too.

Now. Two optional parameters, for STEP and IGES files; a call without them gives the design it gave before.

  • up: "z" (default: the file's axes are kept) or "y": the file's bodies are turned a quarter turn about X (Y becomes Z) by one Move feature right after the Import, the Move the window's "Stand it up" offer adds. The import and the turn are one undo step, the reply names the Move as stand_up, only the file's bodies turn (not the ones already in the design), and the window does not offer to stand the part up after a call that said which way is up.
  • names: "solid" (default, as before), "product" (the name of the part that holds the body) or "instance" (the name of the assembly occurrence, the product's for a body that is in none). A name the file leaves out or fills with a placeholder falls back to the next one. The names are stored in the Import's existing per-body names, so a saved design reopens with them, and repeated names are numbered as ever (Post, Post (2)).
{"command": "file.insert_step", "params": {"path": "frame.step", "up": "y", "names": "instance"}}

The default of names stays the solid's name: SolidCraft's own STEP export writes a body's name there, so another default would rename the bodies of every round trip. Other values are refused with a message, and doc.open refuses the options for a design file.

How:

  • solidcraft-kernel: an imported body knows the assembly occurrence it is (ImportedBody::instance) next to its product path.
  • solidcraft-io: StepNames and step_import_feature_named; step_import_feature is the same call with the default.
  • solidcraft-engine: up and names on file.insert_step and doc.open.
  • solidcraft-ui-egui: the app's control channel passes up and names to the command (it passed only path), and skips the offer when up is given.
  • solidcraft-mcp: the open tool takes up and names; docs/step-import.md and docs/mcp.md describe them.
  • No change to the file format: the Move and the per-body names are what a design stores already.

Validation

Six new tests, in the repo's style next to the code. The frame they use is what another system writes with Y up: a plate 40 × 4 × 20 and a post 4 × 30 × 4 placed twice on it, as products Frame, Plate and Post, occurrences Plate-1, Post-1, Post-2, solids named Cut-Extrude3 and Boss-Extrude1. SolidCraft's own exporter writes it in the tests (step_export_products).

  • solidcraft-kernel, step_in/tests.rs: bodies_know_their_product_and_instance (each body's product path and occurrence); the two import tests that read assemblies also check the new field.
  • solidcraft-io: step_import_names_follow_the_choice (the stored per-body names for each choice, placeholders falling back, the default unchanged).
  • solidcraft-engine, tests/step_import_options.rs: a_y_up_step_file_comes_in_standing_up (extent as written, and after up: "y"; the Move feature; one undo step; only the file's bodies turn; "z" and null as the default), opening_a_y_up_step_file_can_stand_it_up (doc.open; no history on a freshly opened design; a design file refuses the options), wrong_up_and_names_are_refused (other values and types, with the design left as it was), the_bodies_are_named_after_the_solid_the_product_or_the_instance.
  • solidcraft-mcp: open_stands_a_y_up_step_file_up (the open tool; its schema refuses other values).
  • solidcraft-ui-egui: a_control_import_passes_up_and_names_on (an import bridged through the window: up and names reach the command, the reply is the session's, and the stand-up offer is made only when the call did not say which way is up).

The engine, mcp and ui tests fail on main (up and names are ignored there); the kernel and io tests need the new ImportedBody::instance and StepNames.

The same frame through solidcraft-cli (file.insert_step, then eval), built from main and from this change:

call main (up and names ignored) this change
{path} Cut-Extrude3, Boss-Extrude1, Boss-Extrude1 (2); x 0..40, y 0..34, z 0..20 the same
up: "y" the same: lies on its back, 1 feature 2 features (Import, Move); x 0..40, y −20..0, z 0..34
names: "product" Cut-Extrude3, Boss-Extrude1, Boss-Extrude1 (2) Plate, Post, Post (2)
names: "instance" Cut-Extrude3, Boss-Extrude1, Boss-Extrude1 (2) Plate-1, Post-1, Post-2
up: "y", names: "instance" Cut-Extrude3, ...; lies on its back Plate-1, Post-1, Post-2; standing up, z 0..34
up: "x" accepted, ignored refused: up must be "z" or "y"

The whole cargo xtask ci ran once on Windows for this commit (f7914b0f, on 1cc65cbc) merged with two other independent changes of mine, posted beside it as their own pull requests, on main ed22d663 (combined commit cdbc2773). It passes fmt, assets, licences, layers, clippy -D warnings, the wasm32 check, the doc tests, the render tests and the action matrix. What failed is not these changes':

  • The tests plain main fails on this machine (41f0c3d0, the same night): the robustness goldens all_0 to all_3 and issue_851_tests::arc_top_edge_sizes_never_panic in the kernel, and crash::tests::startup_steps_survive_a_rebase_and_running_ends_startup (Native crash capture on Windows, and startup steps in crash reports #1215), which reads the journal through a second handle while the journal holds its exclusive lock; Windows refuses that, as crash.rs says at read_live_journal; and render_workspace::tests::control_render_export_respects_upstream_file_scope (render: persist and consume opaque PBR in product preview and PNG #1046): this machine's temporary folder has a short (8.3) name, which the file scope refuses before it gets to the check the test expects.
  • viewport::tests::cpu_viewport_redraws_in_the_new_theme failed beside the other test binaries and passes alone. This commit changes only the STEP reader (crates/kernel/src/step_in/), crates/io/src/lib.rs, the engine's file.rs and its new tests/step_import_options.rs, the MCP's tools and tests, the window's file_load.rs and its tests, and the docs.

On the same change: cargo fmt --all --check and cargo clippy -p solidcraft-kernel -p solidcraft-io -p solidcraft-engine -p solidcraft-mcp -p solidcraft-ui-egui --all-targets --profile ci --locked -- -D warnings clean; the lib tests of the five crates pass except for tests that depend on this machine (a 30 s wall-clock limit, the golden robustness runs, a thread fillet, an 8.3 temp path, and a GPU test process that crashed once under load and passes alone).

Screenshots of the behavior (when observable)

The frame as a Y-up file comes in, on main and with this change without up (first), and with up: "y" (second):

main: the frame lies on its back
this change, up: "y": the frame stands up

The names are in the table above; the window has no dialog for the options, so there is no picture of one.

Integration status

Based on origin/main 1cc65cbc, one commit, not stacked. Searched upstream issues and pull requests, open and closed (stand up, Y-up, up_axis, STEP product name, insert_step, import names): #3 (closed: the window's preference and offer) and nothing on a command option or on names. No new stored field (the Move and the per-body names are what a design holds already), so the format does not change. It merges cleanly with main at 8535d229 (#1300).

🤖 Generated with Claude Code

…s' names

`doc.open`, `file.insert_step` and the MCP `open` tool take two optional
parameters for STEP and IGES files; without them a file comes in as before.

- `up`: "z" (default, the file's axes are kept) or "y". "y" turns the
  file's bodies a quarter turn about X (Y becomes Z) with one Move feature
  after the Import, the one the window's "Stand it up" offer adds, in the
  same undo step as the import; the reply names it as `stand_up`. The
  window makes no offer after a call that said which way is up.
- `names`: "solid" (default, as before), "product" or "instance": what the
  bodies are named after, the solid's own name, the part's, or the
  assembly occurrence's. A name the file leaves out or fills with a
  placeholder falls back to the next one. The names go into the Import's
  existing per-body names, so no new field is stored and the file format
  does not change. The default stays the solid's name because SolidCraft's
  own STEP export writes a body's name there.

An imported body now knows the assembly occurrence it is
(`ImportedBody::instance`), and the app's control channel passes `up` and
`names` on to the command (it passed only the path).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.

STEP import fits files from other CAD systems: up for Y-up files and names for the bodies' names

2 participants