Add hex holder designer page (/holder)

Server-side OpenSCAD renders STL from bundled hex_cell.scad with parameter
overrides via -D. Frontend is a Three.js viewer with auto-form generated
from /api/holder/params. 'Design busbars →' button posts the computed
cell coordinates to /api/projects and redirects to the busbar editor with
the holder cells pre-loaded.

  - holder.py:                openscad subprocess wrapper + compute_cells()
                              (Python mirror of get_hex_center_points_*)
  - scad/hex_cell.scad:       verbatim copy of Addy/Hex-Cell-Holder source
  - app.py:                   /holder route + /api/holder/{params,render,cells}
  - static/holder.html etc:   parameter form + Three.js STL viewer
  - Dockerfile / install.sh:  apt install openscad
  - static/index.html:        nav link Holder ↔ Busbars in topbar
This commit is contained in:
wenil
2026-05-24 19:27:50 +03:00
parent d8cb0dc06d
commit 6bc922cabf
13 changed files with 2371 additions and 9 deletions
+67
View File
@@ -0,0 +1,67 @@
<!doctype html>
<html lang="ru">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Hex Holder Designer</title>
<link rel="stylesheet" href="styles.css" />
<link rel="stylesheet" href="holder.css" />
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/three@0.165.0/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/three@0.165.0/examples/jsm/"
}
}
</script>
</head>
<body>
<header class="topbar">
<h1>Hex Holder Designer</h1>
<nav class="topbar-nav">
<a href="/holder" class="active">Holder</a>
<a href="/">Busbars</a>
</nav>
<span id="status" class="topbar-status">— cells</span>
<div class="actions">
<button id="btn-download-stl" class="primary" title="Download STL of the current configuration">Download STL</button>
<button id="btn-download-scad" title="Download the OpenSCAD source with current parameters baked in">Download .scad</button>
<span class="sep"></span>
<button id="btn-to-busbar" class="primary" title="Open Busbar Designer with these cell coordinates pre-loaded">Design busbars →</button>
</div>
</header>
<main>
<aside class="left holder-left">
<section class="panel">
<h2>Parameters</h2>
<div id="param-form" class="param-form">
<div class="hint">Loading parameter schema…</div>
</div>
</section>
<section class="panel">
<h2>Status</h2>
<p class="hint" id="render-status">idle</p>
<p class="hint" id="render-time"></p>
<p class="hint" id="warning"></p>
</section>
</aside>
<section class="right">
<div id="viewer3d" class="viewer3d"></div>
<div class="viewport-overlay">
<div id="hint-controls">left-drag: rotate · right-drag: pan · wheel: zoom</div>
</div>
</section>
</main>
<script src="js/api.js"></script>
<script type="module" src="js/holder-viewer.js"></script>
<script type="module" src="js/holder-app.js"></script>
</body>
</html>