1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-15 11:54:02 +02:00

Fixed bugs in poly_ring() and insert_boss().

IEC screw length fixed at 10 if inserts used.
This commit is contained in:
Chris Palmer
2019-06-16 17:07:02 +01:00
parent 7eaace0194
commit 757e88ed0c
13 changed files with 49 additions and 29 deletions

View File

@@ -23,9 +23,9 @@
//!
//! The module provides `poly_circle()`, `poly_cylinder()` and `poly_ring()` that is useful for making printed washers and pillars.
//
function sides(r) = max(round(4 * r), 3); //! Optimium number of sides for specified radius
function corrected_radius(r, n = 0) = r / cos(180 / (n ? n : sides(r))); //! Adjusted radius to make flats lie on the circle
function corrected_diameter(d, n = 0) = d / cos(180 / (n ? n : sides(d / 2))); //! Adjusted diameter to make flats lie on the circle
function sides(r) = max(round(4 * r), 3); //! Optimium number of sides for specified radius
function corrected_radius(r, n = 0) = r / cos(180 / (n ? n : sides(r))); //! Adjusted radius to make flats lie on the circle
function corrected_diameter(d, n = 0) = d / cos(180 / (n ? n : sides(d / 2))); //! Adjusted diameter to make flats lie on the circle
module poly_circle(r, sides = 0) { //! Make a circle adjusted to print the correct size
n = sides ? sides : sides(r);
@@ -38,8 +38,8 @@ module poly_cylinder(r, h, center = false, sides = 0) //! Make a cylinder adjust
module poly_ring(or, ir) { //! Make a 2D ring adjusted to have the correct internal radius
cir = corrected_radius(ir);
filaments = floor((or - cir) / extrusion_width);
if(filaments > 3)
filaments = (or - cir) / extrusion_width;
if(filaments > 3 + eps)
difference() {
circle(or);