Merge branch 'martinbudden-sk_brackets_tidy'

This commit is contained in:
Chris Palmer 2020-02-24 11:42:07 +00:00
commit 26e8497018
7 changed files with 104 additions and 94 deletions

View File

@ -2586,21 +2586,25 @@ SK shaft support brackets
| Module | Description |
|:--- |:--- |
| ```sk_bracket(type)``` | SK shaft support bracket |
| ```sk_bracket_assembly(type, screw_length = 16, screw_type = M5_cap_screw, nut_type = undef)``` | Assembly with fasteners in place |
| ```sk_bracket_assembly(type, part_thickness = 2, screw_type = M5_cap_screw, nut_type = undef)``` | Assembly with fasteners in place |
| ```sk_bracket_hole_positions(type)``` | Place children at hole positions |
![sk_brackets](tests/png/sk_brackets.png)
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 4 | ```sliding_t_nut(M5_sliding_t_nut)``` | Nut M5 sliding T |
| 4 | ```nut(M5_nut)``` | Nut M5 x 4mm |
| 2 | ```sliding_t_nut(M4_sliding_t_nut)``` | Nut M4 sliding T |
| 2 | ```sliding_t_nut(M5_sliding_t_nut)``` | Nut M5 sliding T |
| 4 | ```nut(M5_nut, nyloc = undef)``` | Nut M5 x 4mm |
| 1 | ```sk_bracket(SK10)``` | SK10 shaft support bracket |
| 1 | ```sk_bracket(SK12)``` | SK12 shaft support bracket |
| 1 | ```sk_bracket(SK16)``` | SK16 shaft support bracket |
| 1 | ```sk_bracket(SK8)``` | SK8 shaft support bracket |
| 8 | ```screw(M5_cap_screw, 16)``` | Screw M5 cap x 16mm |
| 12 | ```washer(M5_washer)``` | Washer M5 x 10mm x 1mm |
| 2 | ```screw(M4_cap_screw, 16)``` | Screw M4 cap x 16mm |
| 6 | ```screw(M5_cap_screw, 16)``` | Screw M5 cap x 16mm |
| 2 | ```washer(M4_washer)``` | Washer M4 x 9mm x 0.8mm |
| 10 | ```washer(M5_washer)``` | Washer M5 x 10mm x 1mm |
<a href="#top">Top</a>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -22,11 +22,12 @@ use <../utils/layout.scad>
include <../vitamins/sk_brackets.scad>
module sk_brackets() {
nuts = [undef, M5_nut, M5_sliding_t_nut, M5_sliding_t_nut];
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], nut_type = nuts[$i]);
sk_bracket_assembly(sk_brackets[$i], screw_type = screws[$i], nut_type = nuts[$i]);
}
if($preview)
sk_brackets();
let($show_threads = true)
sk_brackets();

View File

