mirror of
https://github.com/DJSundog/NopSCADlib.git
synced 2025-01-25 17:12:46 -05:00
Fixed bug in rail screw placement when putting screws in the middle.
Rail test can now move the carriages with customiser.
This commit is contained in:
parent
c5b35daeac
commit
ceac5cdb27
@ -23,6 +23,7 @@ use <../utils/layout.scad>
|
|||||||
use <../vitamins/nut.scad>
|
use <../vitamins/nut.scad>
|
||||||
|
|
||||||
sheet = 3;
|
sheet = 3;
|
||||||
|
pos = 1; //[-1 : 0.1 : 1]
|
||||||
|
|
||||||
module rails()
|
module rails()
|
||||||
layout([for(l = rails) carriage_width(rail_carriage(l))], 20)
|
layout([for(l = rails) carriage_width(rail_carriage(l))], 20)
|
||||||
@ -33,7 +34,7 @@ module rails()
|
|||||||
nut = screw_nut(screw);
|
nut = screw_nut(screw);
|
||||||
washer = screw_washer(screw);
|
washer = screw_washer(screw);
|
||||||
|
|
||||||
rail_assembly(rail, length, rail_travel(rail, length) / 2, $i<2 ? grey(20) : "green", $i<2 ? grey(20) : "red");
|
rail_assembly(rail, length, pos * rail_travel(rail, length) / 2, $i<2 ? grey(20) : "green", $i<2 ? grey(20) : "red");
|
||||||
|
|
||||||
rail_screws(rail, length, sheet + nut_thickness(nut, true) + washer_thickness(washer));
|
rail_screws(rail, length, sheet + nut_thickness(nut, true) + washer_thickness(washer));
|
||||||
|
|
||||||
|
@ -52,8 +52,9 @@ function rail_holes(type, length) = //! Number of holes in a rail given its ```l
|
|||||||
module rail_hole_positions(type, length, first = 0, screws = 100, both_ends = true) { //! Position children over screw holes
|
module rail_hole_positions(type, length, first = 0, screws = 100, both_ends = true) { //! Position children over screw holes
|
||||||
pitch = rail_pitch(type);
|
pitch = rail_pitch(type);
|
||||||
holes = rail_holes(type, length);
|
holes = rail_holes(type, length);
|
||||||
for(i = [first : holes - 1 - first])
|
last = first + screws;
|
||||||
if(i < screws || (holes - i <= screws && both_ends))
|
for(i = [first : holes - 1], j = holes - 1 - i)
|
||||||
|
if(i < last || both_ends && (j >= first && j < last))
|
||||||
translate([i * pitch - length / 2 + (length - (holes - 1) * pitch) / 2, 0])
|
translate([i * pitch - length / 2 + (length - (holes - 1) * pitch) / 2, 0])
|
||||||
children();
|
children();
|
||||||
}
|
}
|
||||||
@ -177,7 +178,6 @@ module rail_assembly(type, length, pos, carriage_end_colour = grey(20), carriage
|
|||||||
|
|
||||||
translate([pos, 0])
|
translate([pos, 0])
|
||||||
carriage(rail_carriage(type), type, carriage_end_colour, carriage_wiper_colour);
|
carriage(rail_carriage(type), type, carriage_end_colour, carriage_wiper_colour);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module rail_screws(type, length, thickness, screws = 100) { //! Place screws in the rail
|
module rail_screws(type, length, thickness, screws = 100) { //! Place screws in the rail
|
||||||
@ -193,6 +193,6 @@ module rail_screws(type, length, thickness, screws = 100) { //! Place screws in
|
|||||||
screw(end_screw, end_screw_len);
|
screw(end_screw, end_screw_len);
|
||||||
|
|
||||||
translate_z(rail_screw_height(type, screw))
|
translate_z(rail_screw_height(type, screw))
|
||||||
rail_hole_positions(type, length, index_screws, screws)
|
rail_hole_positions(type, length, index_screws, min(screws, rail_holes(type, length)) - 2 * index_screws)
|
||||||
screw(screw, screw_len);
|
screw(screw, screw_len);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user