3D-Projects/Damper/Damper.scad

81 lines
2.2 KiB
OpenSCAD
Raw Normal View History

2025-09-23 20:48:12 +02:00
// the height of the damper
HEIGHT = 40;
// the width of the walls between the pockets
// thinner walls make a softer damper
THICKNESS = 1;
// the width of the pocket, relative to the thickness
// bigger ratio make a softer damper
POCKET_WIDTH_RATIO = 5;
// amount of pockets in the outer wall
POCKETS = 7;
// amount of double-pockets inside the damper
INNER_LAYERS = 2;
// calculate some internals
LENGTH = POCKETS * (POCKET_WIDTH_RATIO + THICKNESS);
module wall(thickness, y_offsett) {
translate([0, y_offsett, 0]) {
cube(size=[LENGTH, thickness, HEIGHT]);
}
}
module bridges_1(thickness, y_offsett) {
translate([0, y_offsett, 0]) {
for (p = [0:1:POCKETS-1]) {
x1 = p * (POCKET_WIDTH_RATIO * THICKNESS + THICKNESS);
translate([x1, 0, 0]) cube(size=[THICKNESS/2, thickness, HEIGHT]);
x2 = (p+1) * (POCKET_WIDTH_RATIO * THICKNESS + THICKNESS) - THICKNESS/2;
translate([x2, 0, 0]) cube(size=[THICKNESS/2, thickness, HEIGHT]);
};
}
}
module bridges_2(thickness, y_offsett) {
translate([0, y_offsett, 0]) {
// first bridge
cube(size=[THICKNESS/2, thickness, HEIGHT]);
for (p = [0:1:POCKETS-1]) {
x = p * (POCKET_WIDTH_RATIO * THICKNESS + THICKNESS) + POCKET_WIDTH_RATIO * THICKNESS / 2;
translate([x, 0, 0]) {
cube(size=[THICKNESS, thickness, HEIGHT]);
}
};
// last bridge
x = LENGTH - THICKNESS/2;
translate([x, 0, 0]) {
cube(size=[THICKNESS/2, thickness, HEIGHT]);
}
}
}
// outer shell
wall(THICKNESS, 0);
bridges_1(THICKNESS/2, 1.0 * THICKNESS);
// inner layers
for (i = [1:1:INNER_LAYERS]) {
y_ofst = (1.5 + (i-1)*4) * THICKNESS;
wall(THICKNESS, y_ofst);
bridges_2(THICKNESS, y_ofst + THICKNESS);
wall(THICKNESS, y_ofst + 2*THICKNESS);
bridges_1(THICKNESS, y_ofst + 3*THICKNESS);
}
y_ofst_las_inner = (1.5 + INNER_LAYERS*4) * THICKNESS;
wall(THICKNESS, y_ofst_las_inner);
bridges_2(THICKNESS, y_ofst_las_inner + THICKNESS);
// outer shell
y_ofst_shell = y_ofst_las_inner + 2*THICKNESS;
wall(THICKNESS, y_ofst_shell);
bridges_1(THICKNESS/2, y_ofst_shell + THICKNESS);
wall(THICKNESS, y_ofst_shell + 1.5*THICKNESS);