Changed linear rails to use a v-slot rather than a square slot.

This commit is contained in:
Martin Budden 2021-01-08 18:06:04 +00:00
parent 16c1eeef27
commit abc38f2744
2 changed files with 35 additions and 34 deletions

View File

@ -33,6 +33,9 @@ function rail_bore_depth(type) = type[7]; //! Counter bore depth
function rail_screw(type) = type[8]; //! Screw type function rail_screw(type) = type[8]; //! Screw type
function rail_carriage(type) = type[9]; //! Carriage type function rail_carriage(type) = type[9]; //! Carriage type
function rail_end_screw(type) = type[10]; //! Screw used for ends only (Countersink used for better location) function rail_end_screw(type) = type[10]; //! Screw used for ends only (Countersink used for better location)
function rail_groove_offset(type)=type[11]; //! Offset of centre of groove from top of rail
function rail_groove_width(type)=type[12]; //! Groove width
function rail_screw_height(type, screw) = rail_height(type) - rail_bore_depth(type) + screw_head_depth(screw, rail_hole(type)); //! Position screw taking into account countersink into counterbored hole function rail_screw_height(type, screw) = rail_height(type) - rail_bore_depth(type) + screw_head_depth(screw, rail_hole(type)); //! Position screw taking into account countersink into counterbored hole
function rail_travel(type, length) = length - carriage_length(rail_carriage(type)); //! How far the carriage can travel function rail_travel(type, length) = length - carriage_length(rail_carriage(type)); //! How far the carriage can travel
@ -134,43 +137,41 @@ module carriage(type, rail, end_colour = grey(20), wiper_colour = grey(20)) { //
carriage_end(type, end_w, end_h, end_l); carriage_end(type, end_w, end_h, end_l);
} }
module rail(type, length) { //! Draw the specified rail module rail(type, length, colour = grey(90), use_polycircles = false) { //! Draw the specified rail
width = rail_width(type); width = rail_width(type);
height = rail_height(type); height = rail_height(type);
vitamin(str("rail(", type[0], ", ", length, "): Linear rail ", type[0], " x ", length, "mm")); vitamin(str("rail(", type[0], ", ", length, "): Linear rail ", type[0], " x ", length, "mm"));
color(grey(90)) { color(colour) {
linear_extrude(height - rail_bore_depth(type)) difference() { linear_extrude(height - rail_bore_depth(type)) difference() {
square([length, width], center = true); square([length, width], center = true);
rail_hole_positions(type, length) rail_hole_positions(type, length)
circle(d = rail_hole(type)); if (use_polycircles)
poly_circle(r = rail_hole(type) / 2);
else
circle(r = rail_hole(type) / 2);
} }
translate_z(rail_height(type) - rail_bore_depth(type))
translate_z(rail_height(type) - rail_bore_depth(type)) { linear_extrude(rail_bore_depth(type)) difference() {
h1 = rail_bore_depth(type) > 2 ? rail_bore_depth(type) / 3 : rail_bore_depth(type) / 2; square([length, rail_bore(type) + 2 * eps], center = true);
h0 = rail_bore_depth(type) > 2 ? (rail_bore_depth(type) - h1) / 2 : 0;
h2 = rail_bore_depth(type) - h1 - h0;
linear_extrude(h0) difference() {
square([length, width], center = true);
rail_hole_positions(type, length) rail_hole_positions(type, length)
circle(d = rail_bore(type)); if (use_polycircles)
poly_circle(r = rail_bore(type) / 2);
else
circle(r = rail_bore(type) / 2);
} }
translate_z(h0)
linear_extrude(h1) difference() { go = height - rail_groove_offset(type);
w1 = max(width - 2, rail_bore(type)); gw = rail_groove_width(type);
square([length, w1], center = true); gd = gw / 2;
rail_hole_positions(type, length) sw = (width - rail_bore(type)) / 2;
circle(d = rail_bore(type)); for (m = [0, 1])
} mirror([0, m, 0])
translate_z(h0 + h1) translate([0, -width / 2])
linear_extrude(h2) difference() { rotate([0, -90, 0])
square([length, width], center = true); linear_extrude(length, center = true)
rail_hole_positions(type, length) polygon([ [0, 0], [0, sw], [height, sw], [height, 0], [go + gw/2, 0], [go, gd], [go - gw/2, 0] ]);
circle(d = rail_bore(type));
}
}
} }
} }

View File

@ -32,14 +32,14 @@ SSR15_carriage = [ 40.3, 23.3, 34, 24, 4.5, 0, 26, M4_cap_screw ];
// Rails // Rails
// //
// //
// Wr Hr E P D d h // Wr Hr E P D d h go gw
MGN5 = [ "MGN5", 5, 3.6, 5, 15, 3.6, 2.4, 0.8, M2_cs_cap_screw, MGN5_carriage, M2_cs_cap_screw ]; // Screw holes too small for M2 heads MGN5 = [ "MGN5", 5, 3.6, 5, 15, 3.6, 2.4, 0.8, M2_cs_cap_screw, MGN5_carriage, M2_cs_cap_screw, 1, 1 ]; // Screw holes too small for M2 heads
MGN7 = [ "MGN7", 7, 5, 5, 15, 4.3, 2.4, 2.6, M2_cap_screw, MGN7_carriage, M2_cs_cap_screw ]; MGN7 = [ "MGN7", 7, 5, 5, 15, 4.3, 2.4, 2.6, M2_cap_screw, MGN7_carriage, M2_cs_cap_screw, 1.5, 1.5 ];
MGN9 = [ "MGN9", 9, 6, 7.5, 20, 6.0, 3.5, 3.5, M3_cap_screw, MGN9_carriage, M3_cs_cap_screw ]; MGN9 = [ "MGN9", 9, 6, 7.5, 20, 6.0, 3.5, 3.5, M3_cap_screw, MGN9_carriage, M3_cs_cap_screw, 1.5, 1.5 ];
MGN12= [ "MGN12", 12, 8, 10, 25, 6.0, 3.5, 4.5, M3_cap_screw, MGN12_carriage, M3_cs_cap_screw ]; MGN12= [ "MGN12", 12, 8, 10, 25, 6.0, 3.5, 4.5, M3_cap_screw, MGN12_carriage, M3_cs_cap_screw, 2.25, 2.75 ];
MGN12H=[ "MGN12H",12, 8, 10, 25, 6.0, 3.5, 4.5, M3_cap_screw, MGN12H_carriage,M3_cs_cap_screw ]; MGN12H=[ "MGN12H",12, 8, 10, 25, 6.0, 3.5, 4.5, M3_cap_screw, MGN12H_carriage,M3_cs_cap_screw, 2.25, 2.75];
MGN15= [ "MGN15", 15, 10, 10, 40, 6.0, 3.5, 5.0, M3_cap_screw, MGN15_carriage, M3_cs_cap_screw ]; MGN15= [ "MGN15", 15, 10, 10, 40, 6.0, 3.5, 5.0, M3_cap_screw, MGN15_carriage, M3_cs_cap_screw, 2.5, 2.75 ];
SSR15= [ "SSR15", 15, 12.5,10, 60, 7.5, 4.5, 5.3, M4_cap_screw, SSR15_carriage, M4_cs_cap_screw ]; SSR15= [ "SSR15", 15, 12.5,10, 60, 7.5, 4.5, 5.3, M4_cap_screw, SSR15_carriage, M4_cs_cap_screw, 2.5, 2.75 ];
rails = [MGN5, MGN7, MGN9, MGN12, MGN12H, MGN15, SSR15]; rails = [MGN5, MGN7, MGN9, MGN12, MGN12H, MGN15, SSR15];