diff --git a/libtest.scad b/libtest.scad index 9a2228c..f923465 100644 --- a/libtest.scad +++ b/libtest.scad @@ -29,6 +29,7 @@ use use use use +use use use use @@ -147,11 +148,10 @@ translate([x5, cable_grommets_y + 250]) translate([950, 600]) box_test(); -translate([890, 730]) +translate([890, 750]) printed_boxes(); - -translate([850, 1300]) +translate([850, 1330]) bbox_test(); @@ -159,8 +159,9 @@ inserts_y = 0; nuts_y = inserts_y + 20; washers_y = nuts_y + 120; screws_y = washers_y + 120; -o_rings_y = screws_y + 130; -springs_y = o_rings_y + 20; +circlips_y = screws_y + 160; +springs_y = circlips_y + 20; +o_rings_y = springs_y; sealing_strip_y = springs_y + 20; tubings_y = sealing_strip_y + 20; pillars_y = tubings_y + 20; @@ -190,10 +191,13 @@ translate([x0, washers_y]) translate([x0, screws_y]) screws(); +translate([x0, circlips_y]) + circlips(); + translate([x0, o_rings_y]) o_rings(); -translate([x0, springs_y]) +translate([x0 + 20, springs_y]) springs(); translate([x0 + 50, sealing_strip_y]) @@ -208,7 +212,7 @@ translate([x0, pillars_y]) translate([x0, leadnuts_y ]) leadnuts(); -translate([x0 + 80, leadnuts_y]) +translate([x0 + 60, leadnuts_y]) ball_bearings(); translate([x0, pulleys_y]) @@ -376,7 +380,7 @@ translate([x4 + 150, belts_y + 58]) { translate([x4, rails_y + 130]) rails(); -translate([900, fans_y + 50]) +translate([800, fans_y]) cable_strips(); translate([x4, kp_pillow_blocks_y]) diff --git a/readme.md b/readme.md index bf50c4e..a79b70c 100644 --- a/readme.md +++ b/readme.md @@ -25,21 +25,21 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa Bulldogs Light_strips SCS_bearing_blocks Corner_block Hanging_hole Rounded_rectangle Buttons Linear_bearings SK_brackets Door_hinge Layout Sphere Cable_strips Mains_sockets SSRs Door_latch Maths Teardrops - Components Meter Screws Fan_guard Offset - D_connectors Microswitches Sealing_strip Fixing_block Quadrant - Displays Microview Sheets Flat_hinge Round - Extrusion_brackets Modules Spades Foot Rounded_cylinder - Extrusions Nuts Spools Handle Rounded_polygon - Fans O_ring Springs PCB_mount Sector - Fuseholder Opengrab Stepper_motors PSU_shroud Sweep - Geared_steppers PCB Toggles Printed_box Thread - Green_terminals PCBs Transformers Ribbon_clamp Tube - Hot_ends PSUs Tubings SSR_shroud - Hygrometer Pillars Variacs Screw_knob - IECs Pin_headers Veroboard Socket_box - Inserts Pulleys Washers Strap_handle - Jack Wire - Zipties + Circlips Meter Screws Fan_guard Offset + Components Microswitches Sealing_strip Fixing_block Quadrant + D_connectors Microview Sheets Flat_hinge Round + Displays Modules Spades Foot Rounded_cylinder + Extrusion_brackets Nuts Spools Handle Rounded_polygon + Extrusions O_ring Springs PCB_mount Sector + Fans Opengrab Stepper_motors PSU_shroud Sweep + Fuseholder PCB Toggles Printed_box Thread + Geared_steppers PCBs Transformers Ribbon_clamp Tube + Green_terminals PSUs Tubings SSR_shroud + Hot_ends Pillars Variacs Screw_knob + Hygrometer Pin_headers Veroboard Socket_box + IECs Pulleys Washers Strap_handle + Inserts Wire + Jack Zipties --- @@ -385,6 +385,48 @@ When the sides are constrained then a circular model is more accurate. | 3 | ```cable_strip(20, 25, 100, 30)``` | Polypropylene strip 189mm x 24mm x 0.8mm | +Top + +--- + +## Circlips +Circlips aka tapered retaining rings. + + +[vitamins/circlips.scad](vitamins/circlips.scad) Object definitions. + +[vitamins/circlip.scad](vitamins/circlip.scad) Implementation. + +[tests/circlips.scad](tests/circlips.scad) Code for this example. + +### Properties +| Function | Description | +|:--- |:--- | +| ```circlip_a(type)``` | Size of the lugs | +| ```circlip_b(type)``` | Widest part of the taper | +| ```circlip_d1(type)``` | Nominal OD, i.e. diameter of tube | +| ```circlip_d2(type)``` | Groove diameter, i.e. OD when installed | +| ```circlip_d3(type)``` | Relaxed OD when not installed | +| ```circlip_d5(type)``` | Plier hole diameter | +| ```circlip_thickness(type)``` | Thickness | + +### Modules +| Module | Description | +|:--- |:--- | +| ```internal_circlip(type, open = 0)``` | Draw specified internal circlip, open = 0, for nominal size installed, 1 for relaxed uninstalled, -1 for squeezed to install | + +![circlips](tests/png/circlips.png) + +### Vitamins +| Qty | Module call | BOM entry | +| ---:|:--- |:---| +| 3 | ```circlip(circlip_12i)``` | Circlip internal 12mm | +| 3 | ```circlip(circlip_15i)``` | Circlip internal 15mm | +| 3 | ```circlip(circlip_19i)``` | Circlip internal 19mm | +| 3 | ```circlip(circlip_21i)``` | Circlip internal 21mm | +| 3 | ```circlip(circlip_28i)``` | Circlip internal 28mm | + + Top --- @@ -1687,6 +1729,7 @@ If a nut is given a child then it gets placed on its top surface. ### Properties | Function | Description | |:--- |:--- | +| ```nut_pitch(type)``` | Pitch if not standard metric course thread | | ```nut_radius(type)``` | Radius across the corners | | ```nut_size(type)``` | Diameter of the corresponding screw | | ```nut_square_size(type)``` | Diameter of the corresponding screw | @@ -2616,10 +2659,12 @@ SCSnUU and SCSnLUU bearing blocks | ```scs_bearing(type)``` | Linear bearing used | | ```scs_block_center_height(type)``` | Height of the center of the block | | ```scs_block_side_height(type)``` | Height of the side of the block, this determines the minimum screw length | +| ```scs_circlip(type)``` | Circlip used | | ```scs_hole_offset(type)``` | Offset of bearing hole from base of block | | ```scs_screw(type)``` | Screw type | | ```scs_screw_separation_x(type)``` | Screw separation in X direction | | ```scs_screw_separation_z(type)``` | Screw separation in Z direction | +| ```scs_spacer(type)``` | Spacer used in long bearings | ### Functions | Function | Description | @@ -4845,6 +4890,7 @@ Maths utilities for manipulating vectors and matrices. | ```euler(R)``` | Convert a rotation matrix to a Euler rotation vector. | | ```identity(n, x = 1)``` | Construct an arbitrary size identity matrix | | ```reverse(v)``` | Reverse a vector | +| ```rot3_z(a)``` | Generate a 3x3 matrix to rotate around z | | ```rotate(a, v)``` | Generate a 4x4 rotation matrix, ```a``` can be a vector of three angles or a single angle around ```z```, or around axis ```v``` | | ```scale(v)``` | Generate a 4x4 matrix that scales by ```v```, which can be a vector of xyz factors or a scalar to scale all axes equally | | ```transform(v, m)``` | Apply 4x4 transform to a 3 vector by extending it and cropping it again | diff --git a/tests/circlips.scad b/tests/circlips.scad new file mode 100644 index 0000000..98cdd54 --- /dev/null +++ b/tests/circlips.scad @@ -0,0 +1,40 @@ +// +// 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 . +// +include <../core.scad> +use <../utils/layout.scad> + +include <../vitamins/circlips.scad> + +module circlips(all = false) + layout([for(c = circlips) circlip_d3(c)], 10, false) let(c = circlips[$i]) { + gap = circlip_d3(c) + 2; + + internal_circlip(c, 1); + + if(all) { + translate([0, gap]) + internal_circlip(c, 0); + + translate([0, 2 * gap]) + internal_circlip(c, -1); + } + } + +if($preview) + circlips(true); diff --git a/tests/components.scad b/tests/components.scad index a074148..3c67338 100644 --- a/tests/components.scad +++ b/tests/components.scad @@ -26,14 +26,13 @@ module resistors() resistor(resistors[$i]); module al_clad_resistors() - layout([for(a = al_clad_resistors) al_clad_width(a)]) + layout([for(a = al_clad_resistors) al_clad_width(a)], 5, true) rotate(90) al_clad_resistor_assembly(al_clad_resistors[$i], 4.7) screw(al_clad_hole(al_clad_resistors[$i]) > 3 ? M3_pan_screw : M2p5_pan_screw, 16); - module thermal_cutouts() - layout([for(t = thermal_cutouts) tc_length(t)]) + layout([for(t = thermal_cutouts) tc_length(t)], 5, true) thermal_cutout(thermal_cutouts[$i]); module components() { @@ -42,7 +41,7 @@ module components() { translate([0, 50]) TO220("Generic TO220 package"); - translate([30, 50]) + translate([50, 50]) panel_USBA(); translate([0,80]) diff --git a/tests/png/circlips.png b/tests/png/circlips.png new file mode 100644 index 0000000..9e49b62 Binary files /dev/null and b/tests/png/circlips.png differ diff --git a/tests/png/components.png b/tests/png/components.png index f604cd5..3f5dd85 100644 Binary files a/tests/png/components.png and b/tests/png/components.png differ diff --git a/utils/maths.scad b/utils/maths.scad index 176cda2..1801fd3 100644 --- a/utils/maths.scad +++ b/utils/maths.scad @@ -56,6 +56,13 @@ function rotate(a, v) = //! Generate a 4x4 rotation matrix, ```a``` can be a vec [ 0, 0, 0, 1] ]; +function rot3_z(a) = //! Generate a 3x3 matrix to rotate around z + let(c = cos(a), + s = sin(a)) + [ [ c, -s, 0], + [ s, c, 0], + [ 0, 0, 1] ]; + function scale(v) = let(s = is_list(v) ? v : [v, v, v]) //! Generate a 4x4 matrix that scales by ```v```, which can be a vector of xyz factors or a scalar to scale all axes equally [ [s.x, 0, 0, 0], diff --git a/vitamins/circlip.scad b/vitamins/circlip.scad new file mode 100644 index 0000000..a83d43c --- /dev/null +++ b/vitamins/circlip.scad @@ -0,0 +1,90 @@ +// +// 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 . +// + +// +//! Circlips aka tapered retaining rings. +// +include <../utils/core/core.scad> +include <../utils/sector.scad> +include <../utils/round.scad> +include <../utils/maths.scad> + +function circlip_d1(type) = type[1]; //! Nominal OD, i.e. diameter of tube +function circlip_d2(type) = type[2]; //! Groove diameter, i.e. OD when installed +function circlip_d3(type) = type[3]; //! Relaxed OD when not installed +function circlip_thickness(type) = type[4]; //! Thickness +function circlip_a(type) = type[5]; //! Size of the lugs +function circlip_b(type) = type[6]; //! Widest part of the taper +function circlip_d5(type) = type[7]; //! Plier hole diameter + +circlip_colour = grey20; +closed_angle = 25; + +module internal_circlip(type, open = 0) { //! Draw specified internal circlip, open = 0, for nominal size installed, 1 for relaxed uninstalled, -1 for squeezed to install + d1 = circlip_d1(type); + + vitamin(str("circlip(", type[0], "): Circlip internal ", d1, "mm")); + d3 = circlip_d3(type); + d2 = circlip_d2(type); + a = circlip_a(type); + b = circlip_b(type); + d5 = circlip_d5(type); + + od = lookup(open, [[-1, d1], [0, d2], [1, d3]]); + or = od / 2; + c = (d3 - d1); + + angle = (od - d1) / d1 * 360 + closed_angle; + tab_angle = 360 * a / PI / od; + p = [0, -or + b / 2, 1] * rot3_z(angle / 2 + tab_angle); + pitch = (or - a / 2); + y_offset = (sqr(p.x) + sqr(p.y) - sqr(or - b)) / (or - b - p.y) / 2; + ir = or - b + y_offset; + color(circlip_colour) + linear_extrude(height = circlip_thickness(type), center = true) + round((a - d5) / 5) + union() { + difference() { + circle(or); + + translate([0, -y_offset]) + circle(ir); + + sector(d3 / 2 + 1, 270 - angle / 2 - tab_angle, 270 + angle / 2 + tab_angle); + + } + for(side = [-1, 1]) + intersection() { + circle(or); + + rotate(side * (angle + tab_angle) / 2) + difference() { + hull() { + translate([0, -pitch]) + circle(d = a); + + translate([0, -pitch - a]) + circle(d = 1.5 * a); + } + translate([0, -pitch]) + circle(d = d5); + } + } + } +} diff --git a/vitamins/circlips.scad b/vitamins/circlips.scad new file mode 100644 index 0000000..2e70902 --- /dev/null +++ b/vitamins/circlips.scad @@ -0,0 +1,28 @@ +// +// 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 . +// +// d1 d2 d3 s a b d5 +circlip_12i = ["circlip_12i", 12, 12.5, 13.0, 1.0, 3.4, 1.7, 1.5]; +circlip_15i = ["circlip_15i", 15, 15.7, 16.2, 1.0, 3.7, 2.0, 1.7]; +circlip_19i = ["circlip_19i", 19, 20.0, 20.5, 1.0, 4.1, 2.2, 2.0]; +circlip_21i = ["circlip_21i", 21, 22.0, 22.5, 1.0, 4.2, 2.4, 2.0]; +circlip_28i = ["circlip_28i", 28, 29.4, 30.1, 1.2, 4.8, 2.9, 2.0]; + +circlips = [circlip_12i, circlip_15i, circlip_19i, circlip_21i, circlip_28i]; + +use