[time-nuts] more worm code

beale beale at bealecorner.com
Wed Aug 20 14:12:18 UTC 2014


// worm: 32 diametral pitch   (# of teeth per inch of diameter on pitch circle)
// 32 inch => 32/25.4 = 1.26 DP (in mm)
// nTeeth = DP * 2 * r;

// Create enveloping worm gear / pinion gear by incrementally
// subtracting off parts of the matching worm screw
// very slow to compute full gear with reasonable detail / smoothness
// 2014-08-19 J.Beale
//
// https://github.com/elmom/MCAD/blob/master/involute_gears.scad
// https://github.com/syvwlch/Thingiverse-Projects/blob/master/Threaded%20Library/Thread_Library.scad

use <MCAD/Thread_Library.scad>
use <MCAD/involute_gears.scad>

eps = 0.05;      // Epsilon = a small number
numberTeeth=40;  // number of teeth on worm gear (pinion gear)
pitchRadius=40;  // pitch radius of worm gear (pinion gear)

gearSegAngle = 10;  // toothed part of gear segment (360 = full gear)

length=20;  // length of worm screw
radius=10;  // radius of worm screw

pi = 3.1415926535897932384626433832795;

pitch = 2*pi*pitchRadius/numberTeeth;

angle=360*$t;
offset=7.5;

distance=radius+pitchRadius+0.0*pitch;

GearThick = 10;           // thickness of gear
xoff = -GearThick/2;
rAngle = 360/numberTeeth;

wAoff = -50;  // initial angular offset of worm screw

// ===============================================
// == QUALITY FACTOR (higher = slower, better) ==
// ===============================================

cSteps = 17;  // rotational carving steps for worm: larger = smoother surf.
StepsPerTurn = cSteps+3; // facets around worm screw: larger = smoother

// ===============================================
EngageDepth = pitch*0.3;  // carving out gear from blank
// echo(EngageDepth);

// worm(wA = 10);


module worm(wA = 0) {
 translate([0,distance-EngageDepth,0.2-length/2])
 rotate([0,0,180+wA])
 trapezoidThread(
  length=length, // axial length of the threaded rod
  pitch=pitch,   // axial distance from crest to crest
  pitchRadius=radius, // radial distance from center to mid-profile
  threadHeightToPitch=0.5, // ratio between the height of the profile and the pitch
  // std value for Acme or metric lead screw is 0.5
  profileRatio=0.5,   // ratio between the lengths of the raised part of the profile and the pitch
  // std value for Acme or metric lead screw is 0.5
  threadAngle=14.5, // angle between the two faces of the thread
// std value for Acme is 29 or for metric lead screw is 30
  RH=true, // true/false the thread winds clockwise looking along shaft, i.e.follows the Right Hand Rule
  clearance=0.0, // radial clearance, normalized to thread height
  backlash=0.1, // axial clearance, normalized to pitch
  stepsPerTurn=StepsPerTurn // number of slices to create per turn
 );

} // end module worm()


module myToothBlank() {
  translate([-GearThick/2,pitchRadius-8,0])
  rotate([360/(numberTeeth*2),0,0])
    cube([GearThick,pitch*1.5,pitch]);
}


module oneTooth() {
difference() {
  myToothBlank();     // blank to form tooth via CSG subtraction
  worm(wA = wAoff); // worm screw
  for(f = [-.1:(1.0/cSteps):1.1]) {  // computational machining (gear hobbing)
   rotate([rAngle*f,0,0]) worm(wA = (360*f)+wAoff);
  }
}
} // end module oneTooth()


// full gear = oneTooth * numberTeeth
// deg = 360.0/numberTeeth;

module gearSegment(segAngle = 90) {
  for(deg = [0:360.0/numberTeeth:segAngle]) {
    rotate([deg,0,0]) oneTooth();
  }
}

module hub(ID = 5) {
difference() {
  rotate([0,90,0]) translate([0,0,-GearThick/2])
    cylinder(r=pitchRadius-(radius/2),h=GearThick,$fn=60);
  rotate([0,90,0]) translate([0,0,-eps-GearThick/2])
    cylinder(r=ID/2,h=GearThick+2*eps,$fn=20);
}
}

gearSegment(segAngle=gearSegAngle);  // full gear => segmentAngle = 360
hub(ID = 8);  // inner part of gear wheel with ID boresize

// worm();



More information about the Time-nuts_lists.febo.com mailing list