Skip to content

Architettura

lukethehawk edited this page Jul 13, 2026 · 3 revisions

Architecture

Stack

  • Vite for build/dev server.
  • Electron for the desktop app.
  • Three.js for scene, camera, materials and STL.
  • three-bvh-csg for mesh booleans.
  • node --test for unit tests.
  • GitHub Actions + GitHub Pages for web deployment.

Main Files

  • index.html: UI markup.
  • src/style.css: layout and styling.
  • src/main.parts/*.js: main controller source.
  • src/main.js: generated file, do not edit manually.
  • src/geometry.js: mesh operations.
  • src/primitives.js: solids, planes, joint profiles, text and gears.
  • src/snapping.js: grid, point, axis and inference snapping.
  • src/measurement.js: measurement logic.
  • src/hole-detection.js: cylindrical hole detection.
  • test/*.test.js: tests.

Runtime State

  • model: main STL mesh.
  • selected: selected face or connected body.
  • activeTool: current tool.
  • undoStack / redoStack: geometry history.
  • undoHistory / redoHistory: labels for the visible History drawer.
  • snapPoints: structural snap points and face centers.
  • object and pattern drawer state for connected bodies and duplication.
  • temporary tool states for primitives, booleans, lines, joints, text and measurement.

Selection

Face selection uses findCoplanarRegion().

Object selection uses findConnectedComponent() from the clicked triangle, so a separate body inside the same STL can be edited without selecting the whole mesh.

Camera

fitView() uses bounding box, vertical/horizontal FOV and a safety margin to frame the model without excessive zoom.

Geometry Operations

  • cutPlaneGeometry() performs half-space plane cuts and can cap cut surfaces.
  • removeMiddleSectionGeometry() performs Shorten middle cuts by cutting both sides, capping the profiles, translating the positive side and combining the result.
  • hollowGeometry() creates an inner shell and side walls for open boundaries.
  • createJointProfileGeometry() creates arc, dovetail and T-slot profiles with optional in-plane rotation.

Architettura

Stack

  • Vite per build/dev server.
  • Electron per app desktop.
  • Three.js per scena, camera, materiali e STL.
  • three-bvh-csg per booleane mesh.
  • node --test per test unitari.
  • GitHub Actions + GitHub Pages per deploy web.

File principali

  • index.html: markup UI.
  • src/style.css: layout e stile.
  • src/main.parts/*.js: sorgente controller principale.
  • src/main.js: file generato, non modificare a mano.
  • src/geometry.js: operazioni mesh.
  • src/primitives.js: solidi, piani, profili incastro, testo e ingranaggi.
  • src/snapping.js: snap a griglia, punti, assi e inferenze.
  • src/measurement.js: logica misure.
  • src/hole-detection.js: riconoscimento fori cilindrici.
  • test/*.test.js: test.

Stato runtime

  • model: mesh STL principale.
  • selected: faccia o corpo connesso selezionato.
  • activeTool: strumento corrente.
  • undoStack / redoStack: storia geometrie.
  • undoHistory / redoHistory: etichette per il drawer History.
  • snapPoints: punti strutturali e centri faccia.
  • stato drawer oggetti e pattern per corpi connessi e duplicazione.
  • stati temporanei per primitive, booleane, linee, incastri, testo e misura.

Selezione

La selezione faccia usa findCoplanarRegion().

La selezione oggetto usa findConnectedComponent() dal triangolo cliccato, cosi un corpo separato nello stesso STL puo essere modificato senza selezionare tutta la mesh.

Operazioni geometriche

  • cutPlaneGeometry() esegue tagli piano/semispazio e puo chiudere le superfici tagliate.
  • removeMiddleSectionGeometry() gestisce i tagli mediani di Accorcia: taglia i due lati, chiude i profili, trasla il lato positivo e combina il risultato.
  • hollowGeometry() crea guscio interno e pareti laterali sui bordi aperti.
  • createJointProfileGeometry() crea profili arco, coda di rondine e T-slot con rotazione opzionale nel piano.

Clone this wiki locally