102cfcee64
Wraps torwanbukaj/ikea-brio-others-compatible-train-tracks-generator ( https://github.com/torwanbukaj/... ) as a third generator alongside holder and the universal scad playground. Approach -------- The upstream .scad ships as "library + one active example call". Used include<> (rather than use<>) so the library's top-level globals (track_width, plug/nest dimensions, $fn = 150, etc.) are available to the modules — `use<>` does NOT propagate variables. Commented out the upstream `track_tester();` call so include<> doesn't also emit the tester geometry every time. Per-render the backend builds a tiny wrapper SCAD on the fly: include <scad/train_tracks.scad> track(length=100, end1="plug", end2="nest", cutout=true, ...); and hands it to holder.render_source(). Part types exposed (9) ---------------------- - tester Calibration block (15-60mm) - track Straight (length + chamfers + grooves + plug/nest ends) - arc Curved (radius + angle, IKEA/Brio/J'adore radii in help text) - dogbone Nest-nest connector - intersection Crossing (angle + 2 lengths + 4 ends) - switch Turnout (left/right radius+angle, straight branch, common end) - snake S-curve (raised default target_length to 200 — the upstream modules's natural curvy-span at angle=45/radius=86 is ~150 and the assert fires below that) - adapter BRIO <-> IKEA system adapter (plug + nest side) - bridge Multi-part (overview/ground/slope/pillar — value_map translates the UI labels to the int 0..3 the SCAD wants) Files ----- - scad/train_tracks.scad Downloaded upstream (57 999 bytes), only modification is the // before the top-level track_tester() call. - tracks.py PART_SCHEMAS dict, build_wrapper_scad, render() that delegates to render_source. - app.py GET /api/tracks/params, POST /api/tracks/render, GET /tracks page route. - static/tracks.html Page with part selector + dynamic param form + shared viewer markup. Reuses holder.css. - static/js/tracks-app.js Controller. Switching the part select redraws the form (each part has its own schema). Ctrl+Enter renders, Cancel uses AbortController. Nav --- Tracks link added to topbar on holder / index / scad. Smoke test ---------- All 9 parts render with default params on the Manifold backend in under 0.5s each (output sizes 440 KB - 1.8 MB).
221 lines
4.4 KiB
CSS
221 lines
4.4 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;
|
|
cursor: pointer;
|
|
user-select: none;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
}
|
|
.param-group-title::before {
|
|
content: "\25BC"; /* ▼ */
|
|
display: inline-block;
|
|
font-size: 8px;
|
|
transition: transform 0.12s ease;
|
|
}
|
|
.param-group.collapsed .param-group-title::before {
|
|
transform: rotate(-90deg); /* ▶ */
|
|
}
|
|
.param-group.collapsed .param-group-body {
|
|
display: none;
|
|
}
|
|
.param-group-body {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 4px;
|
|
}
|
|
|
|
.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; }
|
|
|
|
/* Tracks page: part-type selector (single big dropdown) */
|
|
.part-select {
|
|
width: 100%;
|
|
font-size: 13px;
|
|
padding: 5px 8px;
|
|
}
|
|
|
|
/* SCAD editor — slides up from the bottom of the viewport */
|
|
.scad-toggle {
|
|
position: absolute;
|
|
bottom: 8px;
|
|
right: 8px;
|
|
font-size: 12px;
|
|
padding: 4px 10px;
|
|
z-index: 3;
|
|
}
|
|
.scad-panel {
|
|
position: absolute;
|
|
left: 0; right: 0; bottom: 0;
|
|
height: 30%;
|
|
min-height: 180px;
|
|
background: var(--bg, #11141a);
|
|
border-top: 1px solid var(--border, #2a2f3a);
|
|
display: flex;
|
|
flex-direction: column;
|
|
z-index: 2;
|
|
overflow: hidden;
|
|
}
|
|
/* The [hidden] attribute alone is overridden by display:flex above —
|
|
* make the hide explicit so the Close button actually closes the panel. */
|
|
.scad-panel[hidden] {
|
|
display: none;
|
|
}
|
|
.scad-panel-bar {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
padding: 6px 10px;
|
|
border-bottom: 1px solid var(--border, #2a2f3a);
|
|
font-size: 12px;
|
|
}
|
|
.scad-panel-title { flex: 1; color: var(--muted); }
|
|
.scad-dirty { color: var(--accent, #4a9eff); font-weight: 600; }
|
|
#scad-editor {
|
|
flex: 1;
|
|
overflow: hidden;
|
|
font-size: 12px;
|
|
}
|
|
#scad-editor .CodeMirror {
|
|
height: 100%;
|
|
font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
|
|
}
|