diff --git a/README.md b/README.md index 6c7c146..5d3b7d2 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,28 @@ The rack module matches the gear module directly, without additional helix-based * `helix_angle` = bevel angle perpendicular to the rack's length; 0° = straight teeth +## Parametric Herringbone Gear Rack + +Herringbone Rack + +Creates a herringbone gear rack by mirroring two helical racks. + +This script adjusts the pressure angle in the transverse section to the helix angle: e.g. with a 20° helix angle, a pressure angle of 20° becomes a pressure angle of 21.17° in the transverse section. +The rack module matches the gear module directly, without additional helix-based scaling. + +### Format + +`herringbone_rack(modul, length, height, width, pressure_angle=20, helix_angle=45)` + +#### Parameters +* `modul` = height of the tooth above the pitch line +* `length` = length of the rack +* `height` = height from bottom to the pitch line +* `width` = face width +* `pressure_angle` = pressure angle, standard value = 20° according to DIN 867. Should not be greater than 45°. +* `helix_angle` = bevel angle perpendicular to the rack's length; 0° = straight teeth + + ## Parametric Involute Spur Gear Spur Gear diff --git a/examples/herringbone_rack.png b/examples/herringbone_rack.png index f0e2673..77e1c10 100644 Binary files a/examples/herringbone_rack.png and b/examples/herringbone_rack.png differ diff --git a/examples/herringbone_rack.scad b/examples/herringbone_rack.scad index c20089f..7c13310 100644 --- a/examples/herringbone_rack.scad +++ b/examples/herringbone_rack.scad @@ -1,3 +1,4 @@ include <../gears.scad> +rotate([90,0,0]) herringbone_rack(modul=1, length=60, height=5, width=20, pressure_angle=20, helix_angle=45); diff --git a/examples/mountable_herringbone_rack.png b/examples/mountable_herringbone_rack.png index fbc4f0c..e25945b 100644 Binary files a/examples/mountable_herringbone_rack.png and b/examples/mountable_herringbone_rack.png differ diff --git a/examples/mountable_herringbone_rack.scad b/examples/mountable_herringbone_rack.scad index 33db4b1..76156cb 100644 --- a/examples/mountable_herringbone_rack.scad +++ b/examples/mountable_herringbone_rack.scad @@ -1,3 +1,4 @@ include <../gears.scad> +rotate([90,0,0]) mountable_herringbone_rack(modul=1, length=60, height=5, width=20, pressure_angle=20, helix_angle=45, profile=3, head="PH", fastners=3); diff --git a/examples/mountable_rack.png b/examples/mountable_rack.png index 858fc29..443912f 100644 Binary files a/examples/mountable_rack.png and b/examples/mountable_rack.png differ diff --git a/examples/mountable_rack.scad b/examples/mountable_rack.scad index 4e9e3f7..4acc412 100644 --- a/examples/mountable_rack.scad +++ b/examples/mountable_rack.scad @@ -1,3 +1,4 @@ include <../gears.scad> +rotate([90,0,0]) mountable_rack(modul=1, length=60, height=5, width=20, pressure_angle=20, helix_angle=0, profile=3, head="PH", fastners=3); diff --git a/examples/rack.png b/examples/rack.png index ba54970..f53d9ef 100644 Binary files a/examples/rack.png and b/examples/rack.png differ diff --git a/examples/rack.scad b/examples/rack.scad index fc82bee..6529783 100644 --- a/examples/rack.scad +++ b/examples/rack.scad @@ -1,4 +1,4 @@ include <../gears.scad> -rotate([0,0,180]) +rotate([90,0,0]) rack(modul=1, length=60, height=5, width=20, pressure_angle=20, helix_angle=0); diff --git a/examples/render_examples.sh b/examples/render_examples.sh index bccf5db..d0476be 100755 --- a/examples/render_examples.sh +++ b/examples/render_examples.sh @@ -12,12 +12,34 @@ else exit 1 fi -for scad in "${SCRIPT_DIR}"/*.scad; do +render_one() { + local scad="$1" + local base base="$(basename "${scad}" .scad)" if [[ "${base}" == "demo" ]]; then - continue + return 0 fi - out="${SCRIPT_DIR}/${base}.png" + local out="${SCRIPT_DIR}/${base}.png" "${OPENSCAD_BIN}" -o "${out}" --imgsize 800,800 "${scad}" echo "Rendered ${out}" -done +} + +if [[ "${1:-}" != "" ]]; then + target="${1}" + if [[ "${target}" != /* ]]; then + if [[ "${target}" != *.scad ]]; then + target="${SCRIPT_DIR}/${target}.scad" + else + target="${SCRIPT_DIR}/${target}" + fi + fi + if [[ ! -f "${target}" ]]; then + echo "Error: SCAD file not found: ${target}" >&2 + exit 1 + fi + render_one "${target}" +else + for scad in "${SCRIPT_DIR}"/*.scad; do + render_one "${scad}" + done +fi diff --git a/gears.scad b/gears.scad index 4ae0d85..b6bf323 100644 --- a/gears.scad +++ b/gears.scad @@ -199,21 +199,29 @@ module involute_rack(modul, length, height, width, pressure_angle = 20, helix_an ); translate([-pitch*(nz-1)/2,0,0]){ - intersection(){ - copier([1,0,0], nz, pitch, 0){ - multmatrix(m = [ - [1,0,x_slope,0], - [0,1,0,0], - [0,0,1,0], - [0,0,0,1] - ]) - linear_extrude(height = width, convexity = 10) - polygon(points_2d); + union(){ + intersection(){ + copier([1,0,0], nz, pitch, 0){ + multmatrix(m = [ + [1,0,x_slope,0], + [0,1,0,0], + [0,0,1,0], + [0,0,0,1] + ]) + linear_extrude(height = width, convexity = 10) + polygon(points_2d); + }; + translate([abs(x_shift),-height-0.5,-0.5]){ + cube([length,height+mx+1,width+1]); // Cuboid which includes the Volume of the Rack + } }; - translate([abs(x_shift),-height-0.5,-0.5]){ - cube([length,height+mx+1,width+1]); // Cuboid which includes the Volume of the Rack + body_height = height - (mx + c); + if (body_height > 0) { + translate([abs(x_shift),-height,0]){ + cube([length,body_height,width]); // Rectangular rack body + } } - }; + } }; }