Compare commits

...

2 Commits

Author SHA1 Message Date
5421d38397 Add link to git tea source page in corner 2026-04-11 13:19:47 -04:00
1619ec9701 Add text inset for better adhesion
- Increase text thickness to 2.3mm (base 2.0mm + 0.3mm inset compensation)
- Adjust text Z offset to 2.7mm to inset text into background
- Add offset() call for text layers to create interference fit
- Total height remains at 5mm
2026-04-11 13:07:43 -04:00
3 changed files with 30 additions and 7 deletions

View File

@@ -36,6 +36,22 @@ main {
header {
text-align: center;
position: relative;
}
.git-link {
position: absolute;
top: 0;
right: 0;
font-size: 0.75rem;
color: var(--text-muted);
text-decoration: none;
opacity: 0.6;
transition: opacity 0.2s;
}
.git-link:hover {
opacity: 1;
}
header h1 {

View File

@@ -93,6 +93,7 @@ function App() {
<header>
<h1><Md3dRotation className="icon-spin" /> SVG to Nametag Converter</h1>
<p>Powered by WebAssembly & Manifold 3D</p>
<a href="https://warehouse.randomhack.com/unfunny/svg2NameTag-Ren/src/branch/web-app/" target="_blank" rel="noopener noreferrer" className="git-link">View Source</a>
</header>
<main>

View File

@@ -138,14 +138,20 @@ export const convertFile = async (file, manifold, addLog) => {
});
// 3. Extrusion Helper using Manifold
const createMeshBlob = (loopsList, height, z) => {
const createMeshBlob = (loopsList, height, z, isText = false) => {
const allContours = loopsList.flat();
if (allContours.length === 0) return null;
// Create CrossSection with Even-Odd rule
// Correct usage: new CrossSection(contours, fillRule)
const cs = new CrossSection(allContours, 'EvenOdd');
let cs = new CrossSection(allContours, 'EvenOdd');
// Inset text for better adhesion (only for text layers)
if (isText) {
const INSET = -0.3; // mm
cs = cs.offset(INSET);
}
// Extrude
const mesh = Manifold.extrude(cs, height, 0, 0, [1, 1]);
@@ -162,13 +168,13 @@ export const convertFile = async (file, manifold, addLog) => {
// Constants
const BG_THICK = 3.0;
const TXT_THICK = 2.0;
const TXT_Z = 3.0; // Starts at 3mm, Center at 4mm
const TXT_THICK = 2.3; // 2.0 + 0.3mm inset compensation
const TXT_Z = 2.7; // Text is inset into background for better adhesion
return {
black: createMeshBlob(paths.black, BG_THICK, 0),
white: createMeshBlob(paths.white, TXT_THICK, TXT_Z),
cyan: createMeshBlob(paths.cyan, TXT_THICK, TXT_Z)
black: createMeshBlob(paths.black, BG_THICK, 0, false),
white: createMeshBlob(paths.white, TXT_THICK, TXT_Z, true),
cyan: createMeshBlob(paths.cyan, TXT_THICK, TXT_Z, true)
};
};