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
This commit is contained in:
@@ -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)
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user