diff --git a/attachments.scad b/attachments.scad index 7a9da05..412c8c7 100644 --- a/attachments.scad +++ b/attachments.scad @@ -1723,11 +1723,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); @@ -1769,9 +1784,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(); } } } diff --git a/gears.scad b/gears.scad index 516ace4..9b966db 100644 --- a/gears.scad +++ b/gears.scad @@ -203,7 +203,7 @@ function spur_gear( p = pitch_radius(pitch, teeth), c = outer_radius(pitch, teeth, clearance, internal), r = _root_radius(pitch, teeth, clearance, internal), - twist = atan2(thickness*tan(helical),p), + twist = 360*thickness*tan(helical)/(2*PI*p), rgn = [ spur_gear2d( pitch = pitch, @@ -245,7 +245,7 @@ module spur_gear( p = pitch_radius(pitch, teeth); c = outer_radius(pitch, teeth, clearance, internal); r = _root_radius(pitch, teeth, clearance, internal); - twist = atan2(thickness*tan(helical),p); + twist = 360*thickness*tan(helical)/(2*PI*p); default_tag("remove", internal) attachable(anchor,spin,orient, r=p, l=thickness) { zrot(twist/2) @@ -268,7 +268,7 @@ module spur_gear( circle(r=shaft_diam/2, $fn=max(12,segs(shaft_diam/2))); } } - } + } children(); } }