@ -134,73 +134,70 @@ module wingnut(type) { //! Draw a wingnut
module sliding_t_nut(type) {
vitamin(str("sliding_t_nut(", type[0], "): Nut M", nut_size(type), " sliding T"));
size = [type[7], type[2], nut_thickness(type)];
size = [type[7], type[2], nut_thickness(type, true)];
tabSizeY1 = type[8];
tabSizeY2 = type[9];
tabSizeZ = type[10];
tabSizeZ = nut_thickness(type);
holeRadius = nut_size(type) / 2;
if($preview)
color(grey80)
extrusionSlidingNut(size, tabSizeY1, tabSizeY2, tabSizeZ, holeRadius);
color(grey80)
extrusionSlidingNut(size, tabSizeY1, tabSizeY2, tabSizeZ, holeRadius);
}
module hammer_nut(type) {
vitamin(str("hammer_nut(", type[0], "): Nut M", nut_size(type), " hammer"));
size = [type[7], type[2], nut_thickness(type)];
size = [type[7], type[2], nut_thickness(type, true)];
tabSizeY1 = type[8];
tabSizeY2 = type[9];
tabSizeZ = type[10];
tabSizeZ = nut_thickness(type);
holeRadius = nut_size(type) / 2;
if($preview)
color(grey80)
extrusionSlidingNut(size, tabSizeY1, tabSizeY2, tabSizeZ, holeRadius, 0, hammerNut = true);
color(grey80)
extrusionSlidingNut(size, tabSizeY1, tabSizeY2, tabSizeZ, holeRadius, 0, hammerNut = true);
}
module extrusionSlidingNut(size, tabSizeY1, tabSizeY2, tabSizeZ, holeRadius, holeOffset = 0, hammerNut = false) {
// center section
linear_extrude(size[2] - tabSizeZ)
difference() {
square([size[0], size[1]], center = true);
if(hammerNut) {
translate([size[0] / 2, size[1] / 2])
rotate(180)
fillet(1);
translate([-size[0] / 2, -size[1] / 2])
fillet(1);
}
if(holeRadius)
translate([holeOffset, 0])
circle(holeRadius);
}
translate_z(size[2] - tabSizeZ)
linear_extrude(tabSizeZ)
stem_h = size.z - tabSizeZ;
translate_z(-stem_h)
linear_extrude(stem_h)
difference() {
square([size[0], tabSizeY2], center = true);
square([size.x, size.y], center = true);
if(hammerNut) {
translate([size.x / 2, size.y / 2])
rotate(180)
fillet(1);
translate([-size.x / 2, -size.y / 2])
fillet(1);
}
if(holeRadius)
translate([holeOffset, 0])
circle(holeRadius);
}
linear_extrude(tabSizeZ)
difference() {
square([size.x, tabSizeY2], center = true);
if(holeRadius)
translate([holeOffset, 0])
circle(holeRadius);
}
thread_d = 2 * holeRadius;
if(show_threads)
translate([holeOffset, 0])
female_metric_thread(thread_d, metric_coarse_pitch(thread_d), size[2], center = false);
translate([holeOffset, 0, -stem_h])
female_metric_thread(thread_d, metric_coarse_pitch(thread_d), size.z, center = false);
// add the side tabs
for(m = [0, 1])
mirror([0, m, 0])
translate([0, tabSizeY2 / 2, size[2] - tabSizeZ]) {
translate([0, tabSizeY2 / 2]) {
cubeZ = 1;
translate([-size[0] / 2, 0, 0])
cube([size[0], (tabSizeY1 - tabSizeY2) / 2, cubeZ]);
translate([-size.x / 2, 0])
cube([size.x, (tabSizeY1 - tabSizeY2) / 2, cubeZ]);
translate_z(cubeZ)
rotate([0, -90, 0])
right_triangle(tabSizeZ - cubeZ, (tabSizeY1 - tabSizeY2) / 2, size[0], center = true);
right_triangle(tabSizeZ - cubeZ, (tabSizeY1 - tabSizeY2) / 2, size.x, center = true);
}
}

View File

@ -28,35 +28,35 @@ M5_nut_depth = 4;
M6_nut_depth = 5;
M8_nut_depth = 6.5;
// s r t n w t
// c a h y a r
// r d i l s a
// e i c o h p
// w u k c e
// s n r d
// e t e
// s h p
// s k t
// h
// s r t n w t
// c a h y a r
// r d i l s a
// e i c o h p
// w u k c e
// s n r d
// e t e
// s h p
// s k t
// h
//
M2_nut = ["M2_nut", 2, 4.9, 1.6, 2.4, M2_washer, M2_nut_trap_depth];
M2p5_nut = ["M2p5_nut", 2.5, 5.8, 2.2, 3.8, M2p5_washer, M2p5_nut_trap_depth];
M3_nut = ["M3_nut", 3, 6.4, 2.4, 4, M3_washer, M3_nut_trap_depth];
M4_nut = ["M4_nut", 4, 8.1, 3.2, 5, M4_washer, M4_nut_trap_depth];
M5_nut = ["M5_nut", 5, 9.2, 4, 6.25, M5_washer, M5_nut_depth];
M6_nut = ["M6_nut", 6, 11.5, 5, 8, M6_washer, M6_nut_depth];
M6_half_nut = ["M6_half_nut", 6, 11.5, 3, 8, M6_washer, 3];
M8_nut = ["M8_nut", 8, 15, 6.5, 8, M8_washer, M8_nut_depth];
toggle_nut = ["toggle_nut", 6.1, 9.2, 1.5, 1.5, M6_washer, 1.5];
M2_nut = ["M2_nut", 2, 4.9, 1.6, 2.4, M2_washer, M2_nut_trap_depth];
M2p5_nut = ["M2p5_nut", 2.5, 5.8, 2.2, 3.8, M2p5_washer, M2p5_nut_trap_depth];
M3_nut = ["M3_nut", 3, 6.4, 2.4, 4, M3_washer, M3_nut_trap_depth];
M4_nut = ["M4_nut", 4, 8.1, 3.2, 5, M4_washer, M4_nut_trap_depth];
M5_nut = ["M5_nut", 5, 9.2, 4, 6.25, M5_washer, M5_nut_depth];
M6_nut = ["M6_nut", 6, 11.5, 5, 8, M6_washer, M6_nut_depth];
M6_half_nut = ["M6_half_nut", 6, 11.5, 3, 8, M6_washer, 3];
M8_nut = ["M8_nut", 8, 15, 6.5, 8, M8_washer, M8_nut_depth];
toggle_nut = ["toggle_nut", 6.1, 9.2, 1.5, 1.5, M6_washer, 1.5];
M4_wingnut = ["M4_wingnut", 4, 10, 3.75,8, M4_washer, 0, 22, 10, 6, 3];
M4_wingnut = ["M4_wingnut", 4, 10, 3.75,8, M4_washer, 0, 22, 10, 6, 3];
// sx ty1 ty2 tz
M3_sliding_t_nut = ["M3_sliding_t_nut", 3, 6, 4.0, 0, M3_washer, 0, 10, 10, 6, 3];
M4_sliding_t_nut = ["M4_sliding_t_nut", 4, 6, 4.5, 0, M4_washer, 0, 11, 10, 6, 3.25];
M5_sliding_t_nut = ["M5_sliding_t_nut", 5, 6, 4.5, 0, M5_washer, 0, 11, 10, 7, 3.25];
M3_hammer_nut = ["M3_hammer_nut", 3, 6, 4.0, 0, M3_washer, 0, 5.5, 10, 6, 2.75];
M4_hammer_nut = ["M4_hammer_nut", 4, 6, 4.5, 0, M4_washer, 0, 5.5, 10, 6, 3.25];
// sx ty1 ty2
M3_sliding_t_nut = ["M3_sliding_t_nut", 3, 6, 3.0, 4.0, false, 0, 10, 10, 6];
M4_sliding_t_nut = ["M4_sliding_t_nut", 4, 6, 3.25,4.5, false, 0, 11, 10, 6];
M5_sliding_t_nut = ["M5_sliding_t_nut", 5, 6, 3.25,4.5, false, 0, 11, 10, 7];
M3_hammer_nut = ["M3_hammer_nut", 3, 6, 2.75,4.0, false, 0, 5.5, 10, 6];
M4_hammer_nut = ["M4_hammer_nut", 4, 6, 3.25,4.5, false, 0, 5.5, 10, 6];
nuts = [M2_nut, M2p5_nut, M3_nut, M4_nut, M5_nut, M6_nut, M8_nut];

View File

@ -36,15 +36,15 @@ function sk_screw_separation(type) = type[9]; //! Separation of screws in the ba
module sk_bracket(type) { //! SK shaft support bracket
vitamin(str("sk_bracket(", type[0], "): SK", sk_diameter(type), " shaft support bracket"));
d = type[1];
h = type[2];
d = sk_diameter(type);
h = sk_hole_offset(type);
E = type[3];
W = type[4];
L = type[5];
F = type[6];
G = type[7];
W = sk_size(type)[0];
L = sk_size(type)[2];
F = sk_size(type)[1];
G = sk_base_height(type);
P = type[8];
B = type[9];
B = sk_screw_separation(type);
S = type[10];
bolthole_radius = type[11];
@ -93,24 +93,32 @@ module sk_bracket(type) { //! SK shaft support bracket
screw(M3_cap_screw, P - screw_head_height(M3_cap_screw) / 2 + eps);
}
module sk_bracket_assembly(type, screw_length = 16, screw_type = M5_cap_screw, nut_type = undef) { //! Assembly with fasteners in place
sk_bracket(type);
nut_type = is_undef(nut_type) ? screw_nut(screw_type) : nut_type;
module sk_bracket_hole_positions(type) { //! Place children at hole positions
for (x = [-sk_screw_separation(type), sk_screw_separation(type)])
translate([x / 2, sk_base_height(type) - sk_hole_offset(type), 0])
rotate([-90, 0, 0]) {
screw_and_washer(screw_type, screw_length);
translate_z(-screw_length + 2 * washer_thickness(screw_washer(screw_type)))
if(nut_type == M5_sliding_t_nut)
translate_z(nut_thickness(nut_type))
vflip()
sliding_t_nut(nut_type);
else
nut(nut_type)
washer(nut_washer(nut_type));
}
rotate([-90, 0, 0])
children();
}
module sk_bracket_assembly(type, part_thickness = 2, screw_type = M5_cap_screw, nut_type = undef) { //! Assembly with fasteners in place
sk_bracket(type);
screw_type = is_undef(screw_type) ? scs_screw(type) : screw_type;
screw_washer_thickness = washer_thickness(screw_washer(screw_type));
nut_type = is_undef(nut_type) ? screw_nut(screw_type) : nut_type;
nut_washer_type = nut_washer(nut_type);
nut_washer_thickness = nut_washer_type ? washer_thickness(nut_washer_type) : 0;
nut_offset = sk_base_height(type) + part_thickness;
screw_length = 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)
vflip()
if(!nut_washer_type)
sliding_t_nut(nut_type);
else
nut_and_washer(nut_type);
}
}