Skip to content

Instantly share code, notes, and snippets.

@justacec
Last active April 6, 2021 10:44
Show Gist options
  • Save justacec/55be63ebb45ea424bef8b4c5c29f94a8 to your computer and use it in GitHub Desktop.
Save justacec/55be63ebb45ea424bef8b4c5c29f94a8 to your computer and use it in GitHub Desktop.
end_a = "male"; // [none, male, female]
end_b = "male"; // [none, male, female]
length = 101.7;
rung_n = 11;
module __Customizer_Limit__ () {}
rung_width = 3.5;
rung_length = 36.24;
rung_thickness = 1.5;
rung_spacing = ((length - (rung_width*rung_n)) / (rung_n-1)) + rung_width;
track_width = 25 - 1.5;
module track_main(half=false) {
cube_length = half == true ? length/2 : length;
intersection() {
union() {
for(i = [0 : (rung_n-1)]) {
translate([0, rung_width/2 + i*rung_spacing, 0]) {
cube([rung_length, rung_width, rung_thickness], center = true);
translate([(rung_length/2) - 3 - (1.1/2), 0, 0])
cube([1.1, rung_width, 2.5], center=true);
translate([-((rung_length/2) - 3 - (1.1/2)), 0, 0])
cube([1.1, rung_width, 2.5], center=true);
}
}
translate([track_width/2, length/2, 0])
cube([1.5, length, 6.36], center=true);
translate([-track_width/2, length/2, 0])
cube([1.5, length, 6.36], center=true);
translate([((22-4.68)/2) - (4.68/2) + (7.72/2), length/2, 0])
cube([7.72, length, 2], center=true);
translate([-(((22-4.68)/2) - (4.68/2) + (7.72/2)), length/2, 0])
cube([7.72, length, 2], center=true);
translate([(22-4.68)/2, length/2, 0])
cube([4.68, length, 2.4], center=true);
translate([-(22-4.68)/2, length/2, 0])
cube([4.68, length, 2.4], center=true);
};
translate([0, cube_length/2, 0])
cube([50, cube_length, 10], center=true);
};
}
union() {
// This is end "a" and therefore needs no rotation and or translation
if(end_a == "none") {
track_main(true);
}
if(end_a == "male") {
male_end([0, 0, 180], [0, 0, 0])
track_main(true);
}
if(end_a == "female") {
female_end([0, 0, 180], [0, 0, 0])
track_main(true);
}
// This is end "b" and will need to be rotated and translated
rotate([0, 0, 180])
translate([0, -length, 0]) {
if(end_b == "none") {
track_main(true);
}
if(end_b == "male") {
male_end([0,0,180], [0,0,0])
track_main(true);
}
if(end_b == "female") {
female_end([0,0,180], [0,0,0])
track_main(true);
}
};
}
module mirror_copy(v = [1, 0, 0]) {
children();
mirror(v) children();
}
//module offset_path(points, offset=[0,0]) {
// n_elements = len(points);
//
// follow_points = [for (i = [0:(n_elements-1)]) points[n_elements-i-1] + offset];
// all_points = concat(points, follow_points);
//
// echo(all_points)
//
// polygon(points = all_points);
//}
module female_end(r=[0,0,0], t=[0,0,0]) {
rotate(r)
translate(t) {
};
}
module female_end(r=[0,0,180], t=[0,0,0]) {
difference() {
union() {
children(0);
translate([0,12.5/2,0])
cube([track_width, 12.5, 1.5], center=true);
translate([25/2+((rung_length-25)/2)/2, 2/2, 0])
cube([(rung_length-25)/2, 2, 3.07], center=true);
translate([-(25/2+((rung_length-25)/2)/2), 2/2, 0])
cube([(rung_length-25)/2, 2, 3.07], center=true);
};
union() {
translate([0, 5, 0])
linear_extrude(height=2.5, center=true, twist=0, slices=2)
polygon(points=[[-8.8/2, 0], [8.8/2, 0], [8/2, -5.005], [-8/2,-5.005], [-8.8/2, 0]]);
//cube([10, 4.9, 10], center=true);
translate([25/2+(0.001+(rung_length-25)/2)/2, 1/2, 0])
cube([((rung_length-25)/2)+0.001, 1.1, 1], center=true);
translate([-(25/2+(0.001 + (rung_length-25)/2)/2), 1/2, 0])
cube([((rung_length-25)/2)+0.001, 1.1, 1], center=true);
}
}
}
module male_end(r=[0, 0, 0], t=[0,0,0]) {
union() {
children(0);
rotate(r)
translate(t) {
difference() {
union() {
translate([rung_length/2-2.5, 0.5, 0])
cube([5, 1, 0.8], center=true);
translate([-(rung_length/2-2.5), 0.5, 0])
cube([5, 1, 0.8], center=true);
linear_extrude(height=1.5, center=true, twist=0, slices=2)
polygon(points=[[-8.8/2, 5], [8.8/2, 5], [8/2, 0], [-8/2,0], [-8.8/2, 5]]);
thickness = 1;
slope = ((8.8 - 8.0)/2) / 5.0;
tmp_poly_points = [
[-8.8/2, 5],
[8.8/2, 5],
[8.8/2 - slope*8, -3],
[-(8.8/2 - slope*8), -3]
];
difference() {
difference() {
union() {
linear_extrude(height=3.45, center=true, twist=0, slices=2)
difference() {
polygon(tmp_poly_points);
offset(delta=-thickness) {
polygon(tmp_poly_points);
}
};
// 10.16
translate([-10.16/2+1, -1, 0])
cube([2, 2, 3.45], center=true);
translate([10.16/2-1, -1, 0])
cube([2, 2, 3.45], center=true);
};
linear_extrude(height=4, center=true, twist=0, slices=2)
square([4.66, 10], center=true);
};
translate([0,-2.5,0])
rotate([90,90,90])
mirror_copy()
linear_extrude(height=30, center=true, twist=0, slices=2)
polygon(points=[
[0, 0],
[3, 3],
[5, 3],
[5, -2],
[0, -2],
[0, 0]
]);
};
};
linear_extrude(height=10, center=true, twist=0, slices=2)
union() {
translate([0, 2, 0])circle(d=1.5, $fn=50);
translate([0, 3.5+0.75, 0])square([1.5, 5], center=true);
};
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment