Skip to content

Pivot from Onshape to FreeCAD addon#2

Merged
tophcodes merged 24 commits into
mainfrom
freecad-pivot
May 31, 2026
Merged

Pivot from Onshape to FreeCAD addon#2
tophcodes merged 24 commits into
mainfrom
freecad-pivot

Conversation

@tophcodes
Copy link
Copy Markdown
Owner

@tophcodes tophcodes commented May 26, 2026

Pivots Space Elevator away from the Tauri+Vue GUI / Onshape browser extension toward a FreeCAD-native Python workbench backed by an optional Rust daemon for the SpaceMouse Enterprise LCD. Spec: docs/superpowers/specs/2026-05-26-freecad-first-pivot-design.md. Plan: docs/superpowers/plans/2026-05-26-freecad-first-pivot.md.

22 commits across three deliverables:

  • Cleanup — drops the space-elevator/ Vue+Tauri subdir, establishes a Cargo workspace, slims devenv.nix (no more webkit/bun, adds Python+pytest), rewrites the top-level README.
  • space-elevatord (new Rust binary crate) — tokio-based Unix socket server at $XDG_RUNTIME_DIR/space-elevator.sock, newline-delimited JSON IPC, dispatches ping / lcd_clear / lcd_display_image / lcd_display_svg. Reuses spnav::lcd for hardware. 5 unit tests.
  • freecad-addon (new Python workbench) — ctypes bindings for libspnav, QSocketNotifier-driven event pump, camera navigation via Coin3D, button-to-command bindings stored in App.ParamGet, optional LCD label push to the daemon, Preferences page and a button-bindings dialog. 14 unit tests.

Motion path (libspnav -> ctypes -> QSocketNotifier -> camera) and LCD path (addon -> Unix socket -> daemon -> HID) are fully independent; either can fail without affecting the other. Daemon absence degrades silently.

Note for the future: spec's IPC surface (set_buttons/set_status) doesn't match the as-built protocol (lcd_display_svg); the plan documents this scope cut. Spec to be updated post-merge.

Manual verification

Subagent implementation can't drive hardware or FreeCAD's UI, so the following hasn't been exercised yet and gates the merge:

  • cargo run -p space-elevatord starts cleanly
  • ping round-trip via nc -U returns {"ok":true} (actual reply is the superset {"v":1,"id":N,"ok":true}; request must be {"v":1,"id":N,"cmd":"ping"})
  • lcd_display_image with a 640x150 PNG renders on the SpaceMouse Enterprise LCD (will be garbled until spnav/src/lcd.rs packet header TODOs are resolved — pre-existing)
  • lcd_display_svg with a small SVG renders
  • Symlink freecad-addon/ into ~/.local/share/FreeCAD/Mod/SpaceElevator and launch FreeCAD
  • "Space Elevator" appears in the workbench dropdown
  • Activating logs Space Elevator: event pump started
  • SpaceMouse motion pans/rotates the active 3D view
  • Bind button_0 to Std_New via the Python console, press button 0 — new document opens
  • Space Elevator -> Button bindings... menu opens the dialog; saving persists
  • Edit -> Preferences -> Space Elevator shows axis-scale and LCD settings; changes persist
  • With daemon running and one binding set, switching to the workbench renders labels on the LCD
  • With daemon stopped, workbench activation still works; no popup, no Report View error

Follow-ups (file as issues post-merge)

  • libspnav singleton isn't idempotent across deactivate/activate. Second activation will fail silently because spnav_open() on an open connection returns -1. Track _opened state on _Lib. See freecad-addon/space_elevator/libspnav.py:93 and event_pump.py:27.
  • Spec's IPC surface vs. as-built — update spec or move SVG rendering into the daemon.
  • LCD labels only push on activation, not on bindings save. Call _push_labels from BindingsDialog._save or document the contract.
  • _short_name strips the namespace blindly; cross-workbench command collisions produce identical labels.
  • LcdClient not thread-safe — fine on the Qt main thread, but should be documented or guarded.
  • Pre-existing: spnav/src/lcd.rs packet header TODOs — daemon LCD output won't be reliable until resolved. Out of scope for this PR.

Closes #1.

tophcodes and others added 24 commits May 26, 2026 17:39
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tophcodes tophcodes merged commit 382611a into main May 31, 2026
1 check passed
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.

Verify FreeCAD-first pivot on hardware

1 participant