2020-07-14 17:36:28 +00:00
|
|
|
/*
|
|
|
|
* title : Spare-Change holder
|
|
|
|
* author : Knut Ahlers
|
2020-07-14 21:28:11 +00:00
|
|
|
* revision : 0.1.1
|
2020-07-14 17:36:28 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
const coinCount = 15
|
|
|
|
const coinDiameters = [
|
|
|
|
24, // 1 EUR
|
2020-07-14 21:28:11 +00:00
|
|
|
27, // 2 EUR
|
2020-07-14 17:36:28 +00:00
|
|
|
]
|
2020-07-14 21:28:11 +00:00
|
|
|
const coinHeight = 2.8 // Use max coin thickness + a little but less than 2 coins
|
2020-07-14 17:36:28 +00:00
|
|
|
const fingerDia = 18 // Measure your finger, should be less than the smallest coin diameter
|
|
|
|
const height = coinCount * coinHeight // Think of something to hold all the coins but not too big
|
2020-07-14 21:28:11 +00:00
|
|
|
const wall = 1.5 // Something you're comfortable with to print and hold your coin
|
2020-07-14 17:36:28 +00:00
|
|
|
|
|
|
|
const blockHeight = () => coinDiameters.sort().reverse()[0] + wall
|
|
|
|
const blockWidth = () => coinDiameters.reduce((sum, v) => sum + v) + (coinDiameters.length + 1) * wall
|
|
|
|
|
|
|
|
const calcMove = (posY, slotDia) => slotDia / 2 + posY
|
|
|
|
|
|
|
|
/* exported main */
|
|
|
|
function main() {
|
|
|
|
// Create a block containing everything
|
|
|
|
let obj = cube({ size: [
|
|
|
|
height,
|
|
|
|
blockWidth(),
|
|
|
|
blockHeight(),
|
|
|
|
], center: true }).translate([0, blockWidth() / 2, 0])
|
|
|
|
|
|
|
|
let posY = wall
|
|
|
|
for (const slotDia of coinDiameters) {
|
|
|
|
// Remove pipes holding the coins
|
|
|
|
obj = difference(obj, cylinder({
|
|
|
|
center: true,
|
|
|
|
h: height,
|
|
|
|
r: slotDia / 2,
|
|
|
|
})
|
|
|
|
.rotateY(90)
|
|
|
|
.translate([
|
|
|
|
wall,
|
|
|
|
calcMove(posY, slotDia),
|
|
|
|
blockHeight() / 2 - slotDia / 2,
|
|
|
|
]))
|
|
|
|
|
|
|
|
// Remove finger access to coins
|
|
|
|
obj = difference(obj, cube({ size: [
|
|
|
|
height,
|
|
|
|
fingerDia,
|
|
|
|
slotDia / 2,
|
|
|
|
], center: true })
|
|
|
|
.translate([
|
|
|
|
0,
|
|
|
|
posY + slotDia / 2,
|
|
|
|
blockHeight() / 2 - slotDia / 4,
|
|
|
|
]))
|
|
|
|
|
|
|
|
// Remove one-coin-slot to pull coins out
|
|
|
|
obj = difference(obj, cube({ size: [
|
|
|
|
coinHeight,
|
|
|
|
slotDia,
|
|
|
|
slotDia / 2,
|
|
|
|
], center: true })
|
|
|
|
.translate([
|
|
|
|
height / -2 + wall + coinHeight / 2,
|
|
|
|
posY + slotDia / 2,
|
|
|
|
blockHeight() / 2 - slotDia / 4,
|
|
|
|
]))
|
|
|
|
|
|
|
|
posY += slotDia + wall
|
|
|
|
}
|
|
|
|
|
|
|
|
return obj
|
|
|
|
}
|
|
|
|
|
|
|
|
// vim: set ft=javascript:
|