diff --git a/attachments.scad b/attachments.scad index a5b1eb9..d20721c 100644 --- a/attachments.scad +++ b/attachments.scad @@ -9,7 +9,6 @@ // Default values for attachment code. -$slop = 0.20; $tags = ""; $overlap = 0.01; $color = undef; diff --git a/constants.scad b/constants.scad index 872ab6f..3879bf3 100644 --- a/constants.scad +++ b/constants.scad @@ -10,7 +10,7 @@ // Section: General Constants -PRINTER_SLOP = 0.20; // The printer specific amount of slop in mm to print with to make parts fit exactly. You may need to override this value for your printer. +$slop = 0.20; // The printer specific amount of slop in mm to print with to make parts fit exactly. You may need to override this value for your printer. diff --git a/joiners.scad b/joiners.scad index 4435042..ae0583d 100644 --- a/joiners.scad +++ b/joiners.scad @@ -58,7 +58,7 @@ module half_joiner_clear(h=20, w=10, a=30, clearance=0, overlap=0.01, anchor=CEN // Module: half_joiner() // Usage: -// half_joiner(h, w, l, [a], [screwsize], [guides], [slop]) +// half_joiner(h, w, l, [a], [screwsize], [guides], [$slop]) // Description: // Creates a half_joiner object that can be attached to half_joiner2 object. // Arguments: @@ -68,13 +68,13 @@ module half_joiner_clear(h=20, w=10, a=30, clearance=0, overlap=0.01, anchor=CEN // a = Overhang angle of the half_joiner. // screwsize = Diameter of screwhole. // guides = If true, create sliding alignment guides. -// slop = Printer specific slop value to make parts fit more closely. // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = Printer specific slop value to make parts fit more closely. // Example: // half_joiner(screwsize=3, spin=-90); -module half_joiner(h=20, w=10, l=10, a=30, screwsize=undef, guides=true, slop=PRINTER_SLOP, anchor=CENTER, spin=0, orient=UP) +module half_joiner(h=20, w=10, l=10, a=30, screwsize=undef, guides=true, anchor=CENTER, spin=0, orient=UP) { dmnd_height = h*1.0; dmnd_width = dmnd_height*tan(a); @@ -98,13 +98,13 @@ module half_joiner(h=20, w=10, l=10, a=30, screwsize=undef, guides=true, slop=PR // Clear diamond for tab grid3d(xa=[-(w*2/3), (w*2/3)]) { - half_joiner_clear(h=h+0.01, w=w, clearance=slop*2, a=a); + half_joiner_clear(h=h+0.01, w=w, clearance=$slop*2, a=a); } } difference() { // Make tab - scale([w/3-slop*2, dmnd_width/2, dmnd_height/2]) xrot(45) + scale([w/3-$slop*2, dmnd_width/2, dmnd_height/2]) xrot(45) cube(size=[1,sqrt(2),sqrt(2)], center=true); // Blunt point of tab. @@ -115,7 +115,7 @@ module half_joiner(h=20, w=10, l=10, a=30, screwsize=undef, guides=true, slop=PR // Guide ridges. if (guides == true) { - xspread(w/3-slop*2) { + xspread(w/3-$slop*2) { // Guide ridge. fwd(0.05/2) { scale([0.75, 1, 2]) yrot(45) @@ -180,7 +180,7 @@ module half_joiner2(h=20, w=10, l=10, a=30, screwsize=undef, guides=true, anchor } // Subtract mated half_joiner. - zrot(180) half_joiner(h=h+0.01, w=w+0.01, l=guide_width+0.01, a=a, screwsize=undef, guides=guides, slop=0.0); + zrot(180) half_joiner(h=h+0.01, w=w+0.01, l=guide_width+0.01, a=a, screwsize=undef, guides=guides, $slop=0.0); // Make screwholes, if needed. if (screwsize != undef) { @@ -230,7 +230,7 @@ module joiner_clear(h=40, w=10, a=30, clearance=0, overlap=0.01, anchor=CENTER, // Module: joiner() // Usage: -// joiner(h, w, l, [a], [screwsize], [guides], [slop]) +// joiner(h, w, l, [a], [screwsize], [guides], [$slop]) // Description: // Creates a joiner object that can be attached to another joiner object. // Arguments: @@ -240,14 +240,14 @@ module joiner_clear(h=40, w=10, a=30, clearance=0, overlap=0.01, anchor=CENTER, // a = Overhang angle of the joiner. // screwsize = Diameter of screwhole. // guides = If true, create sliding alignment guides. -// slop = Printer specific slop value to make parts fit more closely. // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = Printer specific slop value to make parts fit more closely. // Examples: // joiner(screwsize=3, spin=-90); // joiner(w=10, l=10, h=40, spin=-90) cuboid([10, 10*2, 40], anchor=RIGHT); -module joiner(h=40, w=10, l=10, a=30, screwsize=undef, guides=true, slop=PRINTER_SLOP, anchor=CENTER, spin=0, orient=UP) +module joiner(h=40, w=10, l=10, a=30, screwsize=undef, guides=true, anchor=CENTER, spin=0, orient=UP) { if ($children > 0) { difference() { @@ -257,7 +257,7 @@ module joiner(h=40, w=10, l=10, a=30, screwsize=undef, guides=true, slop=PRINTER } orient_and_anchor([w, 2*l, h], orient, anchor, spin=spin) { union() { - up(h/4) half_joiner(h=h/2, w=w, l=l, a=a, screwsize=screwsize, guides=guides, slop=slop); + up(h/4) half_joiner(h=h/2, w=w, l=l, a=a, screwsize=screwsize, guides=guides); down(h/4) half_joiner2(h=h/2, w=w, l=l, a=a, screwsize=screwsize, guides=guides); } } @@ -305,7 +305,7 @@ module joiner_pair_clear(spacing=100, h=40, w=10, a=30, n=2, clearance=0, overla // Module: joiner_pair() // Usage: -// joiner_pair(h, w, l, [a], [screwsize], [guides], [slop]) +// joiner_pair(h, w, l, [a], [screwsize], [guides], [$slop]) // Description: // Creates a joiner_pair object that can be attached to other joiner_pairs . // Arguments: @@ -318,17 +318,17 @@ module joiner_pair_clear(spacing=100, h=40, w=10, a=30, n=2, clearance=0, overla // alternate = If true (default), each joiner alternates it's orientation. If alternate is "alt", do opposite alternating orientations. // screwsize = Diameter of screwhole. // guides = If true, create sliding alignment guides. -// slop = Printer specific slop value to make parts fit more closely. // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = Printer specific slop value to make parts fit more closely. // Examples: // joiner_pair(spacing=50, l=10, spin=-90) cuboid([10, 50+10-0.1, 40], anchor=RIGHT); // joiner_pair(spacing=50, l=10, n=2, spin=-90); // joiner_pair(spacing=50, l=10, n=3, alternate=false, spin=-90); // joiner_pair(spacing=50, l=10, n=3, alternate=true, spin=-90); // joiner_pair(spacing=50, l=10, n=3, alternate="alt", spin=-90); -module joiner_pair(spacing=100, h=40, w=10, l=10, a=30, n=2, alternate=true, screwsize=undef, guides=true, slop=PRINTER_SLOP, anchor=CENTER, spin=0, orient=UP) +module joiner_pair(spacing=100, h=40, w=10, l=10, a=30, n=2, alternate=true, screwsize=undef, guides=true, anchor=CENTER, spin=0, orient=UP) { if ($children > 0) { difference() { @@ -341,7 +341,7 @@ module joiner_pair(spacing=100, h=40, w=10, l=10, a=30, n=2, alternate=true, scr for (i=[0:1:n-1]) { right(i*spacing) { yrot(180 + (alternate? (i*180+(alternate=="alt"?180:0))%360 : 0)) { - joiner(h=h, w=w, l=l, a=a, screwsize=screwsize, guides=guides, slop=slop); + joiner(h=h, w=w, l=l, a=a, screwsize=screwsize, guides=guides); } } } @@ -391,7 +391,7 @@ module joiner_quad_clear(xspacing=undef, yspacing=undef, spacing1=undef, spacing // Module: joiner_quad() // Usage: -// joiner_quad(h, w, l, [a], [screwsize], [guides], [slop]) +// joiner_quad(h, w, l, [a], [screwsize], [guides], [$slop]) // Description: // Creates a joiner_quad object that can be attached to other joiner_pairs . // Arguments: @@ -404,7 +404,7 @@ module joiner_quad_clear(xspacing=undef, yspacing=undef, spacing1=undef, spacing // alternate = If true (default), each joiner alternates it's orientation. If alternate is "alt", do opposite alternating orientations. // screwsize = Diameter of screwhole. // guides = If true, create sliding alignment guides. -// slop = Printer specific slop value to make parts fit more closely. +// $slop = Printer specific slop value to make parts fit more closely. // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` @@ -414,7 +414,7 @@ module joiner_quad_clear(xspacing=undef, yspacing=undef, spacing1=undef, spacing // joiner_quad(spacing1=50, spacing2=50, l=10, n=3, alternate=false, spin=-90); // joiner_quad(spacing1=50, spacing2=50, l=10, n=3, alternate=true, spin=-90); // joiner_quad(spacing1=50, spacing2=50, l=10, n=3, alternate="alt", spin=-90); -module joiner_quad(spacing1=undef, spacing2=undef, xspacing=undef, yspacing=undef, h=40, w=10, l=10, a=30, n=2, alternate=true, screwsize=undef, guides=true, slop=PRINTER_SLOP, anchor=CENTER, spin=0, orient=UP) +module joiner_quad(spacing1=undef, spacing2=undef, xspacing=undef, yspacing=undef, h=40, w=10, l=10, a=30, n=2, alternate=true, screwsize=undef, guides=true, anchor=CENTER, spin=0, orient=UP) { spacing1 = first_defined([spacing1, xspacing, 100]); spacing2 = first_defined([spacing2, yspacing, 50]); @@ -427,7 +427,7 @@ module joiner_quad(spacing1=undef, spacing2=undef, xspacing=undef, yspacing=unde orient_and_anchor([w+spacing1, spacing2, h], orient, anchor, spin=spin) { zrot_copies(n=2) { back(spacing2/2) { - joiner_pair(spacing=spacing1, n=n, h=h, w=w, l=l, a=a, screwsize=screwsize, guides=guides, slop=slop); + joiner_pair(spacing=spacing1, n=n, h=h, w=w, l=l, a=a, screwsize=screwsize, guides=guides); } } } diff --git a/nema_steppers.scad b/nema_steppers.scad index 02977b0..573f137 100644 --- a/nema_steppers.scad +++ b/nema_steppers.scad @@ -451,10 +451,10 @@ module nema34_stepper(h=75, shaft=12.7, shaft_len=32, anchor=TOP, spin=0, orient // size = The standard NEMA motor size to make a mount for. // depth = The thickness of the mounting hole mask. Default: 5 // l = The length of the slots, for making an adjustable motor mount. Default: 5 -// slop = The printer-specific slop value to make parts fit just right. Default: `PRINTER_SLOP` // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Extra Anchors: // "screw1" = The center top of the screw hole/slot in the X+Y+ quadrant. // "screw2" = The center top of the screw hole/slot in the X-Y+ quadrant. @@ -466,12 +466,12 @@ module nema34_stepper(h=75, shaft=12.7, shaft_len=32, anchor=TOP, spin=0, orient // nema_mount_holes(size=17, depth=5, l=5); // Example: // nema_mount_holes(size=17, depth=5, l=0); -module nema_mount_holes(size=17, depth=5, l=5, slop=PRINTER_SLOP, anchor=CENTER, spin=0, orient=UP) +module nema_mount_holes(size=17, depth=5, l=5, anchor=CENTER, spin=0, orient=UP) { motor_width = nema_motor_width(size); - plinth_diam = nema_motor_plinth_diam(size)+slop; + plinth_diam = nema_motor_plinth_diam(size)+$slop; screw_spacing = nema_motor_screw_spacing(size); - screw_size = nema_motor_screw_size(size)+slop; + screw_size = nema_motor_screw_size(size)+$slop; anchors = [ anchorpt("screw1", [+screw_spacing/2, +screw_spacing/2, depth/2]), @@ -515,10 +515,10 @@ module nema_mount_holes(size=17, depth=5, l=5, slop=PRINTER_SLOP, anchor=CENTER, // Arguments: // depth = The thickness of the mounting hole mask. Default: 5 // l = The length of the slots, for making an adjustable motor mount. Default: 5 -// slop = The printer-specific slop value to make parts fit just right. Default: `PRINTER_SLOP` // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Extra Anchors: // "screw1" = The center top of the screw hole/slot in the X+Y+ quadrant. // "screw2" = The center top of the screw hole/slot in the X-Y+ quadrant. @@ -528,9 +528,9 @@ module nema_mount_holes(size=17, depth=5, l=5, slop=PRINTER_SLOP, anchor=CENTER, // nema11_mount_holes(depth=5, l=5); // Example: // nema11_mount_holes(depth=5, l=0); -module nema11_mount_holes(depth=5, l=5, slop=PRINTER_SLOP, anchor=CENTER, spin=0, orient=UP) +module nema11_mount_holes(depth=5, l=5, anchor=CENTER, spin=0, orient=UP) { - nema_mount_holes(size=11, depth=depth, l=l, slop=slop, anchor=anchor, spin=spin, orient=orient) children(); + nema_mount_holes(size=11, depth=depth, l=l, anchor=anchor, spin=spin, orient=orient) children(); } @@ -540,10 +540,10 @@ module nema11_mount_holes(depth=5, l=5, slop=PRINTER_SLOP, anchor=CENTER, spin=0 // Arguments: // depth = The thickness of the mounting hole mask. Default: 5 // l = The length of the slots, for making an adjustable motor mount. Default: 5 -// slop = The printer-specific slop value to make parts fit just right. Default: `PRINTER_SLOP` // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Extra Anchors: // "screw1" = The center top of the screw hole/slot in the X+Y+ quadrant. // "screw2" = The center top of the screw hole/slot in the X-Y+ quadrant. @@ -553,9 +553,9 @@ module nema11_mount_holes(depth=5, l=5, slop=PRINTER_SLOP, anchor=CENTER, spin=0 // nema14_mount_holes(depth=5, l=5); // Example: // nema14_mount_holes(depth=5, l=0); -module nema14_mount_holes(depth=5, l=5, slop=PRINTER_SLOP, anchor=CENTER, spin=0, orient=UP) +module nema14_mount_holes(depth=5, l=5, anchor=CENTER, spin=0, orient=UP) { - nema_mount_holes(size=14, depth=depth, l=l, slop=slop, anchor=anchor, spin=spin, orient=orient) children(); + nema_mount_holes(size=14, depth=depth, l=l, anchor=anchor, spin=spin, orient=orient) children(); } @@ -565,10 +565,10 @@ module nema14_mount_holes(depth=5, l=5, slop=PRINTER_SLOP, anchor=CENTER, spin=0 // Arguments: // depth = The thickness of the mounting hole mask. Default: 5 // l = The length of the slots, for making an adjustable motor mount. Default: 5 -// slop = The printer-specific slop value to make parts fit just right. Default: `PRINTER_SLOP` // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Extra Anchors: // "screw1" = The center top of the screw hole/slot in the X+Y+ quadrant. // "screw2" = The center top of the screw hole/slot in the X-Y+ quadrant. @@ -578,9 +578,9 @@ module nema14_mount_holes(depth=5, l=5, slop=PRINTER_SLOP, anchor=CENTER, spin=0 // nema17_mount_holes(depth=5, l=5); // Example: // nema17_mount_holes(depth=5, l=0); -module nema17_mount_holes(depth=5, l=5, slop=PRINTER_SLOP, anchor=CENTER, spin=0, orient=UP) +module nema17_mount_holes(depth=5, l=5, anchor=CENTER, spin=0, orient=UP) { - nema_mount_holes(size=17, depth=depth, l=l, slop=slop, anchor=anchor, spin=spin, orient=orient) children(); + nema_mount_holes(size=17, depth=depth, l=l, anchor=anchor, spin=spin, orient=orient) children(); } @@ -590,10 +590,10 @@ module nema17_mount_holes(depth=5, l=5, slop=PRINTER_SLOP, anchor=CENTER, spin=0 // Arguments: // depth = The thickness of the mounting hole mask. Default: 5 // l = The length of the slots, for making an adjustable motor mount. Default: 5 -// slop = The printer-specific slop value to make parts fit just right. Default: `PRINTER_SLOP` // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Extra Anchors: // "screw1" = The center top of the screw hole/slot in the X+Y+ quadrant. // "screw2" = The center top of the screw hole/slot in the X-Y+ quadrant. @@ -603,9 +603,9 @@ module nema17_mount_holes(depth=5, l=5, slop=PRINTER_SLOP, anchor=CENTER, spin=0 // nema23_mount_holes(depth=5, l=5); // Example: // nema23_mount_holes(depth=5, l=0); -module nema23_mount_holes(depth=5, l=5, slop=PRINTER_SLOP, anchor=CENTER, spin=0, orient=UP) +module nema23_mount_holes(depth=5, l=5, anchor=CENTER, spin=0, orient=UP) { - nema_mount_holes(size=23, depth=depth, l=l, slop=slop, anchor=anchor, spin=spin, orient=orient) children(); + nema_mount_holes(size=23, depth=depth, l=l, anchor=anchor, spin=spin, orient=orient) children(); } @@ -615,10 +615,10 @@ module nema23_mount_holes(depth=5, l=5, slop=PRINTER_SLOP, anchor=CENTER, spin=0 // Arguments: // depth = The thickness of the mounting hole mask. Default: 5 // l = The length of the slots, for making an adjustable motor mount. Default: 5 -// slop = The printer-specific slop value to make parts fit just right. Default: `PRINTER_SLOP` // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Extra Anchors: // "screw1" = The center top of the screw hole/slot in the X+Y+ quadrant. // "screw2" = The center top of the screw hole/slot in the X-Y+ quadrant. @@ -628,9 +628,9 @@ module nema23_mount_holes(depth=5, l=5, slop=PRINTER_SLOP, anchor=CENTER, spin=0 // nema34_mount_holes(depth=5, l=5); // Example: // nema34_mount_holes(depth=5, l=0); -module nema34_mount_holes(depth=5, l=5, slop=PRINTER_SLOP, anchor=CENTER, spin=0, orient=UP) +module nema34_mount_holes(depth=5, l=5, anchor=CENTER, spin=0, orient=UP) { - nema_mount_holes(size=34, depth=depth, l=l, slop=slop, anchor=anchor, spin=spin, orient=orient) children(); + nema_mount_holes(size=34, depth=depth, l=l, anchor=anchor, spin=spin, orient=orient) children(); } diff --git a/sliders.scad b/sliders.scad index bb2e289..e3e37da 100644 --- a/sliders.scad +++ b/sliders.scad @@ -16,7 +16,7 @@ // Description: // Creates a slider to match a V-groove rail. // Usage: -// slider(l, w, h, [base], [wall], [ang], [slop]) +// slider(l, w, h, [base], [wall], [ang], [$slop]) // Arguments: // l = Length (long axis) of slider. // w = Width of slider. @@ -24,13 +24,13 @@ // base = Height of slider base. // wall = Width of wall behind each side of the slider. // ang = Overhang angle for slider, to facilitate supportless printig. -// slop = Printer-specific slop value to make parts fit exactly. // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Example: -// slider(l=30, base=10, wall=4, slop=0.2, spin=90); -module slider(l=30, w=10, h=10, base=10, wall=5, ang=30, slop=PRINTER_SLOP, anchor=BOTTOM, spin=0, orient=UP) +// slider(l=30, base=10, wall=4, $slop=0.2, spin=90); +module slider(l=30, w=10, h=10, base=10, wall=5, ang=30, anchor=BOTTOM, spin=0, orient=UP) { full_width = w + 2*wall; full_height = h + base; @@ -39,16 +39,16 @@ module slider(l=30, w=10, h=10, base=10, wall=5, ang=30, slop=PRINTER_SLOP, anch zrot(90) down(base+h/2) { // Base - cuboid([full_width, l, base-slop], chamfer=2, edges=edges([FRONT,BACK], except=BOT), anchor=BOTTOM); + cuboid([full_width, l, base-$slop], chamfer=2, edges=edges([FRONT,BACK], except=BOT), anchor=BOTTOM); // Wall - xflip_copy(offset=w/2+slop) { + xflip_copy(offset=w/2+$slop) { cuboid([wall, l, full_height], chamfer=2, edges=edges(RIGHT, except=BOT), anchor=BOTTOM+LEFT); } // Sliders up(base+h/2) { - xflip_copy(offset=w/2+slop+0.02) { + xflip_copy(offset=w/2+$slop+0.02) { bev_h = h/2*tan(ang); prismoid([h, l], [0, l-w], h=bev_h+0.01, orient=LEFT, anchor=BOT); } diff --git a/threading.scad b/threading.scad index 4ca4982..fac7a47 100644 --- a/threading.scad +++ b/threading.scad @@ -96,12 +96,12 @@ module thread_helix(base_d, pitch, thread_depth=undef, thread_angle=15, twist=72 // bevel = if true, bevel the thread ends. Default: true // starts = The number of lead starts. Default = 1 // internal = If true, make this a mask for making internal threads. -// slop = printer slop calibration to allow for tight fitting of parts. Default: `PRINTER_SLOP` // profile = The shape of a thread, if not a symmetric trapezoidal form. Given as a 2D path, where X is between -1/2 and 1/2, representing the pitch distance, and Y is 0 for the peak, and `-depth/pitch` for the valleys. The segment between the end of one thread profile and the start of the next is automatic, so the start and end coordinates should not both be at the same Y at X = ±1/2. This path is scaled up by the pitch size in both dimensions when making the final threading. This overrides the `thread_angle` and `thread_depth` options. // center = If given, overrides `anchor`. A true value sets `anchor=CENTER`, false sets `anchor=UP`. // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Examples(Med): // trapezoidal_threaded_rod(d=10, l=40, pitch=2, thread_angle=15, $fn=32); // trapezoidal_threaded_rod(d=3/8*25.4, l=20, pitch=1/8*25.4, thread_angle=29, $fn=32); @@ -135,7 +135,6 @@ module trapezoidal_threaded_rod( starts=1, profile=undef, internal=false, - slop=undef, anchor=CENTER, spin=0, orient=UP, @@ -144,7 +143,7 @@ module trapezoidal_threaded_rod( function _thread_pt(thread, threads, start, starts, astep, asteps, part, parts) = astep + asteps * (thread + threads * (part + parts * start)); - d = internal? d+default(slop,PRINTER_SLOP)*3 : d; + d = internal? d+$slop*3 : d; astep = 360 / quantup(segs(d/2), starts); asteps = ceil(360/astep); threads = ceil(l/pitch/starts)+(starts<4?4-starts:1); @@ -306,14 +305,14 @@ module trapezoidal_threaded_rod( // left_handed = if true, create left-handed threads. Default = false // starts = The number of lead starts. Default = 1 // bevel = if true, bevel the thread ends. Default: true -// slop = printer slop calibration to allow for tight fitting of parts. Default: `PRINTER_SLOP` // profile = The shape of a thread, if not a symmetric trapezoidal form. Given as a 2D path, where X is between -1/2 and 1/2, representing the pitch distance, and Y is 0 for the peak, and `-depth/pitch` for the valleys. The segment between the end of one thread profile and the start of the next is automatic, so the start and end coordinates should not both be at the same Y at X = ±1/2. This path is scaled up by the pitch size in both dimensions when making the final threading. This overrides the `thread_angle` and `thread_depth` options. // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Examples(Med): -// trapezoidal_threaded_nut(od=16, id=8, h=8, pitch=2, slop=0.2, anchor=UP); -// trapezoidal_threaded_nut(od=17.4, id=10, h=10, pitch=2, slop=0.2, left_handed=true); +// trapezoidal_threaded_nut(od=16, id=8, h=8, pitch=2, $slop=0.2, anchor=UP); +// trapezoidal_threaded_nut(od=17.4, id=10, h=10, pitch=2, $slop=0.2, left_handed=true); // trapezoidal_threaded_nut(od=17.4, id=10, h=10, pitch=2, thread_angle=15, starts=3, $fa=1, $fs=1); module trapezoidal_threaded_nut( od=17.4, @@ -326,13 +325,11 @@ module trapezoidal_threaded_nut( left_handed=false, starts=1, bevel=true, - slop=undef, anchor=CENTER, spin=0, orient=UP ) { depth = min((thread_depth==undef? pitch/2 : thread_depth), pitch/2/tan(thread_angle)); - slop = default(slop, PRINTER_SLOP); orient_and_anchor([od/cos(30),od,h], orient, anchor, spin=spin, chain=true) { difference() { cylinder(d=od/cos(30), h=h, center=true, $fn=6); @@ -345,13 +342,12 @@ module trapezoidal_threaded_nut( profile=profile, left_handed=left_handed, starts=starts, - internal=true, - slop=slop + internal=true ); if (bevel) { zflip_copy() { down(h/2+0.01) { - cylinder(r1=id/2+slop, r2=id/2+slop-depth, h=depth, center=false); + cylinder(r1=id/2+$slop, r2=id/2+$slop-depth, h=depth, center=false); } } } @@ -374,10 +370,10 @@ module trapezoidal_threaded_nut( // left_handed = if true, create left-handed threads. Default = false // bevel = if true, bevel the thread ends. Default: false // internal = If true, make this a mask for making internal threads. -// slop = printer slop calibration to allow for tight fitting of parts. Default: `PRINTER_SLOP` // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Example(2D): // projection(cut=true) // threaded_rod(d=10, l=15, pitch=2, orient=BACK); @@ -389,7 +385,6 @@ module threaded_rod( left_handed=false, bevel=false, internal=false, - slop=undef, anchor=CENTER, spin=0, orient=UP @@ -418,7 +413,6 @@ module threaded_rod( left_handed=left_handed, bevel=bevel, internal=internal, - slop=slop, anchor=anchor, spin=spin, orient=orient @@ -438,16 +432,15 @@ module threaded_rod( // pitch = Length between threads. // left_handed = if true, create left-handed threads. Default = false // bevel = if true, bevel the thread ends. Default: false -// slop = printer slop calibration to allow for tight fitting of parts. default=0.2 // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Examples(Med): -// threaded_nut(od=16, id=8, h=8, pitch=1.25, left_handed=true, slop=0.2, $fa=1, $fs=1); +// threaded_nut(od=16, id=8, h=8, pitch=1.25, left_handed=true, $slop=0.2, $fa=1, $fs=1); module threaded_nut( od=16, id=10, h=10, - pitch=2, left_handed=false, - bevel=false, slop=undef, + pitch=2, left_handed=false, bevel=false, anchor=CENTER, spin=0, orient=UP ) { depth = pitch * cos(30) * 5/8; @@ -464,7 +457,7 @@ module threaded_nut( pitch=pitch, thread_angle=30, profile=profile, left_handed=left_handed, - bevel=bevel, slop=slop, + bevel=bevel, anchor=anchor, spin=spin, orient=orient ) children(); @@ -484,10 +477,10 @@ module threaded_nut( // left_handed = if true, create left-handed threads. Default = false // bevel = if true, bevel the thread ends. Default: false // internal = If true, this is a mask for making internal threads. -// slop = printer slop calibration to allow for tight fitting of parts. default=0.2 // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Example(2D): // projection(cut=true) // buttress_threaded_rod(d=10, l=15, pitch=2, orient=BACK); @@ -499,7 +492,6 @@ module buttress_threaded_rod( left_handed=false, bevel=false, internal=false, - slop=undef, anchor=CENTER, spin=0, orient=UP @@ -520,7 +512,6 @@ module buttress_threaded_rod( left_handed=left_handed, bevel=bevel, internal=internal, - slop=slop, anchor=anchor, spin=spin, orient=orient @@ -540,16 +531,16 @@ module buttress_threaded_rod( // pitch = Length between threads. // left_handed = if true, create left-handed threads. Default = false // bevel = if true, bevel the thread ends. Default: false -// slop = printer slop calibration to allow for tight fitting of parts. default=0.2 // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Examples(Med): -// buttress_threaded_nut(od=16, id=8, h=8, pitch=1.25, left_handed=true, slop=0.2, $fa=1, $fs=1); +// buttress_threaded_nut(od=16, id=8, h=8, pitch=1.25, left_handed=true, $slop=0.2, $fa=1, $fs=1); module buttress_threaded_nut( od=16, id=10, h=10, pitch=2, left_handed=false, - bevel=false, slop=undef, + bevel=false, anchor=CENTER, spin=0, orient=UP @@ -568,7 +559,7 @@ module buttress_threaded_nut( profile=profile, thread_depth=pitch*3*sqrt(3)/8, left_handed=left_handed, - bevel=bevel, slop=slop, + bevel=bevel, anchor=anchor, spin=spin, orient=orient ) children(); @@ -589,10 +580,10 @@ module buttress_threaded_nut( // bevel = if true, bevel the thread ends. Default: false // starts = The number of lead starts. Default = 1 // internal = If true, this is a mask for making internal threads. -// slop = printer slop calibration to allow for tight fitting of parts. default=0.2 // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Example(2D): // projection(cut=true) // metric_trapezoidal_threaded_rod(d=10, l=15, pitch=2, orient=BACK); @@ -604,7 +595,6 @@ module metric_trapezoidal_threaded_rod( starts=1, bevel=false, internal=false, - slop=undef, anchor=CENTER, spin=0, orient=UP @@ -617,7 +607,6 @@ module metric_trapezoidal_threaded_rod( starts=starts, bevel=bevel, internal=internal, - slop=slop, anchor=anchor, spin=spin, orient=orient @@ -638,10 +627,10 @@ module metric_trapezoidal_threaded_rod( // left_handed = if true, create left-handed threads. Default = false // bevel = if true, bevel the thread ends. Default: false // starts = The number of lead starts. Default = 1 -// slop = printer slop calibration to allow for tight fitting of parts. default=0.2 // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Examples(Med): // metric_trapezoidal_threaded_nut(od=16, id=10, h=10, pitch=2, left_handed=true, bevel=true, $fa=1, $fs=1); module metric_trapezoidal_threaded_nut( @@ -650,7 +639,6 @@ module metric_trapezoidal_threaded_nut( starts=1, left_handed=false, bevel=false, - slop=undef, anchor=CENTER, spin=0, orient=UP @@ -661,7 +649,6 @@ module metric_trapezoidal_threaded_nut( left_handed=left_handed, starts=starts, bevel=bevel, - slop=slop, anchor=anchor, spin=spin, orient=orient @@ -685,10 +672,10 @@ module metric_trapezoidal_threaded_nut( // left_handed = if true, create left-handed threads. Default = false // bevel = if true, bevel the thread ends. Default: false // internal = If true, this is a mask for making internal threads. -// slop = printer slop calibration to allow for tight fitting of parts. default=0.2 // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Example(2D): // projection(cut=true) // acme_threaded_rod(d=10, l=15, pitch=2, orient=BACK); @@ -703,7 +690,6 @@ module acme_threaded_rod( left_handed=false, bevel=false, internal=false, - slop=undef, anchor=CENTER, spin=0, orient=UP @@ -716,7 +702,6 @@ module acme_threaded_rod( left_handed=left_handed, bevel=bevel, internal=internal, - slop=slop, anchor=anchor, spin=spin, orient=orient @@ -738,13 +723,13 @@ module acme_threaded_rod( // thread_angle = The pressure angle profile angle of the threads. Default = 14.5 degree ACME profile. // left_handed = if true, create left-handed threads. Default = false // bevel = if true, bevel the thread ends. Default: false -// slop = printer slop calibration to allow for tight fitting of parts. default=0.2 // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Examples(Med): -// acme_threaded_nut(od=16, id=3/8*25.4, h=8, pitch=1/8*25.4, slop=0.2); -// acme_threaded_nut(od=16, id=10, h=10, pitch=2, starts=3, slop=0.2, $fa=1, $fs=1); +// acme_threaded_nut(od=16, id=3/8*25.4, h=8, pitch=1/8*25.4, $slop=0.2); +// acme_threaded_nut(od=16, id=10, h=10, pitch=2, starts=3, $slop=0.2, $fa=1, $fs=1); module acme_threaded_nut( od, id, h, pitch, thread_angle=14.5, @@ -752,7 +737,6 @@ module acme_threaded_nut( starts=1, left_handed=false, bevel=false, - slop=undef, anchor=CENTER, spin=0, orient=UP @@ -764,7 +748,6 @@ module acme_threaded_nut( left_handed=left_handed, bevel=bevel, starts=starts, - slop=slop, anchor=anchor, spin=spin, orient=orient @@ -786,10 +769,10 @@ module acme_threaded_nut( // bevel = if true, bevel the thread ends. Default: false // starts = The number of lead starts. Default = 1 // internal = If true, this is a mask for making internal threads. -// slop = printer slop calibration to allow for tight fitting of parts. default=0.2 // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Example(2D): // projection(cut=true) // square_threaded_rod(d=10, l=15, pitch=2, orient=BACK); @@ -801,7 +784,6 @@ module square_threaded_rod( bevel=false, starts=1, internal=false, - slop=undef, anchor=CENTER, spin=0, orient=UP @@ -813,7 +795,6 @@ module square_threaded_rod( bevel=bevel, starts=starts, internal=internal, - slop=slop, anchor=anchor, spin=spin, orient=orient @@ -834,19 +815,18 @@ module square_threaded_rod( // left_handed = if true, create left-handed threads. Default = false // bevel = if true, bevel the thread ends. Default: false // starts = The number of lead starts. Default = 1 -// slop = printer slop calibration to allow for tight fitting of parts. default=0.2 // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` +// $slop = The printer-specific slop value to make parts fit just right. // Examples(Med): -// square_threaded_nut(od=16, id=10, h=10, pitch=2, starts=2, slop=0.15, $fn=32); +// square_threaded_nut(od=16, id=10, h=10, pitch=2, starts=2, $slop=0.15, $fn=32); module square_threaded_nut( od=17.4, id=10.5, h=10, pitch=3.175, left_handed=false, bevel=false, starts=1, - slop=undef, anchor=CENTER, spin=0, orient=UP @@ -857,7 +837,6 @@ module square_threaded_nut( left_handed=left_handed, bevel=bevel, starts=starts, - slop=slop, anchor=anchor, spin=spin, orient=orient