From 34bb2e74fdfb35bb7d77e13bec331b798721e1f4 Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Mon, 19 Jun 2023 20:51:31 -0700 Subject: [PATCH 1/2] Fixed edge_profile() orientations. --- attachments.scad | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/attachments.scad b/attachments.scad index 835c3f6..c5ab43c 100644 --- a/attachments.scad +++ b/attachments.scad @@ -1722,11 +1722,26 @@ module face_profile(faces=[], r, d, excess=0.01, convexity=10) { // `$idx` is set to the index number of each edge. // `$attach_anchor` is set for each edge given, to the `[ANCHOR, POSITION, ORIENT, SPIN]` information for that anchor. // `$profile_type` is set to `"edge"`. +// `$edge_angle` is set to the inner angle of the current edge. // Example: // diff() // cube([50,60,70],center=true) // edge_profile([TOP,"Z"],except=[BACK,TOP+LEFT]) // mask2d_roundover(r=10, inset=2); +// Example: Using $edge_angle on a Conoid +// diff() +// cyl(d1=50, d2=30, l=40, anchor=BOT) { +// edge_profile([TOP,BOT], excess=10, convexity=6) { +// mask2d_roundover(r=8, inset=1, excess=1, mask_angle=$edge_angle); +// } +// } +// Example: Using $edge_angle on a Prismoid +// diff() +// prismoid([60,50],[30,20],h=40,shift=[-25,15]) { +// edge_profile(excess=10, convexity=20) { +// mask2d_roundover(r=5,inset=1,mask_angle=$edge_angle); +// } +// } module edge_profile(edges=EDGES_ALL, except=[], excess=0.01, convexity=10) { req_children($children); @@ -1768,9 +1783,9 @@ module edge_profile(edges=EDGES_ALL, except=[], excess=0.01, convexity=10) { if (!approx(pt1,pt2)) { seglen = norm(pt2-pt1) + 2 * excess; move(cp) { - frame_map(y=-v1, z=unit(pt2-pt1)) { + frame_map(x=-v2, z=unit(pt2-pt1)) { linear_extrude(height=seglen, center=true, convexity=convexity) - children(); + mirror([-1,1]) children(); } } } From cdbfe0217c1db1ab516db06f6bd6661586d037d6 Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Mon, 19 Jun 2023 22:36:13 -0700 Subject: [PATCH 2/2] Corrected helical gear twist calculation. --- gears.scad | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gears.scad b/gears.scad index ba1621b..eb7b7be 100644 --- a/gears.scad +++ b/gears.scad @@ -198,7 +198,7 @@ function spur_gear( p = pitch_radius(pitch, teeth), c = outer_radius(pitch, teeth, clearance, interior), r = _root_radius(pitch, teeth, clearance, interior), - twist = atan2(thickness*tan(helical),p), + twist = 360*thickness*tan(helical)/(2*PI*p), rgn = [ spur_gear2d( pitch = pitch, @@ -237,7 +237,7 @@ module spur_gear( p = pitch_radius(pitch, teeth); c = outer_radius(pitch, teeth, clearance, interior); r = _root_radius(pitch, teeth, clearance, interior); - twist = atan2(thickness*tan(helical),p); + twist = 360*thickness*tan(helical)/(2*PI*p); attachable(anchor,spin,orient, r=p, l=thickness) { zrot(twist/2) linear_extrude(