OpenSCAD/snaptron.scad

40 lines
954 B
OpenSCAD
Raw Permalink Normal View History

2024-04-29 21:17:50 +00:00
// polygon quality
$fn=60; //[20:10:200]
// for the ball and the socket
radius=5; //[1:.5:25]
// how deeply the ball snaps into the socket
inset=1.5; //[0:.1:25]
// how long it be
stem_length=1; //[1:.5:100]
// how thick the stem should be
stem_radius=radius * .5; //[.5:.5:24]
// added to the radius of the socket to make wiggle room, if desired
play=0; //[0:.1:1]
// without some padding the socket cuts too closely to the edge of the cylinder it is in
padding=.1; //[0.1:.1:1]
union() {
// socket
difference() {
cylinder(radius + inset + play, radius + padding + play, radius + padding + play);
translate([0, 0, inset]) {
sphere(radius + play);
}
}
// stem
translate([0, 0, radius + inset + play]) {
cylinder(stem_length, stem_radius, stem_radius);
}
// ball
translate([0, 0, radius * 2 - 1 + stem_length + inset]) {
sphere(radius);
}
}