3dprint/ball-amort/ball_amort.scad

95 lines
3.1 KiB
OpenSCAD
Raw Normal View History

2015-12-27 22:33:38 +03:00
$fn = 50;
2015-12-30 01:56:09 +03:00
tube_length = 4; // tube length in studs
piston_length = 3; // piston length in studs
travel_length = piston_length-2; // piston travel in studs
2015-12-30 15:19:37 +03:00
top_type = "axle"; // top mounting type: 'pin' = pin hole, 'ball' = ball end hole, 'axle' = axle hole, "axle_rod" = axle, "ball_end" = ball
bottom_type = "ball"; // bottom mounting type
2015-12-30 01:56:09 +03:00
travel = min(travel_length, piston_length-2, tube_length-2);
2015-12-27 22:33:38 +03:00
2015-12-28 01:00:47 +03:00
//difference() { union() {
2015-12-27 22:33:38 +03:00
difference() {
2015-12-30 15:19:37 +03:00
tube_offset = (bottom_type == "axle" || bottom_type == "axle_rod" ? 1 : (bottom_type == "ball_end" ? 0.4 : 0));
union() {
translate([0, 0, 8]) cylinder(r=4, h=tube_length*8-8);
mount_base(type=bottom_type, r=4);
}
mount_hole(bottom_type);
translate([0, 0, 8+tube_offset]) cylinder(r=3.2, h=tube_length*8-tube_offset);
2015-12-30 01:56:09 +03:00
translate([-5, -0.5, tube_length*8-6]) cube(size=[10, 1, 3], center=false);
2015-12-27 22:33:38 +03:00
}
2015-12-30 01:56:09 +03:00
color([1, 0.5, 0.5]) translate([0, 0, (tube_length+piston_length-1)*8]) rotate([180, 0, 0])
2015-12-28 01:00:47 +03:00
{
2015-12-27 22:33:38 +03:00
difference() {
2015-12-30 15:19:37 +03:00
union() {
//translate([0, 0, 4]) cylinder(r=3, h=piston_length*8-4);
//rotate([90, 0, 0]) translate([0, 4, -4]) cylinder(r=4, h=8);
translate([0, 0, 8]) cylinder(r=3, h=piston_length*8-8);
mount_base(top_type);
2015-12-27 22:33:38 +03:00
}
2015-12-30 15:19:37 +03:00
mount_hole(top_type);
2015-12-30 01:56:09 +03:00
translate([-5, -0.7, (piston_length-travel-1)*8+3]) cube(size=[10, 1.4, travel*8+3], center=false);
2015-12-27 22:33:38 +03:00
}
}
2015-12-28 01:00:47 +03:00
//rotate([90, 0, 0])
2015-12-30 01:56:09 +03:00
color([0.5, 0.5, 1]) translate([-4, -0.5, tube_length*8-6])
2015-12-28 01:00:47 +03:00
cube(size=[8, 1, 3], center=false);
2015-12-27 22:33:38 +03:00
2015-12-30 01:56:09 +03:00
//} translate([0, -50, -1]) cube(size=[10, 500, 500]); }
2015-12-27 22:33:38 +03:00
2015-12-30 01:56:09 +03:00
//rotate([10, 0, 0]) axleround(h=8);
2015-12-27 22:33:38 +03:00
2015-12-30 15:19:37 +03:00
module mount_base(type, r = 3) {
if (type == "pin" || type == "ball" || type == "axle") {
cylinder(r=4, h=8+0.1);
}
else if (type == "axle_rod") {
axleround(h=8+0.1);
}
else if (type == "ball_end") {
translate([0, 0, 4]) sphere(r=3);
translate([0, 0, 6]) linear_extrude(scale=r, height=2) circle(r=1);
}
}
module mount_hole(type) {
if (type == "pin") {
rotate([90, 0, 0]) translate([0, 4, -4]) pin_hole();
}
else if (type == "ball") {
ball_end_n();
}
else if (type == "axle") {
translate([0, 0, -0.1]) axleround(h=8+0.1, axleradius=2.4, axlemesh=1.85);
translate([0, 0, -0.1]) cylinder($fs=0.5, h=0.8+0.1, r=5);
}
}
// cut for ball end
2015-12-27 22:33:38 +03:00
module ball_end_n() {
2015-12-30 15:19:37 +03:00
translate([0, 0, 4]) sphere(r=3.05);
translate([0, 0, 2.3-0.1]) cylinder(r=2.9, h=2);
translate([0, 0, -0.1]) cylinder(r=5, h=2.4);
2015-12-27 22:33:38 +03:00
}
2015-12-30 01:56:09 +03:00
module axleround(h = 24, axleradius = 2.3, axlemesh = 1.7) {
2015-12-30 15:19:37 +03:00
difference() {
2015-12-30 01:56:09 +03:00
cylinder($fn=16, r=axleradius, h=h);
translate([axlemesh/2, axlemesh/2, -1]) cube([axleradius, axleradius, h+2]);
translate([axlemesh/2, -axlemesh/2-axleradius, -1]) cube([axleradius, axleradius, h+2]);
translate([-axlemesh/2-axleradius, axlemesh/2, -1]) cube([axleradius, axleradius, h+2]);
translate([-axlemesh/2-axleradius, -axlemesh/2-axleradius, -1]) cube([axleradius, axleradius, h+2]);
}
}
2015-12-30 15:19:37 +03:00
module pin_hole(height=8) {
union() {
translate([0, 0, -0.1]) cylinder($fs=0.5, h=height+0.2, r=2.5);
translate([0, 0, -0.1]) cylinder($fs=0.5, h=0.8+0.1, r=3);
translate([0, 0, height-0.8]) cylinder($fs=0.5, h=0.8+0.1, r=3);
}
}