1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-06 23:46:30 +02:00

Poly_ring now can have specified number of sides.

This commit is contained in:
Chris Palmer
2020-04-23 10:52:34 +01:00
parent c9d10eeb8b
commit 48293b9abd
2 changed files with 8 additions and 8 deletions

View File

@@ -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 | | ```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_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_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 | | ```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 | | ```slot(r, l, h = 100)``` | Make a horizontal slot suitable for CNC routing, set h = 0 for 2D version |

View File

@@ -36,29 +36,29 @@ module poly_cylinder(r, h, center = false, sides = 0) //! Make a cylinder adjust
extrude_if(h, center) extrude_if(h, center)
poly_circle(r, sides); poly_circle(r, sides);
module poly_ring(or, ir) { //! Make a 2D ring adjusted to have the correct internal radius module poly_ring(or, ir, sides = 0) { //! Make a 2D ring adjusted to have the correct internal radius
cir = corrected_radius(ir); cir = corrected_radius(ir, sides);
filaments = (or - cir) / extrusion_width; filaments = (or - cir) / extrusion_width;
if(filaments > 3 + eps) if(filaments > 3 + eps)
difference() { difference() {
circle(or); circle(or);
poly_circle(ir); poly_circle(ir, sides);
} }
else else
if(filaments >= 2) if(filaments >= 2)
difference() { difference() {
offset(or - cir) offset(or - cir)
poly_circle(ir); poly_circle(ir, sides);
poly_circle(ir); poly_circle(ir, sides);
} }
else else
difference() { difference() {
poly_circle(or); poly_circle(or, sides);
offset(-squeezed_wall) offset(-squeezed_wall)
poly_circle(or); poly_circle(or, sides);
} }
} }