diff --git a/libtest.png b/libtest.png index e538c40..220bd04 100644 Binary files a/libtest.png and b/libtest.png differ diff --git a/readme.md b/readme.md index 9e9a1ef..b81b040 100644 --- a/readme.md +++ b/readme.md @@ -2786,26 +2786,35 @@ Linear rails with carriages. ### Vitamins | Qty | Module call | BOM entry | | ---:|:--- |:---| -| 2 | `rail(MGN12, 200)` | Linear rail MGN12 x 200mm | +| 1 | `rail(MGN12, 200)` | Linear rail MGN12 x 200mm | | 1 | `rail(MGN15, 200)` | Linear rail MGN15 x 200mm | | 1 | `rail(MGN5, 200)` | Linear rail MGN5 x 200mm | | 1 | `rail(MGN7, 200)` | Linear rail MGN7 x 200mm | | 1 | `rail(MGN9, 200)` | Linear rail MGN9 x 200mm | | 1 | `rail(SSR15, 200)` | Linear rail SSR15 x 200mm | +| 1 | `carriage(MGN12C_carriage)` | Linear rail carriage MGN12C | +| 1 | `carriage(MGN12H_carriage)` | Linear rail carriage MGN12H | +| 1 | `carriage(MGN15C_carriage)` | Linear rail carriage MGN15C | +| 1 | `carriage(MGN5C_carriage)` | Linear rail carriage MGN5C | +| 1 | `carriage(MGN7C_carriage)` | Linear rail carriage MGN7C | +| 1 | `carriage(MGN7H_carriage)` | Linear rail carriage MGN7H | +| 1 | `carriage(MGN9C_carriage)` | Linear rail carriage MGN9C | +| 1 | `carriage(MGN9H_carriage)` | Linear rail carriage MGN9H | +| 1 | `carriage(SSR15_carriage)` | Linear rail carriage SSR15 | | 26 | `nut(M2_nut, nyloc = true)` | Nut M2 x 1.6mm nyloc | -| 31 | `nut(M3_nut, nyloc = true)` | Nut M3 x 2.4mm nyloc | +| 23 | `nut(M3_nut, nyloc = true)` | Nut M3 x 2.4mm nyloc | | 4 | `nut(M4_nut, nyloc = true)` | Nut M4 x 3.2mm nyloc | | 11 | `screw(M2_cap_screw, 10)` | Screw M2 cap x 10mm | | 15 | `screw(M2_cs_cap_screw, 10)` | Screw M2 cs cap x 10mm | | 8 | `screw(M3_cap_screw, 10)` | Screw M3 cap x 10mm | -| 12 | `screw(M3_cap_screw, 12)` | Screw M3 cap x 12mm | +| 6 | `screw(M3_cap_screw, 12)` | Screw M3 cap x 12mm | | 3 | `screw(M3_cap_screw, 16)` | Screw M3 cap x 16mm | | 2 | `screw(M3_cs_cap_screw, 12)` | Screw M3 cs cap x 12mm | -| 6 | `screw(M3_cs_cap_screw, 16)` | Screw M3 cs cap x 16mm | +| 4 | `screw(M3_cs_cap_screw, 16)` | Screw M3 cs cap x 16mm | | 2 | `screw(M4_cap_screw, 16)` | Screw M4 cap x 16mm | | 2 | `screw(M4_cs_cap_screw, 20)` | Screw M4 cs cap x 20mm | | 26 | `washer(M2_washer)` | Washer M2 x 5mm x 0.3mm | -| 31 | `washer(M3_washer)` | Washer M3 x 7mm x 0.5mm | +| 23 | `washer(M3_washer)` | Washer M3 x 7mm x 0.5mm | | 4 | `washer(M4_washer)` | Washer M4 x 9mm x 0.8mm | diff --git a/tests/png/rails.png b/tests/png/rails.png index 9eb9ae2..38c6cab 100644 Binary files a/tests/png/rails.png and b/tests/png/rails.png differ diff --git a/tests/rails.scad b/tests/rails.scad index 1917695..15ec2ea 100644 --- a/tests/rails.scad +++ b/tests/rails.scad @@ -22,27 +22,36 @@ include <../vitamins/rails.scad> use <../utils/layout.scad> use <../vitamins/nut.scad> +length = 200; sheet = 3; pos = 1; //[-1 : 0.1 : 1] +function rail_carriages(rail) = [for(c = carriages) if(carriage_rail(c) == rail) c]; + module rails() - layout([for(l = carriages) carriage_width(l)], 20) + layout([for(r = rails) carriage_width(rail_carriages(r)[0])], 20) rotate(-90) { - carriage = carriages[$i]; - rail = carriage_rail(carriage); - length = 200; + rail = rails[$i]; + carriages = rail_carriages(rail); + carriage = carriages[0]; screw = rail_screw(rail); nut = screw_nut(screw); washer = screw_washer(screw); rail_assembly(carriage, length, pos * carriage_travel(carriage, length) / 2, $i<2 ? grey(20) : "green", $i<2 ? grey(20) : "red"); + if(len(carriages) > 1) + translate([-carriage_travel(carriages[1], length) / 2, 0]) + carriage(carriages[1]); + rail_screws(rail, length, sheet + nut_thickness(nut, true) + washer_thickness(washer)); rail_hole_positions(rail, length, 0) translate_z(-sheet) vflip() nut_and_washer(nut, true); + + echo(rail[0], (length - (rail_holes(rail, length) - 1) * rail_pitch(rail)) / 2); } if($preview) diff --git a/vitamins/rail.scad b/vitamins/rail.scad index 9b3f8c4..b40112f 100644 --- a/vitamins/rail.scad +++ b/vitamins/rail.scad @@ -37,18 +37,19 @@ function rail_groove_width(type)=type[11]; //! 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 carriage_length(type) = type[0]; //! Overall length -function carriage_block_length(type) = type[1]; //! Length of the metal part -function carriage_width(type) = type[2]; //! Width of carriage -function carriage_height(type) = type[3]; //! Height of carriage -function carriage_size(type) = [ type[0], type[2], type[3] ]; //! Size of carriage -function carriage_clearance(type) = type[4]; //! Gap under the carriage -function carriage_pitch_x(type) = type[5]; //! Screw hole x pitch -function carriage_pitch_y(type) = type[6]; //! Screw hole y pitch -function carriage_screw(type) = type[7]; //! Carriage screw type -function carriage_rail(type) = type[8]; //! Rail type +function carriage_length(type) = type[1]; //! Overall length +function carriage_block_length(type) = type[2]; //! Length of the metal part +function carriage_width(type) = type[3]; //! Width of carriage +function carriage_height(type) = type[4]; //! Height of carriage +function carriage_clearance(type) = type[5]; //! Gap under the carriage +function carriage_pitch_x(type) = type[6]; //! Screw hole x pitch +function carriage_pitch_y(type) = type[7]; //! Screw hole y pitch +function carriage_screw(type) = type[8]; //! Carriage screw type +function carriage_rail(type) = type[9]; //! Rail type + function carriage_screw_depth(type) = 2 * screw_radius(carriage_screw(type)); //! Carriage thread depth function carriage_travel(type, rail_length) = rail_length - carriage_length(type); //! How far the carriage can travel on a given length rail +function carriage_size(type) = [ carriage_length(type), carriage_width(type), carriage_height(type) ]; //! Size of carriage function rail_holes(type, length) = //! Number of holes in a rail given its `length` floor((length - 2 * rail_end(type)) / rail_pitch(type)) + 1; @@ -74,6 +75,8 @@ module carriage_hole_positions(type) { //! Position children over screw holes } module carriage(type, end_colour = grey(20), wiper_colour = grey(20)) { //! Draw the specified carriage + vitamin(str("carriage(", type[0], "_carriage): Linear rail carriage ", type[0])); + total_l = carriage_length(type); block_l = carriage_block_length(type); block_w = carriage_width(type); diff --git a/vitamins/rails.scad b/vitamins/rails.scad index 12c3df0..2fc3ce9 100644 --- a/vitamins/rails.scad +++ b/vitamins/rails.scad @@ -30,18 +30,19 @@ SSR15= [ "SSR15", 15, 12.5, 10, 60, 7.5, 4.5, 5.3, M4_cap_screw, M4_cs_cap_ // // Carriages // -// L L1 W H H1 C B -MGN5_carriage = [ 16, 9.6, 12, 6, 1.5, 0, 8, M2_cap_screw, MGN5 ]; -MGN7C_carriage = [ 23, 14.3, 17, 8, 1.5, 8, 12, M2_cap_screw, MGN7 ]; -MGN7H_carriage = [ 30.8, 21.8, 17, 8, 1.5,13, 12, M2_cap_screw, MGN7 ]; -MGN9C_carriage = [ 29.7, 20.8, 20, 10, 2, 10, 15, M3_cap_screw, MGN9 ]; -MGN9H_carriage = [ 39.9, 29.9, 20, 10, 2, 16, 15, M3_cap_screw, MGN9 ]; -MGN12C_carriage = [ 34.7, 21.7, 27, 13, 3, 15, 20, M3_cap_screw, MGN12 ]; -MGN12H_carriage = [ 45.4, 32.4, 27, 13, 3, 20, 20, M3_cap_screw, MGN12 ]; -MGN15C_carriage = [ 43.3, 27.7, 32, 16, 4, 20, 25, M3_cap_screw, MGN15 ]; -SSR15_carriage = [ 40.3, 23.3, 34, 24, 4.5, 0, 26, M4_cap_screw, SSR15 ]; +// L L1 W H H1 C B +MGN5C_carriage = ["MGN5C", 16, 9.6, 12, 6, 1.5, 0, 8, M2_cap_screw, MGN5 ]; +MGN7C_carriage = ["MGN7C", 23, 14.3, 17, 8, 1.5, 8, 12, M2_cap_screw, MGN7 ]; +MGN7H_carriage = ["MGN7H", 30.8, 21.8, 17, 8, 1.5,13, 12, M2_cap_screw, MGN7 ]; +MGN9C_carriage = ["MGN9C", 29.7, 20.8, 20, 10, 2, 10, 15, M3_cap_screw, MGN9 ]; +MGN9H_carriage = ["MGN9H", 39.9, 29.9, 20, 10, 2, 16, 15, M3_cap_screw, MGN9 ]; +MGN12C_carriage = ["MGN12C", 34.7, 21.7, 27, 13, 3, 15, 20, M3_cap_screw, MGN12 ]; +MGN12H_carriage = ["MGN12H", 45.4, 32.4, 27, 13, 3, 20, 20, M3_cap_screw, MGN12 ]; +MGN15C_carriage = ["MGN15C", 43.3, 27.7, 32, 16, 4, 20, 25, M3_cap_screw, MGN15 ]; +SSR15_carriage = ["SSR15", 40.3, 23.3, 34, 24, 4.5, 0, 26, M4_cap_screw, SSR15 ]; +rails = [MGN5, MGN7, MGN9, MGN12, MGN15, SSR15]; -carriages = [MGN5_carriage, MGN7C_carriage, MGN9C_carriage, MGN12C_carriage, MGN12H_carriage, MGN15C_carriage, SSR15_carriage]; +carriages = [MGN5C_carriage, MGN7C_carriage, MGN7H_carriage, MGN9C_carriage, MGN9H_carriage, MGN12C_carriage, MGN12H_carriage, MGN12H_carriage, MGN15C_carriage, SSR15_carriage]; use