77 lines
1.8 KiB
OpenSCAD
77 lines
1.8 KiB
OpenSCAD
|
|
$fa = 4;
|
|
$fs = 0.2;
|
|
|
|
body_height = 10;
|
|
body_diameter = 24;
|
|
|
|
bevel_height = 1;
|
|
bevel_width = 1;
|
|
|
|
knurl_width = 1.2;
|
|
knurl_depth = 0.8;
|
|
knurl_count = 36;
|
|
knurl_angle = 110*(body_height-2*bevel_height)/body_diameter; // idk where 110 comes from
|
|
|
|
// m5: 5.4, 9.2, 3.4
|
|
// m3: 3.2, 6.2, 3.0
|
|
hole_diameter = 3.2;
|
|
bolt_head_width = 5.6;
|
|
bolt_recess_depth = 3.0;
|
|
|
|
module main() {
|
|
difference() {
|
|
|
|
cylinder(body_height, d1 = body_diameter, d2 = body_diameter, center = true);
|
|
|
|
bevel(1);
|
|
bevel(-1);
|
|
|
|
knurl_cuts(1);
|
|
knurl_cuts(-1);
|
|
|
|
cylinder(body_height, d1 = hole_diameter, d2 = hole_diameter, center = true);
|
|
hex_recess();
|
|
}
|
|
}
|
|
|
|
module bevel(face) { // 1 for top and -1 for bottom
|
|
translate([0, 0, face*(body_height/2 - bevel_height)])
|
|
rotate_extrude() {
|
|
translate([body_diameter/2, 0, 0])
|
|
polygon([[0, 0], [0, bevel_height*face], [-bevel_width, bevel_height*face]]);
|
|
}
|
|
}
|
|
|
|
module knurl_cuts(direction) { // 1 for cw and -1 for ccw
|
|
for(i = [1:1:knurl_count]) {
|
|
linear_extrude(body_height-2*bevel_height, center=true, twist=knurl_angle*direction) {
|
|
knurl_triangle = [[-knurl_width/2, 0], [knurl_width/2, 0], [0, knurl_depth*sqrt(3)/2]];
|
|
|
|
rotate([0, 0, 360/knurl_count * i])
|
|
translate([0, -body_diameter/2 - 0.05, 0])
|
|
polygon(knurl_triangle);
|
|
}
|
|
}
|
|
}
|
|
|
|
module hex_recess() {
|
|
edge_length = bolt_head_width/2;
|
|
x = edge_length * sqrt(3)/2;
|
|
y = edge_length;
|
|
a = [y/2, x];
|
|
b = [y, 0];
|
|
c = [y/2, -x];
|
|
d = [-y/2, -x];
|
|
e = [-y, 0];
|
|
f = [-y/2, x];
|
|
hexagon = [a, b, c, d, e, f];
|
|
|
|
translate([0, 0, -(body_height-bolt_recess_depth)/2])
|
|
linear_extrude(bolt_recess_depth, center=true) {
|
|
polygon(hexagon);
|
|
}
|
|
}
|
|
|
|
main();
|