pcb-to-stencil/static/index.html

155 lines
7.5 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PCB Tools by kennycoder + pszsh</title>
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<div class="container">
<h1>PCB Tools by kennycoder + pszsh</h1>
<div class="tabs">
<button class="tab active" data-tab="stencil">Stencil</button>
<button class="tab" data-tab="enclosure">Enclosure</button>
</div>
<!-- Tab 1: Stencil -->
<div class="tab-content active" id="tab-stencil">
<form action="/upload" method="post" enctype="multipart/form-data">
<div class="form-group tooltip-wrap">
<label for="gerber">Solder Paste Gerber File (Required)</label>
<input type="file" id="gerber" name="gerber" accept=".gbr,.gtp,.gbp" required>
<div class="tooltip">Layers to export for Gerbers
<hr>• F.Paste (front paste stencil)<br>• B.Paste (back paste stencil)
</div>
</div>
<div class="form-group tooltip-wrap">
<label for="outline">Board Outline Gerber (Optional)</label>
<input type="file" id="outline" name="outline" accept=".gbr,.gko,.gm1">
<div class="hint">Upload this to automatically crop and generate walls.</div>
<div class="tooltip">Layers to export for Gerbers
<hr>• Edge.Cuts (board outline)
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="height">Stencil Height (mm)</label>
<input type="number" id="height" name="height" value="0.16" step="0.01">
</div>
<div class="form-group">
<label for="dpi">DPI</label>
<input type="number" id="dpi" name="dpi" value="1000" step="100">
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="wallHeight">Wall Height (mm)</label>
<input type="number" id="wallHeight" name="wallHeight" value="2.0" step="0.1">
</div>
<div class="form-group">
<label for="wallThickness">Wall Thickness (mm)</label>
<input type="number" id="wallThickness" name="wallThickness" value="1.0" step="0.1">
</div>
</div>
<button type="submit" class="submit-btn">Convert to STL</button>
</form>
</div>
<!-- Tab 2: Enclosure -->
<div class="tab-content" id="tab-enclosure">
<form action="/upload-enclosure" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="enc-gbrjob">Gerber Job File (Required) <span class="help-btn"
onclick="document.getElementById('help-gbrjob').classList.toggle('visible')">(?)</span></label>
<input type="file" id="enc-gbrjob" name="gbrjob" accept=".gbrjob" required>
<div class="hint">Auto-detects board layers, dimensions, and PCB thickness.</div>
<div class="help-popup" id="help-gbrjob">
<div class="help-popup-close"
onclick="document.getElementById('help-gbrjob').classList.remove('visible')"></div>
<img src="/static/screenshot_gerber_output_dialogue.png" alt="KiCad plot settings">
</div>
</div>
<div class="form-group">
<label for="enc-gerbers">Gerber Files (Required)</label>
<input type="file" id="enc-gerbers" name="gerbers" accept=".gbr,.gko,.gm1" multiple required>
<div class="hint">Select all exported .gbr files from the same folder.</div>
</div>
<div class="form-group tooltip-wrap">
<label for="enc-drill">PTH Drill File (Optional)</label>
<input type="file" id="enc-drill" name="drill" accept=".drl,.xln,.txt">
<div class="hint">Component through-holes (vias auto-filtered).</div>
<div class="tooltip">Use the <b>PTH</b> file from KiCad's drill export.</div>
</div>
<div class="form-group tooltip-wrap">
<label for="enc-npth">NPTH Drill File (Optional)</label>
<input type="file" id="enc-npth" name="npth" accept=".drl,.xln,.txt">
<div class="hint">Mounting holes — become alignment pegs.</div>
<div class="tooltip">Use the <b>NPTH</b> file — these become alignment pegs.</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="enc-wallThickness">Wall Thickness (mm)</label>
<input type="number" id="enc-wallThickness" name="wallThickness" value="1.5" step="0.1">
</div>
<div class="form-group">
<label for="enc-wallHeight">Wall Height (mm)</label>
<input type="number" id="enc-wallHeight" name="wallHeight" value="10.0" step="0.5">
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="enc-clearance">Clearance (mm)</label>
<input type="number" id="enc-clearance" name="clearance" value="0.3" step="0.05">
<div class="hint">Gap between PCB edge and enclosure wall.</div>
</div>
<div class="form-group">
<label for="enc-dpi">DPI</label>
<input type="number" id="enc-dpi" name="dpi" value="600" step="100">
<div class="hint">Lower = smaller file. 600 recommended.</div>
</div>
</div>
<button type="submit" class="submit-btn">Generate Enclosure</button>
</form>
</div>
<div id="loading">
<div class="spinner"></div>
<div>Processing... This may take 10-20 seconds.</div>
</div>
</div>
<script>
// Tab switching
document.querySelectorAll('.tab').forEach(function (tab) {
tab.addEventListener('click', function () {
document.querySelectorAll('.tab').forEach(function (t) { t.classList.remove('active'); });
document.querySelectorAll('.tab-content').forEach(function (tc) { tc.classList.remove('active'); });
tab.classList.add('active');
document.getElementById('tab-' + tab.dataset.tab).classList.add('active');
});
});
// Loading spinner on submit
document.querySelectorAll('form').forEach(function (form) {
form.addEventListener('submit', function () {
document.getElementById('loading').style.display = 'block';
var btn = form.querySelector('.submit-btn');
btn.disabled = true;
btn.innerText = 'Processing...';
});
});
</script>
</body>
</html>