From 5d6b539aae4f4b8664178ec7198dc978defff625 Mon Sep 17 00:00:00 2001 From: Clinton Ebadi Date: Sat, 11 Nov 2017 14:37:07 -0500 Subject: [PATCH 1/1] acorn: add option to control generated parts Override acorn_parts on the command line to generate individual parts of the acorn. Default is to generate all parts. e.g. `openscad -Dacorn_parts='["body"]' acorn_threads.scad' to only generate the body. --- acorn/acorn-threads.scad | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/acorn/acorn-threads.scad b/acorn/acorn-threads.scad index 1abc99e..50eb524 100644 --- a/acorn/acorn-threads.scad +++ b/acorn/acorn-threads.scad @@ -5,10 +5,15 @@ use // http://www.thingiverse.com/thing:1686322 AUTO_CALCULATE = -1; +acorn_parts = [ "body", "cap", "gasket" ]; + internal_thread_tolerance = 0.3; external_thread_tolerance = 0.2; thread_angle = 50; + +function contains (x, lst) = len([ for (i = lst) if (x == i) i]) > 0; + module acorn (thread_pitch = 3.0, thread_size = 2.5, thread_height = 3.5, @@ -98,9 +103,12 @@ module acorn (thread_pitch = 3.0, } module nuts () { - translate ([outer_d+10, 0, 0,]) nut (); - cap (); - translate ([-(outer_d+10), 0, 0,]) gasket (); + if (contains ("body", acorn_parts)) + translate ([outer_d+10, 0, 0,]) nut (); + if (contains ("cap", acorn_parts)) + cap (); + if (contains ("gasket", acorn_parts)) + translate ([-(outer_d+10), 0, 0,]) gasket (); } nuts (); -- 2.20.1