Skip to content

Add temporary shape cross-section preview tool #218

Description

@trailcode

Summary

Add an interactive Shape cross-section tool that cuts selected solids with a shared local plane and shows a temporary wire preview (no sketch commit in v0).

Problem

  • There is no way to inspect a plane cut through solids before implementing sketch-from-shape.
  • Section experiments need a shape-local plane (local frame + offset), multi-select behavior, and clear temporary AIS feedback.

Implemented scope

Feature:

  • Toolbar mode Shape_cross_section with Options for local XY / XZ / YZ, Invert normal, Hide back side (display-only AIS clip, on by default), bbox-ranged Offset slider, and Clip (undoable half-space BREP cut: keep positive-normal side, replace originals).
  • Shared cutting plane for multi-select: orientation from the first selected solid's local axes; origin at the selection bbox center.
  • Temporary cyan section wires plus yellow translucent plane fill, outline, and normal arrow (preview AIS not in document / undo; Clip commits document shapes with undo).
  • Auto-preview on mode enter (if solids already selected), on selection change, and when plane/offset change. Offset/plane dragging updates the yellow plane immediately; section wires run asynchronously (cancel + latest-pending) so Options stays responsive.
  • Desktop: parallel per-solid section preview (worker pool). WASM: serial for that pool (see agents/plans/wasm-multithreading.md).
  • Empty selection shows a bold Options prompt to select shapes; clearing selection or leaving the mode removes the preview.
  • Solids the plane misses are skipped; preview clears only if nothing intersects.
  • Shape local frames (gp_Ax3) baked on move/rotate/scale finalize and persisted in JSON / shape undo records.

Code (high level):

  • src/shp_cross_section.h / .cpp
  • Mode, Options, and enter-selection restore in gui* / mode.h
  • Frame support on Shp + deltas / move-rotate-scale
  • Focused tests in tests/shp_tests.cpp

Docs:

  • docs/usage.md, docs/usage-settings.md, CHANGELOG.md
  • src/doc/gui.md, src/doc/shape.md, agents/plans/cross-section-tool.md

Acceptance criteria

  • Select solids then enter the tool (or enter then select): preview updates automatically.
  • Changing Local XY/XZ/YZ, Invert normal, or Offset updates the preview.
  • Hide back side clips display opposite the yellow arrow (default on).
  • Clip half-space cut replaces selected solids (undoable).
  • Empty selection shows bold "Select one or more shapes." and clears the preview.
  • Esc / leaving the mode clears temporary AIS.
  • Focused tests: EzyCad_tests --gtest_filter=Shp_cross_section.*:Shp_test.Cross_section*
  • Desktop Release build succeeds; wasm note: shared src/ stays dual-version compatible.

Follow-ups (out of scope)

  • Promote section curves to an editable sketch (weld/dedup; fused mid-plane can return extra line edges).
  • Optional export / copy of section wires.
  • WASM pthread pool for parallel section preview (agents/plans/wasm-multithreading.md).
  • WASM Alt + LMB drag multi-select (WASM: Alt + LMB drag does not multi-select shapes #220) — tracked separately; not part of this tool.

Related

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions