-
Notifications
You must be signed in to change notification settings - Fork 0
/
numeric_stencils.scad
108 lines (102 loc) · 4.76 KB
/
numeric_stencils.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// text_on_cube.scad - Example for text() usage in OpenSCAD
echo(version=version());
include <specs.scad>;
$fn = 32;
module render_stencils(number, border=border) {
// Loop to generate 10 plates
for (i = [0:number]) {
plate_row= i>4 ? plate_height + border : 0;
n= i>4 ? i-5 : i;
// Translate each plate to its position
translate([n * (plate_width + border), plate_row, 0]) {
union() {
if (i == 0 || i == 4 || i == 6 || i == 8 || i == 9) {
translate([0.35, 0, 0]){
difference() {
union() {
// The bridges
if (i == 0 || i == 6 || i == 8) {
translate([plate_width / 2 - bridge_width, font_size / 2, 0]) {
color("hotpink") {
cube([bridge_width*2, font_size/5, plate_thickness]);
}
}
}
if (i == 4 || i == 6 || i == 8 || i == 9) {
translate([plate_width / 2 - bridge_width, font_size/1.45, 0]) {
color("hotpink") {
cube([bridge_width*2, font_size/5, plate_thickness]);
}
}
}
if (i == 0 || i== 8 || i == 9) {
translate([plate_width / 2 - bridge_width, font_size/1.06, 0]) {
color("hotpink") {
cube([bridge_width*2, font_size/8.33, plate_thickness]);
}
}
}
}
rotate([90, 0, 180]) {
translate([-plate_width/2+bridge_width, 0, 0]) {
linear_extrude(height=plate_height) {
polygon([[-bevel_size/2, 0], [0,bevel_size], [0, 0]]);
}
}
}
rotate([90, 90, 180]) {
translate([0, -plate_width/2-bridge_width, 0]) {
linear_extrude(height=plate_height) {
polygon([[-bevel_size, 0], [0,bevel_size/2], [0, 0]]);
}
}
}
}
}
}
// The stencil base with number and slant
difference() {
// Create the plate
color("skyblue", 0.5) {
difference() {
cube([plate_width, plate_height, plate_thickness]);
translate([plate_width / 2, 4.5, -0.1]) {
cylinder(h=mag_depth, d=5.1);
}
translate([plate_width / 2, plate_height-4.5, -0.1]) {
cylinder(h=mag_depth, d=5.1);
}
}
}
color("hotpink") {
// Emboss the number
translate([plate_width/2, plate_height/2, -plate_thickness]) {
linear_extrude(plate_thickness*4) {
text(str(i), font=font, size=font_size, halign="center", valign="center");
}
}
}
rotate([90, 0, 180]) {
translate([0, 0, 0]) {
linear_extrude(height=plate_height) {
polygon([[-bevel_size/2, 0], [0,bevel_size], [0, 0]]);
}
}
}
rotate([90, 180, 180]) {
translate([plate_width, -plate_thickness, 0]) {
linear_extrude(height=plate_height) {
polygon([[-bevel_size/2, 0], [0,bevel_size], [0, 0]]);
}
}
}
}
}
}
}
}
rotate([180,0,0]) {
translate([0, -2*(plate_height) - border, 0]) {
render_stencils(9, border);
}
}