From dd5f41a20efdc1ce0651f4920bcbf9e4a032e362 Mon Sep 17 00:00:00 2001 From: Adrian Mariano Date: Tue, 29 Nov 2022 22:21:59 -0500 Subject: [PATCH] fixes for change in cylinder chamfer angle --- masks3d.scad | 18 ++++++++++++++++-- threading.scad | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/masks3d.scad b/masks3d.scad index db9e046..4d44a59 100644 --- a/masks3d.scad +++ b/masks3d.scad @@ -98,7 +98,7 @@ module chamfer_corner_mask(chamfer=1, anchor=CENTER, spin=0, orient=UP) { // chamfer = Size of the edge chamfered, inset from edge. // --- // d = Diameter of cylinder to chamfer. Use instead of r. -// ang = Angle of chamfer in degrees from vertical. (Default: 45) +// ang = Angle of chamfer in degrees from the horizontal. (Default: 45) // from_end = If true, chamfer size is measured from end of cylinder. If false, chamfer is measured outset from the radius of the cylinder. (Default: false) // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0` @@ -113,12 +113,26 @@ module chamfer_corner_mask(chamfer=1, anchor=CENTER, spin=0, orient=UP) { // cylinder(r=50, h=100, center=true); // up(50) chamfer_cylinder_mask(r=50, chamfer=10); // } +// Example: Changing the chamfer angle +// difference() { +// cylinder(r=50, h=100, center=true); +// up(50) #chamfer_cylinder_mask(r=50, chamfer=10, ang=70); +// } +// Example: +// difference() { +// cylinder(r=50, h=100, center=true); +// up(50) chamfer_cylinder_mask(r=50, chamfer=10, ang=70); +// } // Example: Masking by Attachment +// diff() +// cyl(d=100,h=40) +// attach([TOP,BOT]) +// tag("remove")chamfer_cylinder_mask(d=100, chamfer=10); function chamfer_cylinder_mask(r, chamfer, d, ang=45, from_end=false, anchor=CENTER, spin=0, orient=UP) = no_function("chamfer_cylinder_mask"); module chamfer_cylinder_mask(r, chamfer, d, ang=45, from_end=false, anchor=CENTER, spin=0, orient=UP) { r = get_radius(r=r, d=d, dflt=1); - ch = from_end? chamfer : opp_ang_to_adj(chamfer,ang); + ch = from_end? chamfer : opp_ang_to_adj(chamfer,90-ang); attachable(anchor,spin,orient, r=r, l=ch*2) { difference() { cyl(r=r+chamfer, l=ch*2, anchor=CENTER); diff --git a/threading.scad b/threading.scad index 45c602c..b7d5454 100644 --- a/threading.scad +++ b/threading.scad @@ -1429,7 +1429,7 @@ module _nutshape(nutwidth, h, shape, bevel1, bevel2) fn = quantup(segs(r=nutwidth/2),shape=="hex"?6:4); d = shape=="hex" ? 2*nutwidth/sqrt(3) : sqrt(2)*nutwidth; chamfsize = (d-nutwidth)/2/bevel_d; - cyl(d=d*.99,h=h+.01,realign=true,circum=true,$fn=fn,chamfer1=bevel1?chamfsize:0,chamfer2=bevel2?chamfsize:0,chamfang=90-30); + cyl(d=d*.99,h=h+.01,realign=true,circum=true,$fn=fn,chamfer1=bevel1?chamfsize:0,chamfer2=bevel2?chamfsize:0,chamfang=30); } }