Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edit those columns by hand, then re-run the script.
the feature-tree level) · `done` (regenerates, round-trips save/load, undo/redo, command +
MCP, tests) · `verified` (done + golden/e2e coverage + reviewed on macOS).

**Totals:** 1000 rows — not started: 834 · in progress: 138 · done: 28 · verified: 0
**Totals:** 1000 rows — not started: 833 · in progress: 139 · done: 28 · verified: 0

## Platform (SPEC §2–§6, §8–§9)

Expand Down Expand Up @@ -1120,7 +1120,7 @@ MCP, tests) · `verified` (done + golden/e2e coverage + reviewed on macOS).
| `D/transparency` | Per-body/component transparency | not started | ForgeModel | — | — | |
| `D/section-view-part` | Section view (dynamic display section in parts/assemblies) | not started | ForgeModel | — | — | |
| `D/view-selector` | View selector cube, named/saved views, previous view | not started | ForgeModel | — | — | |
| `D/zoom-to-selection` | Zoom to selection / zoom to area | not started | ForgeModel | — | — | |
| `D/zoom-to-selection` | Zoom to selection / zoom to area | in progress | ForgeCommands / ForgeUI | SelectionFramingTests, SelectionFramingWorkflowTests, MCP framing workflow | `zoom_to_selection` | Selected visible body/subshape/sketch bounds, orientation/projection preserved, empty/hidden no-op and previous-view history on all desktop shells. Sketch outlines are sampled; rectangle zoom-to-area pending. |
| `D/display-states-part` | Display states in parts | not started | ForgeModel | — | — | |
| `D/feature-comments` | Comments/notes on features | not started | ForgeModel | — | — | |
| `D/selection-sets` | Selection sets (saved selections) | not started | ForgeModel | — | — | |
50 changes: 50 additions & 0 deletions PROGRESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,56 @@ BSD find; those unrelated files are unchanged and all three pass in Linux CI.
Remaining scope: curved/tangent/directed/reflex angle measurements, maximum/normal
and projected distances, sketch-entity measurements and broader SolidWorks parity.

## 2026-10-02 — Portable Windows dependency packaging checks

- Replaced GNU `find -printf` in OCCT DLL-directory discovery with batched portable
shell extraction, preserving spaces/quotes without installing GNU find on macOS.
- Corrected debug/plugin directory exclusions at the end of a path. The offline archive
fixture now includes excluded DLLs and asserts that the original PATH is preserved
exactly after the one permitted toolkit directory is prepended. Existing download,
incomplete-cache, quoting and cache-reuse assertions remain intact.
- Added the three offline packaging regressions to native Mac CI as well as Linux CI.

Validation: shell syntax and all **three packaging regressions** pass locally on
macOS using BSD find; whitespace checks pass. No Swift product code changed.

## PR #8 review follow-up — 2026-10-02 — Native camera intent ordering

- Native orbit, pan, wheel, magnify, rotate and double-click fit invalidate pending
selection framing synchronously before camera mutation on macOS and the shared
Windows/Linux viewport. Deferred camera publication cannot admit an old result.
- Queued selection fits carry their request generation; both viewport consumers skip
fits invalidated by newer input before queue consumption. Deterministic regressions
cover an engine request held across input/deferred publication and input after enqueue.
- Merged the current default branch, preserving the user-merged angle measurement and
packaging fixes, all progress entries and both MCP workflows.

Validation: native build, all four focused selection-framing workflow tests, seven MCP
workflows, three packaging regressions and shared frontend type-check pass. Matrix and
whitespace checks pass; full platform suites run in exact-head CI.

## Navigation follow-on — 2026-10-02 — Zoom to Selection

- Added read-only `view.zoom_to_selection` and MCP `zoom_to_selection`, with explicit
or current selection, tight body/subshape union bounds, placed sketch display bounds,
point framing and validated camera/aspect inputs. Hidden/isolation-excluded bodies,
planes and constraints are skipped; malformed or stale geometry references fail.
- Added macOS, Windows and GTK View/menu/viewport/body-context actions using shared
selection framing and existing Previous View history. Async results cannot replace
a newer document, selection or camera action. Orientation and projection are preserved.
- Returned cameras feed render/pick/candidate views directly. Perspective clipping also
accounts for a close selection when unrelated geometry is far from the camera.

