2022-08-29 16:46:59 -06:00
|
|
|
// Diameter of the coin (mm)
|
2022-08-30 11:10:44 -06:00
|
|
|
diameter = 39;
|
2022-08-29 16:46:59 -06:00
|
|
|
|
|
|
|
// Height of the coin (mm)
|
2022-08-30 11:10:44 -06:00
|
|
|
height = 3.5;
|
2022-08-29 16:46:59 -06:00
|
|
|
|
|
|
|
// Engraving depth (mm)
|
|
|
|
depth = 0.5;
|
|
|
|
|
|
|
|
// Number of sides on your coin
|
2022-08-30 11:10:44 -06:00
|
|
|
sides = 360; // [3:360]
|
2022-08-29 16:46:59 -06:00
|
|
|
|
2022-08-30 10:14:50 -06:00
|
|
|
// How many holes (spokes) do you want?
|
2022-08-30 11:10:44 -06:00
|
|
|
holes = 6; // [0:12]
|
2022-08-30 10:14:50 -06:00
|
|
|
|
2022-08-29 16:46:59 -06:00
|
|
|
// Text to display
|
2022-08-30 10:14:50 -06:00
|
|
|
text = "100";
|
|
|
|
|
|
|
|
// The font must be installed locally on your system
|
|
|
|
font = "Droid Sans:style=Bold";
|
2022-08-29 16:46:59 -06:00
|
|
|
|
|
|
|
fontScale = (
|
|
|
|
sides == 3 ? 0.50
|
|
|
|
: sides == 4 ? 0.80
|
|
|
|
: sides == 5 ? 0.80
|
|
|
|
: sides == 6 ? 0.90
|
|
|
|
: 1.00
|
|
|
|
);
|
|
|
|
|
|
|
|
// Enough width to fit four digits
|
|
|
|
fontSize = diameter * 0.21 * fontScale;
|
|
|
|
|
|
|
|
// Rotate odd-numbers of sides to maximize width
|
|
|
|
rotation = (sides%2)?90:0;
|
|
|
|
|
|
|
|
module chip() {
|
|
|
|
intersection() {
|
|
|
|
cylinder(h=height, d=diameter, center=true, $fn=sides);
|
|
|
|
union() {
|
|
|
|
difference() {
|
|
|
|
cube([diameter, diameter, height], center=true);
|
|
|
|
difference() {
|
2022-08-30 10:14:50 -06:00
|
|
|
cylinder(h=height, d=diameter*0.8, center=true, $fn=sides);
|
|
|
|
cylinder(h=height, d=diameter*0.7, center=true, $fn=sides);
|
2022-08-29 16:46:59 -06:00
|
|
|
}
|
|
|
|
}
|
2022-08-30 10:14:50 -06:00
|
|
|
|
|
|
|
if (holes == 0) {
|
|
|
|
cube([diameter, diameter, height*0.7], center=true);
|
|
|
|
} else {
|
|
|
|
spokeWidth = (diameter/holes) * 0.8;
|
|
|
|
rotate((sides+holes)%2?90:0) {
|
|
|
|
for (i = [0 : 360/holes : 360]) {
|
|
|
|
rotate(i) translate([diameter/2, 0, 0]) cube([diameter, spokeWidth, height*0.7], center=true);
|
|
|
|
}
|
|
|
|
}
|
2022-08-29 16:46:59 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
difference() {
|
|
|
|
rotate(rotation) chip();
|
|
|
|
translate([0, 0, height/2-depth])
|
|
|
|
linear_extrude(height=depth+0.1, convexity = 10, twist = 0)
|
2022-08-30 10:14:50 -06:00
|
|
|
text(text=text, font=font, size=fontSize, halign="center", valign="center");
|
2022-08-29 16:46:59 -06:00
|
|
|
}
|