From 1dca024e647d0117f920d77cecf3e93fe4432dfd Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Sun, 23 Feb 2020 18:15:25 +0000 Subject: [PATCH 1/4] Internal and external corner brackets for 20nn extrusion. --- tests/extrusionBracket.scad | 61 +++++++++++++++++ vitamins/extrusionBracket.scad | 115 +++++++++++++++++++++++++++++++++ 2 files changed, 176 insertions(+) create mode 100644 tests/extrusionBracket.scad create mode 100644 vitamins/extrusionBracket.scad diff --git a/tests/extrusionBracket.scad b/tests/extrusionBracket.scad new file mode 100644 index 0000000..c17aaa9 --- /dev/null +++ b/tests/extrusionBracket.scad @@ -0,0 +1,61 @@ +// +// NopSCADlib Copyright Chris Palmer 2018 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../core.scad> + +use <../vitamins/extrusionBracket.scad> +include <../vitamins/extrusions.scad> +include <../vitamins/washers.scad> +include <../vitamins/nuts.scad> + +module extrusionBrackets() { + extrusion20InnerCornerBracket(); + + translate([30, 0]) + extrusion20InnerCornerBracket(grubScrews = false); + + translate([60, 0]) + extrusion20CornerBracket_assembly(); + + eWidth = extrusion_width(E2020); + + translate([0, 60]) { + extrusion20InnerCornerBracket(); + translate([-eWidth / 2, 0, 0]) + rotate([-90, 0, 0]) + extrusion(E2020, 20); + translate([-eWidth, -eWidth / 2, 0]) + rotate([0, 90, 0]) + extrusion(E2020, 40); + } + + translate([60, 60]) { + extrusion20CornerBracket_assembly(); + translate([-eWidth / 2, 0, 0]) + rotate([-90, 0, 0]) + extrusion(E2020, 30); + translate([-eWidth, -eWidth / 2, 0]) + rotate([0, 90, 0]) + extrusion(E2020, 50); + } +} + +if($preview) + let($show_threads = true) + extrusionBrackets(); + diff --git a/vitamins/extrusionBracket.scad b/vitamins/extrusionBracket.scad new file mode 100644 index 0000000..9001f1d --- /dev/null +++ b/vitamins/extrusionBracket.scad @@ -0,0 +1,115 @@ +include +include +include + + +module extrusion20InnerCornerBracket(grubScrews = true) { //! Inner corner bracket for 20mm extrusion + vitamin(str("extrusion20InnerCornerBracket(): Extrusion20 inner corner bracket")); + + size = [25, 25, 4.5]; + armLength = size.x; + bottomTabOffset = 4; + topTabOffset = 10; + sizeBottom = [armLength - bottomTabOffset, 6, size.z]; + sizeTop = [armLength - topTabOffset, 6, size.z]; + tabSizeY1 = 10; + tabSizeY2 = 6; + tabSizeZ = 3.25; + holeRadius = M4_tap_radius; + + translate([-size.z - 0.75, -size.z - 0.75, 0]) + rotate([-90, 0, 0]) { + color("silver") { + translate([(armLength + bottomTabOffset) / 2, 0, tabSizeZ]) + rotate([0, 180, 0]) + extrusionSlidingNut(sizeBottom, tabSizeY1, tabSizeY2, tabSizeZ, holeRadius, (bottomTabOffset - armLength) / 2 + 5); + translate([tabSizeZ, 0, (armLength + topTabOffset) / 2]) + rotate([0, -90, 0]) + extrusionSlidingNut(sizeTop, tabSizeY1, tabSizeY2, tabSizeZ, holeRadius,-(topTabOffset - armLength) / 2 - 5); + translate([0, -size.z / 2, 0]) { + cube([bottomTabOffset, size.z, size.z]); + cube([size.z, size.z, topTabOffset]); + } + } + if(grubScrews) + not_on_bom() no_explode() { + grubScrewLength = 6; + for(angle = [[0, 0, 0], [0, -90, 180]]) + rotate(angle) + translate([armLength - 5, 0, size.z]) + screw(M3_grub_screw, grubScrewLength); + } + } +} + +function extrusion20CornerBracket_base_thickness() = 2; +function extrusion20CornerBracket_hole_offset() = 19.5; + +module extrusion20CornerBracket() { //! Corner bracket for 20mm extrusion + vitamin(str("extrusion20CornerBracket(): Extrusion20 corner bracket")); + + eSize = 20; + cbSize = 28; + baseThickness = extrusion20CornerBracket_base_thickness(); + + module base() { + linear_extrude(baseThickness) + difference() { + translate([0, -eSize / 2, 0]) + square([cbSize, eSize]); + hull() { + translate([extrusion20CornerBracket_hole_offset() + 1.5, 0, 0]) + circle(r = M5_clearance_radius); + translate([extrusion20CornerBracket_hole_offset() - 1.5, 0, 0]) + circle(r = M5_clearance_radius); + } + } + } + + color("silver") { + rotate([90, 0, 90]) + base(); + translate([0, baseThickness, 0]) + rotate([90, 0, 0]) + base(); + sideThickness = 3; + for(z = [-eSize / 2, eSize / 2 - sideThickness]) { + translate_z(z) { + right_triangle(cbSize, cbSize, sideThickness, center = false); + cube([5, cbSize, sideThickness]); + cube([cbSize, 5, sideThickness]); + } + } + } +} + +module extrusion20CornerBracket_hole_positions() { //! Place children at hole positions + for(angle = [ [0, 90, 0], [-90, -90, 0] ]) + rotate(angle) + translate([0, extrusion20CornerBracket_hole_offset(), extrusion20CornerBracket_base_thickness()]) + children(); +} + +module extrusion20CornerBracket_assembly(part_thickness = 2, screw_type = M4_cap_screw, nut_type = M4_sliding_t_nut, max_screw_depth = 6) { //! Assembly with fasteners in place + extrusion20CornerBracket(); + + screw_washer_thickness = washer_thickness(screw_washer(screw_type)); + nut_washer_type = nut_washer(nut_type); + nut_washer_thickness = nut_washer_type ? washer_thickness(nut_washer_type) : 0; + + nut_offset = extrusion20CornerBracket_base_thickness() + part_thickness; + screw_length = max_screw_depth ? screw_shorter_than(extrusion20CornerBracket_base_thickness() + screw_washer_thickness + max_screw_depth) + : screw_longer_than(nut_offset + screw_washer_thickness + nut_washer_thickness + nut_thickness(nut_type)); + + extrusion20CornerBracket_hole_positions() { + screw_and_washer(screw_type, screw_length); + translate_z(-nut_offset) + vflip() + if(nut_washer_type) + nut_and_washer(nut_type); + else + rotate(90) + sliding_t_nut(nut_type); + } +} + From 8342ba87e9011e7b0039dd186a8da08dc12cf4fd Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Tue, 25 Feb 2020 21:07:29 +0000 Subject: [PATCH 2/4] Update as per code review. --- tests/{extrusionBracket.scad => extrusion_bracket.scad} | 2 +- vitamins/{extrusionBracket.scad => extrusion_bracket.scad} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename tests/{extrusionBracket.scad => extrusion_bracket.scad} (97%) rename vitamins/{extrusionBracket.scad => extrusion_bracket.scad} (96%) diff --git a/tests/extrusionBracket.scad b/tests/extrusion_bracket.scad similarity index 97% rename from tests/extrusionBracket.scad rename to tests/extrusion_bracket.scad index c17aaa9..49ea668 100644 --- a/tests/extrusionBracket.scad +++ b/tests/extrusion_bracket.scad @@ -18,7 +18,7 @@ // include <../core.scad> -use <../vitamins/extrusionBracket.scad> +use <../vitamins/extrusion_bracket.scad> include <../vitamins/extrusions.scad> include <../vitamins/washers.scad> include <../vitamins/nuts.scad> diff --git a/vitamins/extrusionBracket.scad b/vitamins/extrusion_bracket.scad similarity index 96% rename from vitamins/extrusionBracket.scad rename to vitamins/extrusion_bracket.scad index 9001f1d..bae40b4 100644 --- a/vitamins/extrusionBracket.scad +++ b/vitamins/extrusion_bracket.scad @@ -42,8 +42,8 @@ module extrusion20InnerCornerBracket(grubScrews = true) { //! Inner corner brack } } -function extrusion20CornerBracket_base_thickness() = 2; -function extrusion20CornerBracket_hole_offset() = 19.5; +function extrusion20CornerBracket_base_thickness() = 2; //! Thickness of base of bracket +function extrusion20CornerBracket_hole_offset() = 19.5; //! Hole offset from corner module extrusion20CornerBracket() { //! Corner bracket for 20mm extrusion vitamin(str("extrusion20CornerBracket(): Extrusion20 corner bracket")); From e0dd17401023474ce5cf581858c130d71df4dd78 Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Tue, 25 Feb 2020 22:19:20 +0000 Subject: [PATCH 3/4] Parameterisation of extrusion brackets. --- ...n_bracket.scad => extrusion_brackets.scad} | 16 +++---- vitamins/extrusion_bracket.scad | 46 ++++++++++--------- vitamins/extrusion_brackets.scad | 29 ++++++++++++ 3 files changed, 62 insertions(+), 29 deletions(-) rename tests/{extrusion_bracket.scad => extrusion_brackets.scad} (76%) create mode 100644 vitamins/extrusion_brackets.scad diff --git a/tests/extrusion_bracket.scad b/tests/extrusion_brackets.scad similarity index 76% rename from tests/extrusion_bracket.scad rename to tests/extrusion_brackets.scad index 49ea668..3dc7eb4 100644 --- a/tests/extrusion_bracket.scad +++ b/tests/extrusion_brackets.scad @@ -18,24 +18,24 @@ // include <../core.scad> -use <../vitamins/extrusion_bracket.scad> +include <../vitamins/extrusion_brackets.scad> include <../vitamins/extrusions.scad> include <../vitamins/washers.scad> include <../vitamins/nuts.scad> -module extrusionBrackets() { - extrusion20InnerCornerBracket(); +module extrusion_brackets() { + extrusion_inner_corner_bracket(extrusion_inner_corner_bracket); translate([30, 0]) - extrusion20InnerCornerBracket(grubScrews = false); + extrusion_inner_corner_bracket(extrusion_inner_corner_bracket, grub_screws = false); translate([60, 0]) - extrusion20CornerBracket_assembly(); + extrusion_corner_bracket_assembly(extrusion_corner_bracket); eWidth = extrusion_width(E2020); translate([0, 60]) { - extrusion20InnerCornerBracket(); + extrusion_inner_corner_bracket(extrusion_inner_corner_bracket); translate([-eWidth / 2, 0, 0]) rotate([-90, 0, 0]) extrusion(E2020, 20); @@ -45,7 +45,7 @@ module extrusionBrackets() { } translate([60, 60]) { - extrusion20CornerBracket_assembly(); + extrusion_corner_bracket_assembly(extrusion_corner_bracket); translate([-eWidth / 2, 0, 0]) rotate([-90, 0, 0]) extrusion(E2020, 30); @@ -57,5 +57,5 @@ module extrusionBrackets() { if($preview) let($show_threads = true) - extrusionBrackets(); + extrusion_brackets(); diff --git a/vitamins/extrusion_bracket.scad b/vitamins/extrusion_bracket.scad index bae40b4..4cab760 100644 --- a/vitamins/extrusion_bracket.scad +++ b/vitamins/extrusion_bracket.scad @@ -2,11 +2,12 @@ include include include +function extrusion_inner_corner_racket_size(type) = type[1]; //! Size of bracket -module extrusion20InnerCornerBracket(grubScrews = true) { //! Inner corner bracket for 20mm extrusion - vitamin(str("extrusion20InnerCornerBracket(): Extrusion20 inner corner bracket")); +module extrusion_inner_corner_bracket(type, grub_screws = true) { //! Inner corner bracket for extrusion + vitamin(str("extrusion_inner_corner_bracket(", type[0], ", ", grub_screws, "): Extrusion inner corner bracket ", type[1].z)); - size = [25, 25, 4.5]; + size = extrusion_inner_corner_racket_size(type); armLength = size.x; bottomTabOffset = 4; topTabOffset = 10; @@ -31,7 +32,7 @@ module extrusion20InnerCornerBracket(grubScrews = true) { //! Inner corner brack cube([size.z, size.z, topTabOffset]); } } - if(grubScrews) + if(grub_screws) not_on_bom() no_explode() { grubScrewLength = 6; for(angle = [[0, 0, 0], [0, -90, 180]]) @@ -42,15 +43,18 @@ module extrusion20InnerCornerBracket(grubScrews = true) { //! Inner corner brack } } -function extrusion20CornerBracket_base_thickness() = 2; //! Thickness of base of bracket -function extrusion20CornerBracket_hole_offset() = 19.5; //! Hole offset from corner +function extrusion_corner_bracket_size(type) = type[1]; //! Size of bracket +function extrusion_corner_bracket_base_thickness(type) = type[2]; //! Thickness of base of bracket +function extrusion_corner_bracket_side_thickness(type) = type[3]; //! Thickness of side of bracket +function extrusion_corner_bracket_hole_offset(type) = type[4]; //! Hole offset from corner -module extrusion20CornerBracket() { //! Corner bracket for 20mm extrusion - vitamin(str("extrusion20CornerBracket(): Extrusion20 corner bracket")); +module extrusion_corner_bracket(type) { //! Corner bracket for extrusion +echo(type=type); + vitamin(str("extrusion_corner_bracket(", type[0], "): Extrusion corner bracket ", type[1].z)); - eSize = 20; - cbSize = 28; - baseThickness = extrusion20CornerBracket_base_thickness(); + eSize = extrusion_corner_bracket_size(type).z; + cbSize = extrusion_corner_bracket_size(type).x; + baseThickness = extrusion_corner_bracket_base_thickness(type); module base() { linear_extrude(baseThickness) @@ -58,9 +62,9 @@ module extrusion20CornerBracket() { //! Corner bracket for 20mm extrusion translate([0, -eSize / 2, 0]) square([cbSize, eSize]); hull() { - translate([extrusion20CornerBracket_hole_offset() + 1.5, 0, 0]) + translate([extrusion_corner_bracket_hole_offset(type) + 1.5, 0, 0]) circle(r = M5_clearance_radius); - translate([extrusion20CornerBracket_hole_offset() - 1.5, 0, 0]) + translate([extrusion_corner_bracket_hole_offset(type) - 1.5, 0, 0]) circle(r = M5_clearance_radius); } } @@ -72,7 +76,7 @@ module extrusion20CornerBracket() { //! Corner bracket for 20mm extrusion translate([0, baseThickness, 0]) rotate([90, 0, 0]) base(); - sideThickness = 3; + sideThickness = extrusion_corner_bracket_side_thickness(type); for(z = [-eSize / 2, eSize / 2 - sideThickness]) { translate_z(z) { right_triangle(cbSize, cbSize, sideThickness, center = false); @@ -83,25 +87,25 @@ module extrusion20CornerBracket() { //! Corner bracket for 20mm extrusion } } -module extrusion20CornerBracket_hole_positions() { //! Place children at hole positions +module extrusion_corner_bracket_hole_positions(type) { //! Place children at hole positions for(angle = [ [0, 90, 0], [-90, -90, 0] ]) rotate(angle) - translate([0, extrusion20CornerBracket_hole_offset(), extrusion20CornerBracket_base_thickness()]) + translate([0, extrusion_corner_bracket_hole_offset(type), extrusion_corner_bracket_base_thickness(type)]) children(); } -module extrusion20CornerBracket_assembly(part_thickness = 2, screw_type = M4_cap_screw, nut_type = M4_sliding_t_nut, max_screw_depth = 6) { //! Assembly with fasteners in place - extrusion20CornerBracket(); +module extrusion_corner_bracket_assembly(type, part_thickness = 2, screw_type = M4_cap_screw, nut_type = M4_sliding_t_nut, max_screw_depth = 6) { //! Assembly with fasteners in place + extrusion_corner_bracket(type); screw_washer_thickness = washer_thickness(screw_washer(screw_type)); nut_washer_type = nut_washer(nut_type); nut_washer_thickness = nut_washer_type ? washer_thickness(nut_washer_type) : 0; - nut_offset = extrusion20CornerBracket_base_thickness() + part_thickness; - screw_length = max_screw_depth ? screw_shorter_than(extrusion20CornerBracket_base_thickness() + screw_washer_thickness + max_screw_depth) + nut_offset = extrusion_corner_bracket_base_thickness(type) + part_thickness; + screw_length = max_screw_depth ? screw_shorter_than(extrusion_corner_bracket_base_thickness(type) + screw_washer_thickness + max_screw_depth) : screw_longer_than(nut_offset + screw_washer_thickness + nut_washer_thickness + nut_thickness(nut_type)); - extrusion20CornerBracket_hole_positions() { + extrusion_corner_bracket_hole_positions(type) { screw_and_washer(screw_type, screw_length); translate_z(-nut_offset) vflip() diff --git a/vitamins/extrusion_brackets.scad b/vitamins/extrusion_brackets.scad new file mode 100644 index 0000000..612be37 --- /dev/null +++ b/vitamins/extrusion_brackets.scad @@ -0,0 +1,29 @@ +// +// NopSCADlib Copyright Chris Palmer 2020 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +// +// Extrusion brackets +// + +extrusion_inner_corner_bracket = [ "E20_inner_corner_bracket", [25, 25, 4.5] ]; + +extrusion_corner_bracket = [ "E20_corner_bracket", [28, 28, 20], 2, 3, 19.5]; + + +use + From 1668f9c54c4d68351dae82bc42562f437008ffc3 Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Tue, 25 Feb 2020 22:23:44 +0000 Subject: [PATCH 4/4] Naming update. --- tests/extrusion_brackets.scad | 10 +++++----- vitamins/extrusion_brackets.scad | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/extrusion_brackets.scad b/tests/extrusion_brackets.scad index 3dc7eb4..acb4d04 100644 --- a/tests/extrusion_brackets.scad +++ b/tests/extrusion_brackets.scad @@ -24,18 +24,18 @@ include <../vitamins/washers.scad> include <../vitamins/nuts.scad> module extrusion_brackets() { - extrusion_inner_corner_bracket(extrusion_inner_corner_bracket); + extrusion_inner_corner_bracket(E20_inner_corner_bracket); translate([30, 0]) - extrusion_inner_corner_bracket(extrusion_inner_corner_bracket, grub_screws = false); + extrusion_inner_corner_bracket(E20_inner_corner_bracket, grub_screws = false); translate([60, 0]) - extrusion_corner_bracket_assembly(extrusion_corner_bracket); + extrusion_corner_bracket_assembly(E20_corner_bracket); eWidth = extrusion_width(E2020); translate([0, 60]) { - extrusion_inner_corner_bracket(extrusion_inner_corner_bracket); + extrusion_inner_corner_bracket(E20_inner_corner_bracket); translate([-eWidth / 2, 0, 0]) rotate([-90, 0, 0]) extrusion(E2020, 20); @@ -45,7 +45,7 @@ module extrusion_brackets() { } translate([60, 60]) { - extrusion_corner_bracket_assembly(extrusion_corner_bracket); + extrusion_corner_bracket_assembly(E20_corner_bracket); translate([-eWidth / 2, 0, 0]) rotate([-90, 0, 0]) extrusion(E2020, 30); diff --git a/vitamins/extrusion_brackets.scad b/vitamins/extrusion_brackets.scad index 612be37..2c063f0 100644 --- a/vitamins/extrusion_brackets.scad +++ b/vitamins/extrusion_brackets.scad @@ -20,9 +20,9 @@ // Extrusion brackets // -extrusion_inner_corner_bracket = [ "E20_inner_corner_bracket", [25, 25, 4.5] ]; +E20_inner_corner_bracket = [ "E20_inner_corner_bracket", [25, 25, 4.5] ]; -extrusion_corner_bracket = [ "E20_corner_bracket", [28, 28, 20], 2, 3, 19.5]; +E20_corner_bracket = [ "E20_corner_bracket", [28, 28, 20], 2, 3, 19.5]; use