Validation: private macOS 27 / Swift 6.4 / OCCT 8.0.1 build and **386 Swift tests**,
**33 golden models** and **six MCP subprocess workflows** pass. A clean `/tmp` Swift
scratch directory avoids Finder metadata on generated test bundles. Native GTK menu
action assertions run in CI; no live desktop app windows were launched. The separate
packaging portability change is independent of this branch. Matrix and whitespace
checks pass.

Remaining boundaries: sketch extents use sampled viewport polylines. Whole sketches
exclude the fixed origin and owned definition points. Rectangle zoom-to-area is pending.

## Session 12 — 2026-09-30 — Selected contours, planar limits and selection filters

- Added `sketch.regions` with stable complete-curve selectors, holes, nested islands,
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ bus, reachable from the UI, scripts, `forge-cli` and MCP alike.

![Headless render of a golden model](docs/images/m0-multiview.png)

Zoom to Selection is available in the desktop View menu, viewport controls and body
context menu. It frames selected visible bodies, faces, edges, vertices and sketch
geometry while preserving orientation and projection, with Previous View restoring
the old camera. Empty or fully hidden selections leave the view unchanged.
`view.zoom_to_selection` (MCP `zoom_to_selection`) returns bounds and a camera that
can be supplied as `view.camera` to rendering and picking commands. Sketch bounds
use sampled display outlines; rectangle zoom-to-area remains pending.

## Layout

