Files
busbar-designer/static/holder.css
T
wenil dfef1453aa holder: fit-check — translucent max-box + manual enclosure overlay
The hex_cell.scad echoes its computed dimensions (pack_height_holder,
total_*_holder, box_total_*) to stderr. Capture those and surface them
in the viewer so the user can sanity-check whether the assembled
battery will fit in a target case.

Backend:
- holder.py: render_stl() now returns (stl_bytes, dims) where dims is
  a {name: float} dict parsed from openscad ECHO lines.
- app.py: /api/holder/render emits the dims dict as an
  X-Holder-Dimensions response header (JSON) with the matching
  Access-Control-Expose-Headers entry so fetch() can read it under
  any proxy / future CORS setup.

Viewer (holder-viewer.js):
- New setGhostBox(name, {w,d,h}, {visible,color}) and clearGhostBox(name)
  helpers. Each ghost is a Group of a translucent BoxGeometry mesh +
  matching EdgesGeometry wireframe, positioned to match how the STL
  mesh is placed (centred XY, bottom on Z=0).

UI (holder.html / holder.css):
- New "Fit check" panel under Status with two sections:
    • Show max bounding box (auto, from ECHO — defaults to box_total_*
      dims, falls back to total_*_holder + pack_height_holder).
    • Show enclosure (manual W × D × H inputs in mm).
- Verdict line under the enclosure inputs: "✓ fits" green or
  "✗ too small — battery won't fit" red.

Controller (holder-app.js):
- Reads X-Holder-Dimensions after each render, updates the max-box
  ghost in blue, prints the dimensions label.
- Watches enclosure inputs + toggles, drives the enclosure ghost
  (green if it fits, red if smaller than the max box on any axis).
- Fit comparison is orientation-independent in the XY plane (sorted
  W,D pair) but strict on Z (height).
2026-05-25 12:19:31 +03:00

146 lines
2.8 KiB
CSS

/* Holder-designer specific styles; complements styles.css. */
.holder-left { width: 340px; }
.viewer3d {
width: 100%;
height: 100%;
background: #0a0d12;
}
.right { position: relative; }
/* Parameter form */
.param-form {
display: flex;
flex-direction: column;
gap: 14px;
}
.param-group {
border: 1px solid var(--border);
border-radius: 4px;
background: var(--bg);
padding: 8px 10px;
}
.param-group-title {
font-size: 11px;
color: var(--muted);
text-transform: uppercase;
letter-spacing: 0.05em;
margin: 0 0 6px;
font-weight: 600;
}
.param-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
margin-bottom: 6px;
}
.param-row label {
flex: 1;
font-size: 12px;
color: var(--text);
text-transform: none;
letter-spacing: 0;
flex-direction: row;
align-items: center;
}
.param-row input[type=number],
.param-row select {
width: 110px;
flex-shrink: 0;
font-size: 12px;
padding: 3px 6px;
}
.param-row .param-help {
font-size: 10px;
color: var(--muted);
flex-basis: 100%;
margin-top: -2px;
}
/* Render progress (indeterminate bar + elapsed-time counter) */
.render-progress {
display: flex;
align-items: center;
gap: 8px;
margin: 6px 0;
}
.render-progress-bar {
flex: 1;
height: 6px;
border-radius: 3px;
background: var(--border, #2a2f3a);
overflow: hidden;
position: relative;
}
.render-progress-fill {
position: absolute;
inset: 0;
width: 35%;
border-radius: 3px;
background: linear-gradient(90deg, transparent, var(--accent, #4a9eff), transparent);
animation: render-progress-slide 1.2s linear infinite;
}
@keyframes render-progress-slide {
0% { left: -35%; }
100% { left: 100%; }
}
.render-elapsed {
font-size: 11px;
color: var(--muted);
font-variant-numeric: tabular-nums;
min-width: 42px;
text-align: right;
}
/* Dirty indicator on Render button when params changed since last render */
#btn-render.dirty {
box-shadow: 0 0 0 2px var(--accent, #4a9eff) inset;
}
/* Cell-count over the server limit — render is disabled, status flagged */
.topbar-status.over-limit {
color: var(--danger, #d94a4a);
font-weight: 600;
}
/* Fit-check panel */
.fit-toggle {
display: flex;
align-items: center;
gap: 6px;
font-size: 12px;
cursor: pointer;
user-select: none;
}
.fit-toggle input { margin: 0; }
.fit-sep {
border: none;
border-top: 1px solid var(--border, #2a2f3a);
margin: 10px 0 8px;
}
.enc-inputs {
display: flex;
align-items: center;
gap: 4px;
margin: 6px 0;
font-size: 12px;
}
.enc-inputs input {
width: 56px;
padding: 3px 6px;
font-size: 12px;
}
.enc-inputs .unit { color: var(--muted); margin-left: 2px; }
#fit-verdict.fit-ok { color: #4ad97a; font-weight: 600; }
#fit-verdict.fit-bad { color: var(--danger, #d94a4a); font-weight: 600; }