Merge branch 'sk_bracket_screw_length' of https://github.com/martinbudden/NopSCADlib into martinbudden-sk_bracket_screw_length

This commit is contained in:
Chris Palmer 2020-02-25 12:34:19 +00:00
commit 6a7f7dcbbf
2 changed files with 15 additions and 8 deletions

View File

@ -20,12 +20,19 @@ include <../core.scad>
use <../utils/layout.scad>
include <../vitamins/sk_brackets.scad>
include <../vitamins/extrusions.scad>
module sk_brackets() {
screws = [M5_cap_screw, M5_cap_screw, M4_cap_screw, M5_cap_screw];
nuts = [undef, M5_nut, M4_sliding_t_nut, M5_sliding_t_nut];
layout([for(s = sk_brackets) 1.5 * sk_size(s)[1]])
sk_bracket_assembly(sk_brackets[$i], screw_type = screws[$i], nut_type = nuts[$i]);
screws = [M4_dome_screw, M4_cap_screw, M5_cap_screw, M5_cap_screw];
nuts = [M4_hammer_nut, M4_sliding_t_nut, M5_sliding_t_nut, undef];
// channel depth = 6 for 2020 extrusion, 9 for 3030 extrusion
depths = [6, 6, 9, 0];
layout([for(s = sk_brackets) 1.5 * sk_size(s)[1]]) {
sk_bracket_assembly(sk_brackets[$i], screw_type = screws[$i], nut_type = nuts[$i], max_screw_depth = depths[$i]);
translate([0, -sk_hole_offset(sk_brackets[$i]) - extrusion_width($i < 2 ? E2020 : E3030) / 2, 0])
rotate([0, 90, 0])
extrusion($i < 2 ? E2020 : E3030, 20);
}
}
if($preview)

View File

@ -100,7 +100,7 @@ module sk_bracket_hole_positions(type) { //! Place children at hole positions
children();
}
module sk_bracket_assembly(type, part_thickness = 2, screw_type = M5_cap_screw, nut_type = undef) { //! Assembly with fasteners in place
module sk_bracket_assembly(type, part_thickness = 2, screw_type = M5_cap_screw, nut_type = undef, max_screw_depth = 6) { //! Assembly with fasteners in place
sk_bracket(type);
screw_type = is_undef(screw_type) ? scs_screw(type) : screw_type;
@ -110,9 +110,8 @@ module sk_bracket_assembly(type, part_thickness = 2, screw_type = M5_cap_screw,
nut_washer_thickness = nut_washer_type ? washer_thickness(nut_washer_type) : 0;
nut_offset = sk_base_height(type) + part_thickness;
screw_length = nut_washer_type ? screw_longer_than(nut_offset + screw_washer_thickness + nut_washer_thickness + nut_thickness(nut_type))
: screw_shorter_than(nut_offset + screw_washer_thickness + nut_thickness(nut_type) + 2);
screw_length = max_screw_depth ? screw_shorter_than(sk_base_height(type) + screw_washer_thickness + max_screw_depth)
: screw_longer_than(nut_offset + screw_washer_thickness + nut_washer_thickness + nut_thickness(nut_type));
sk_bracket_hole_positions(type) {
screw_and_washer(screw_type, screw_length);
translate_z(-nut_offset)
@ -123,3 +122,4 @@ module sk_bracket_assembly(type, part_thickness = 2, screw_type = M5_cap_screw,
sliding_t_nut(nut_type);
}
}