```
Expand Down
1 change: 1 addition & 0 deletions Sources/CForgeWin/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,7 @@ static void buildMenu(fw_app *a) {
for (int i = 0; i < 10; ++i) AppendMenuW(orient, MF_STRING, FW_MENU_FRONT + i, names[i]);
AppendMenuW(view, MF_POPUP, (UINT_PTR)orient, L"&Orientation");
AppendMenuW(view, MF_STRING, FW_MENU_FIT, L"Zoom to &Fit\tF");
AppendMenuW(view, MF_STRING, FW_MENU_ZOOM_SELECTION, L"Zoom to Selection");
AppendMenuW(view, MF_STRING, FW_MENU_PREVIOUS, L"&Previous View");
AppendMenuW(view, MF_SEPARATOR, 0, nullptr);
AppendMenuW(display, MF_STRING, FW_MENU_SHADED_EDGES, L"Shaded With &Edges");
Expand Down
4 changes: 3 additions & 1 deletion Sources/CForgeWin/gtk/gtk_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ static GMenuModel *appMenu(void) {
g_menu_append_submenu(view, "Display Style", d);
g_menu_append_submenu(view, "Show", sh);
item(view, "Zoom to Fit", FW_MENU_FIT);
item(view, "Zoom to Selection", FW_MENU_ZOOM_SELECTION);
item(view, "Previous View", FW_MENU_PREVIOUS);
item(view, "Perspective", FW_MENU_PERSPECTIVE);
item(help, "About Forge", FW_MENU_ABOUT);
Expand All @@ -303,7 +304,7 @@ static void buildActions(fw_app *a) {
addAction(a, FW_MENU_IMPORT_STEP, 0);
addAction(a, FW_MENU_UNDO, 0);
addAction(a, FW_MENU_REDO, 0);
for (int id = FW_MENU_FRONT; id <= FW_MENU_PREVIOUS; ++id) addAction(a, id, 0);
for (int id = FW_MENU_FRONT; id <= FW_MENU_ZOOM_SELECTION; ++id) addAction(a, id, 0);
for (int id = FW_MENU_PERSPECTIVE; id <= FW_MENU_DIMENSIONS; ++id) addAction(a, id, 1);
for (int id = FW_MENU_SHADED_EDGES; id <= FW_MENU_HIDDEN_LINES; ++id) addAction(a, id, 1);
addAction(a, FW_MENU_ABOUT, 0);
Expand Down Expand Up @@ -1182,6 +1183,7 @@ static GtkWidget *buildHeadsUp(fw_app *a) {
gtk_widget_set_valign(bar, GTK_ALIGN_START);
gtk_widget_set_margin_top(bar, 12);
gtk_box_append(GTK_BOX(bar), actionButton(a, "zoomFit", "Zoom to Fit (F)", FW_MENU_FIT));
gtk_box_append(GTK_BOX(bar), actionButton(a, "zoomFit", "Zoom to Selection", FW_MENU_ZOOM_SELECTION));
gtk_box_append(GTK_BOX(bar), actionButton(a, "prevView", "Previous View", FW_MENU_PREVIOUS));
GtkWidget *sep = hbox(0);
gtk_widget_add_css_class(sep, "forge-sep");
Expand Down
2 changes: 1 addition & 1 deletion Sources/CForgeWin/include/CForgeWin.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ enum {
FW_MENU_NEW = 100, FW_MENU_OPEN, FW_MENU_SAVE, FW_MENU_SAVE_AS, FW_MENU_EXPORT_STEP, FW_MENU_EXPORT_STL, FW_MENU_EXIT, FW_MENU_IMPORT_STEP,
FW_MENU_UNDO = 200, FW_MENU_REDO,
FW_MENU_FRONT = 300, FW_MENU_BACK, FW_MENU_LEFT, FW_MENU_RIGHT, FW_MENU_TOP, FW_MENU_BOTTOM, FW_MENU_ISOMETRIC,
FW_MENU_DIMETRIC, FW_MENU_TRIMETRIC, FW_MENU_NORMAL_TO, FW_MENU_FIT, FW_MENU_PREVIOUS,
FW_MENU_DIMETRIC, FW_MENU_TRIMETRIC, FW_MENU_NORMAL_TO, FW_MENU_FIT, FW_MENU_PREVIOUS, FW_MENU_ZOOM_SELECTION,
FW_MENU_PERSPECTIVE = 320, FW_MENU_PLANES, FW_MENU_RELATIONS, FW_MENU_DIMENSIONS,
FW_MENU_SHADED_EDGES = 330, FW_MENU_SHADED, FW_MENU_WIREFRAME, FW_MENU_HIDDEN_LINES,
FW_MENU_ABOUT = 400
Expand Down
1 change: 1 addition & 0 deletions Sources/ForgeApp/FeatureTree.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ struct FeatureTreeView: View {
Button(model.hiddenBodyIDs.contains(b.id) ? "Show Body" : "Hide Body") { Task { await model.setBodiesVisible([b.id], model.hiddenBodyIDs.contains(b.id)) } }
Button("Isolate Body") { Task { await model.isolateBodies([b.id]) } }
Button("Rename…") { Task { await model.renameBody(b.id) } }
Button("Zoom to Selection") { Task { await model.select(b.id, extend: false); await model.zoomToSelection() } }
Button("Mass Properties") {
Task {
await model.select(b.id, extend: false)
Expand Down
1 change: 1 addition & 0 deletions Sources/ForgeApp/ForgeApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ struct ForgeApp: App {
Button("Select Other (Tab)") { Task { await model.selectOther() } }.disabled(!model.canSelectOther)
Divider()
Button("Zoom to Fit (F)") { model.zoomToFit() }
Button("Zoom to Selection") { Task { await model.zoomToSelection() } }.disabled(model.selection.isEmpty)
Button("Previous View") { model.previousView() }
Divider()
Button("Hide Selected Bodies") { Task { await model.setBodiesVisible(model.selectedBodies, false) } }.disabled(model.selectedBodies.isEmpty)
Expand Down
2 changes: 2 additions & 0 deletions Sources/ForgeApp/ViewportOverlays.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct HeadsUpToolbar: View {
var body: some View {
HStack(spacing: 1) {
HUDButton(icon: .zoomFit, help: "Zoom to fit (F)") { model.zoomToFit() }
HUDButton(icon: .zoomFit, help: "Zoom to selection") { Task { await model.zoomToSelection() } }
HUDButton(icon: .prevView, help: "Previous view") { model.previousView() }
HUDDivider()
Menu {
Expand Down Expand Up @@ -438,6 +439,7 @@ struct ContextToolbar: View {
item(.massProps, "Mass Properties") { model.begin(.massProperties) }
}
if model.isIsolatingBodies { item(.part, "Exit Isolation") { Task { await model.exitBodyIsolation() } } }
item(.zoomFit, "Zoom to Selection") { Task { await model.zoomToSelection() } }
item(.zoomFit, "Zoom to Fit") { model.zoomToFit() }
}
}
Expand Down
20 changes: 19 additions & 1 deletion Sources/ForgeApp/ViewportView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ struct ViewportView: NSViewRepresentable {
view.delegate = renderer
}
view.layer?.isOpaque = false
view.onCameraInput = { model.viewportCameraInput() }
view.onCamera = { camera, width, height in
let p = ViewProjection(camera: camera, width: width, height: height)
if model.projection != p { model.projection = p }
Expand Down Expand Up @@ -82,9 +83,11 @@ struct ViewportView: NSViewRepresentable {
view.sketchPlane = model.viewportSketchPlane
if context.coordinator.appliedCommands < commands.count {
for c in commands[context.coordinator.appliedCommands...] {
guard model.acceptsViewportCommand(c) else { continue }
switch c {
case .orient(let o): view.orient(o)
case .fit: view.fit()
case .fitSelection(let bounds, _): view.fitSelection(bounds)
case .previous: view.previousView()
case .style(let st):
view.renderer?.style = st
Expand Down Expand Up @@ -122,6 +125,8 @@ final class ForgeMTKView: MTKView {
/// A sketch tool press in progress (for click-drag drawing).
private var toolPress: NSPoint?
var onCancel: (() -> Void)?
/// Synchronous intent notification before direct native camera mutations.
var onCameraInput: (() -> Void)?
/// Called (asynchronously) whenever the camera or the view size changes.
var onCamera: ((Camera, Double, Double) -> Void)?
private var history: [Camera] = []
Expand All @@ -139,6 +144,13 @@ final class ForgeMTKView: MTKView {
cameraChanged()
}

func fitSelection(_ box: BoundingBox) {
guard let r = renderer else { return }
remember()
r.camera.fitSelection(box, aspect: Double(max(bounds.width, 1) / max(bounds.height, 1)))
cameraChanged()
}

func orient(_ o: ViewOrientation) {
remember()
renderer?.camera.setOrientation(o)
Expand Down Expand Up @@ -261,10 +273,11 @@ final class ForgeMTKView: MTKView {
/// SolidWorks middle button: drag rotates, Ctrl+drag pans, Shift+drag zooms; a double
/// click zooms to fit. Works while a sketch tool is active.
override func otherMouseDown(with event: NSEvent) {
if event.clickCount == 2 { fit() }
if event.clickCount == 2 { onCameraInput?(); fit() }
}

override func otherMouseDragged(with event: NSEvent) {
onCameraInput?()
if event.modifierFlags.contains(.control) {
pan(event)
} else if event.modifierFlags.contains(.shift) {
Expand All @@ -283,6 +296,7 @@ final class ForgeMTKView: MTKView {
return
}
dragged = true
onCameraInput?()
if event.modifierFlags.contains(.option) {
pan(event)
} else {
Expand Down Expand Up @@ -324,6 +338,7 @@ final class ForgeMTKView: MTKView {
}

override func rightMouseDragged(with event: NSEvent) {
onCameraInput?()
pan(event)
cameraChanged()
}
Expand All @@ -334,6 +349,7 @@ final class ForgeMTKView: MTKView {

override func scrollWheel(with event: NSEvent) {
guard let r = renderer else { return }
onCameraInput?()
if event.hasPreciseScrollingDeltas && event.phase != [] {
// Trackpad two-finger scroll: pan.
r.camera.pan(dxPixels: -Double(event.scrollingDeltaX), dyPixels: -Double(event.scrollingDeltaY), viewportHeight: Double(bounds.height))
Expand All @@ -346,12 +362,14 @@ final class ForgeMTKView: MTKView {
}

override func magnify(with event: NSEvent) {
onCameraInput?()
renderer?.camera.zoom(factor: 1 + Double(event.magnification), anchor: anchor(for: event))
cameraChanged()
}

override func rotate(with event: NSEvent) {
guard let r = renderer else { return }
onCameraInput?()
let q = Quat(axis: r.camera.back, angle: Double(event.rotation) * .pi / 180)
r.camera.orientation = (q * r.camera.orientation).normalized
cameraChanged()
Expand Down
Loading
Loading