Skip to content

Instantly share code, notes, and snippets.

@ednisley
Created March 28, 2020 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ednisley/502f10566ffaf05b3ead2e2c3e6c99e7 to your computer and use it in GitHub Desktop.
Save ednisley/502f10566ffaf05b3ead2e2c3e6c99e7 to your computer and use it in GitHub Desktop.
OpenSCAD source code: Convert SVG mask outlines to printable cutting templates
// Fu Mask cutting templates
// Ed Nisley - KE4ZNU - 2020-03
// Mask patterns from:
// https://freesewing.org/blog/facemask-frenzy/
// More info on my blog:
// https://softsolder.com/2020/03/29/fu-mask-cutting-templates/
/* [Mask Size] */
Name = "Small"; // [Small, Medium, Large, Test]
/* [Hidden] */
Templates = [ // center ID letter and file name
["S","Small"],
["M","Medium"],
["L","Large"],
["T","Test"], // for whatever you like
];
T_ID = 0; // Template indexes
T_NAME = 1;
BarThick = 4.0; // template thickness
HubOD = 20.0; // center button diameter
// These should match slicer values
ThreadThick = 0.25;
ThreadWidth = 0.40;
Protrusion = 0.1; // make clean holes
//--- Build it
t = Templates[search([Name],Templates,1,1)[0]]; // find template index
Dir = "./";
FnOuter = str(Dir,"Fu Facemask - ",t[T_NAME]," - seam allowance.svg");
FnInner = str(Dir,"Fu Facemask - ",t[T_NAME]," - nominal.svg");
difference() {
linear_extrude(BarThick,convexity=5) {
intersection() {
import(FnOuter,center=true);
union() {
square([200.0,5.0],center=true); // horizontal bar
square([5.0,200.0],center=true); // vertical bar
}
}
circle(d=HubOD); // central button
difference() { // cutting template!
import(FnOuter,center=true);
import(FnInner,center=true);
}
}
translate([0,0,BarThick - ThreadThick]) // top ID recess
cylinder(d=HubOD - 6*ThreadWidth,h=ThreadThick + Protrusion);
translate([0,0,-Protrusion]) // bottom ID recess
cylinder(d=HubOD - 6*ThreadWidth,h=ThreadThick + Protrusion);
}
translate([0,0,2*BarThick/3]) // top ID
linear_extrude(height=BarThick/3,convexity=2)
text(text=t[T_ID],size=10,
font="Arial:style:Bold",halign="center",valign="center");
mirror([1,0,0]) // bottom ID
linear_extrude(height=BarThick/3,convexity=2)
text(text=t[T_ID],size=10,
font="Arial:style:Bold",halign="center",valign="center");
@ednisley
Copy link
Author

More details on my blog at https://wp.me/poZKh-8UD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment