From 48293b9abdc84d74f6efe7a601d053d3c8e91b32 Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Thu, 23 Apr 2020 10:52:34 +0100 Subject: [PATCH] Poly_ring now can have specified number of sides. --- readme.md | 2 +- utils/core/polyholes.scad | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/readme.md b/readme.md index 5aad303..5385fc5 100644 --- a/readme.md +++ b/readme.md @@ -5557,7 +5557,7 @@ The module provides `poly_circle()`, `poly_cylinder()` and `poly_ring()` that is | ```drill(r, h = 100)``` | Make a cylinder for drilling holes suitable for CNC routing, set h = 0 for circle | | ```poly_circle(r, sides = 0)``` | Make a circle adjusted to print the correct size | | ```poly_cylinder(r, h, center = false, sides = 0)``` | Make a cylinder adjusted to print the correct size | -| ```poly_ring(or, ir)``` | Make a 2D ring adjusted to have the correct internal radius | +| ```poly_ring(or, ir, sides = 0)``` | Make a 2D ring adjusted to have the correct internal radius | | ```poly_tube(or, ir, h, center = false)``` | Make a tube adjusted to have the correct internal radius | | ```slot(r, l, h = 100)``` | Make a horizontal slot suitable for CNC routing, set h = 0 for 2D version | diff --git a/utils/core/polyholes.scad b/utils/core/polyholes.scad index 7a16609..a115cb9 100644 --- a/utils/core/polyholes.scad +++ b/utils/core/polyholes.scad @@ -36,29 +36,29 @@ module poly_cylinder(r, h, center = false, sides = 0) //! Make a cylinder adjust extrude_if(h, center) poly_circle(r, sides); -module poly_ring(or, ir) { //! Make a 2D ring adjusted to have the correct internal radius - cir = corrected_radius(ir); +module poly_ring(or, ir, sides = 0) { //! Make a 2D ring adjusted to have the correct internal radius + cir = corrected_radius(ir, sides); filaments = (or - cir) / extrusion_width; if(filaments > 3 + eps) difference() { circle(or); - poly_circle(ir); + poly_circle(ir, sides); } else if(filaments >= 2) difference() { offset(or - cir) - poly_circle(ir); + poly_circle(ir, sides); - poly_circle(ir); + poly_circle(ir, sides); } else difference() { - poly_circle(or); + poly_circle(or, sides); offset(-squeezed_wall) - poly_circle(or); + poly_circle(or, sides); } }