Merge branch 'martinbudden-linear_rails'

This commit is contained in:
Chris Palmer 2021-01-09 23:37:26 +00:00
commit 8ca4bb5adc
5 changed files with 42 additions and 35 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 KiB

After

Width:  |  Height:  |  Size: 862 KiB

View File

@ -2658,6 +2658,8 @@ Linear rails with carriages.
| `rail_carriage(type)` | Carriage type | | `rail_carriage(type)` | Carriage type |
| `rail_end(type)` | Minimum distance screw can be from the end | | `rail_end(type)` | Minimum distance screw can be from the end |
| `rail_end_screw(type)` | Screw used for ends only (Countersink used for better location) | | `rail_end_screw(type)` | Screw used for ends only (Countersink used for better location) |
| `rail_groove_offset(type)` | Offset of centre of groove from top of rail |
| `rail_groove_width(type)` | Groove width |
| `rail_height(type)` | Height of rail section | | `rail_height(type)` | Height of rail section |
| `rail_hole(type)` | Screw hole diameter | | `rail_hole(type)` | Screw hole diameter |
| `rail_pitch(type)` | Distance between screws | | `rail_pitch(type)` | Distance between screws |
@ -2678,7 +2680,7 @@ Linear rails with carriages.
|:--- |:--- | |:--- |:--- |
| `carriage(type, rail, end_colour = grey(20)` | Draw the specified carriage | | `carriage(type, rail, end_colour = grey(20)` | Draw the specified carriage |
| `carriage_hole_positions(type)` | Position children over screw holes | | `carriage_hole_positions(type)` | Position children over screw holes |
| `rail(type, length)` | Draw the specified rail | | `rail(type, length, colour = grey(90)` | Draw the specified rail |
| `rail_assembly(type, length, pos, carriage_end_colour = grey(20)` | Rail and carriage assembly | | `rail_assembly(type, length, pos, carriage_end_colour = grey(20)` | Rail and carriage assembly |
| `rail_hole_positions(type, length, first = 0, screws = 100, both_ends = true)` | Position children over screw holes | | `rail_hole_positions(type, length, first = 0, screws = 100, both_ends = true)` | Position children over screw holes |
| `rail_screws(type, length, thickness, screws = 100, index_screws = undef)` | Place screws in the rail | | `rail_screws(type, length, thickness, screws = 100, index_screws = undef)` | Place screws in the rail |

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 154 KiB

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,45 @@ 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) {
rbr = rail_bore(type) / 2;
w = corrected_radius(rbr) * 2 + 2 * eps; // width of core big enough for the holes
linear_extrude(height - rail_bore_depth(type)) difference() { linear_extrude(height - rail_bore_depth(type)) difference() {
square([length, width], center = true); square([length, w], center = true);
rail_hole_positions(type, length) rail_hole_positions(type, length)
circle(d = rail_hole(type)); if (use_polycircles)
poly_circle(rail_hole(type) / 2);
else
circle(d = rail_hole(type));
} }
translate_z(rail_height(type) - rail_bore_depth(type))
linear_extrude(rail_bore_depth(type)) difference() {
square([length, w], center = true);
translate_z(rail_height(type) - rail_bore_depth(type)) {
h1 = rail_bore_depth(type) > 2 ? rail_bore_depth(type) / 3 : rail_bore_depth(type) / 2;
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(rbr);
else
circle(rbr);
} }
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 - w) / 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];