diff --git a/libtest.png b/libtest.png index 04b1238..3763fe3 100644 Binary files a/libtest.png and b/libtest.png differ diff --git a/readme.md b/readme.md index 7326623..3040856 100644 --- a/readme.md +++ b/readme.md @@ -2658,6 +2658,8 @@ Linear rails with carriages. | `rail_carriage(type)` | Carriage type | | `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_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_hole(type)` | Screw hole diameter | | `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_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_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 | diff --git a/tests/png/rails.png b/tests/png/rails.png index bc29aa4..9eb9ae2 100644 Binary files a/tests/png/rails.png and b/tests/png/rails.png differ diff --git a/vitamins/rail.scad b/vitamins/rail.scad index 88b946c..24c791e 100644 --- a/vitamins/rail.scad +++ b/vitamins/rail.scad @@ -144,28 +144,32 @@ module rail(type, length, colour = grey(90), use_polycircles = false) { //! Draw vitamin(str("rail(", type[0], ", ", length, "): Linear rail ", type[0], " x ", length, "mm")); 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() { - square([length, width], center = true); + square([length, w], center = true); + rail_hole_positions(type, length) if (use_polycircles) - poly_circle(r = rail_hole(type) / 2); + poly_circle(rail_hole(type) / 2); else - circle(r = rail_hole(type) / 2); + circle(d = rail_hole(type)); } translate_z(rail_height(type) - rail_bore_depth(type)) linear_extrude(rail_bore_depth(type)) difference() { - square([length, rail_bore(type) + 2 * eps], center = true); + square([length, w], center = true); + rail_hole_positions(type, length) if (use_polycircles) - poly_circle(r = rail_bore(type) / 2); + poly_circle(rbr); else - circle(r = rail_bore(type) / 2); + circle(rbr); } go = height - rail_groove_offset(type); gw = rail_groove_width(type); gd = gw / 2; - sw = (width - rail_bore(type)) / 2; + sw = (width - w) / 2; for (m = [0, 1]) mirror([0, m, 0]) translate([0, -width / 2])