def getToothProfileRack(derivation): 'Get profile for one rack tooth.' addendumSide = derivation.quarterWavelength - derivation.addendum * derivation.tanPressure addendumComplex = complex(addendumSide, derivation.addendum) dedendumSide = derivation.quarterWavelength + derivation.dedendum * derivation.tanPressure dedendumComplex = complex(dedendumSide, -derivation.dedendum) toothProfile = [dedendumComplex] if derivation.rootBevel > 0.0: mirrorPoint = complex(derivation.wavelength - dedendumSide, -derivation.dedendum) toothProfile = getBevelPath(addendumComplex, derivation.rootBevel, dedendumComplex, mirrorPoint) if derivation.tipBevel > 0.0: mirrorPoint = complex(-addendumComplex.real, addendumComplex.imag) bevelPath = getBevelPath(dedendumComplex, derivation.tipBevel, addendumComplex, mirrorPoint) bevelPath.reverse() toothProfile += bevelPath else: toothProfile.append(addendumComplex) return euclidean.getMirrorPath(getWidthMultipliedPath(toothProfile, derivation.toothWidthMultiplier))
def getToothProfileAnnulus(derivation, pitchRadius, teeth): 'Get profile for one tooth of an annulus.' toothProfileHalf = [] toothProfileHalfCylinder = getToothProfileHalfCylinder(derivation, pitchRadius) pitchRadius = -pitchRadius innerRadius = pitchRadius - derivation.addendum # tooth is multiplied by 1.02 because at around 1.01 for a 7/-23/20.0 test case, there is intersection since the paths are bending together for point in getWidthMultipliedPath(toothProfileHalfCylinder, 1.02 / derivation.toothWidthMultiplier): if abs(point) >= innerRadius: toothProfileHalf.append(point) profileFirst = toothProfileHalf[0] profileSecond = toothProfileHalf[1] firstMinusSecond = profileFirst - profileSecond remainingAddendum = abs(profileFirst) - innerRadius firstMinusSecond *= remainingAddendum / abs(firstMinusSecond) extensionPoint = profileFirst + firstMinusSecond if derivation.tipBevel > 0.0: unitPolar = euclidean.getWiddershinsUnitPolar(2.0 / float(teeth) * math.pi) mirrorPoint = complex(-extensionPoint.real, extensionPoint.imag) * unitPolar bevelPath = getBevelPath(profileFirst, derivation.tipBevel, extensionPoint, mirrorPoint) toothProfileHalf = bevelPath + toothProfileHalf else: toothProfileHalf.insert(0, extensionPoint) profileLast = toothProfileHalf[-1] profilePenultimate = toothProfileHalf[-2] lastMinusPenultimate = profileLast - profilePenultimate remainingDedendum = pitchRadius - abs(profileLast) + derivation.dedendum lastMinusPenultimate *= remainingDedendum / abs(lastMinusPenultimate) extensionPoint = profileLast + lastMinusPenultimate if derivation.rootBevel > 0.0: mirrorPoint = complex(-extensionPoint.real, extensionPoint.imag) bevelPath = getBevelPath(profileLast, derivation.rootBevel, extensionPoint, mirrorPoint) bevelPath.reverse() toothProfileHalf += bevelPath else: toothProfileHalf.append(extensionPoint) toothProfileAnnulus = euclidean.getMirrorPath(toothProfileHalf) toothProfileAnnulus.reverse() return toothProfileAnnulus
def getShaftPath(depthBottom, depthTop, radius, sides): 'Get shaft with the option of a flat on the top and/or bottom.' if radius <= 0.0: return [] sideAngle = 2.0 * math.pi / float(abs(sides)) startAngle = 0.5 * sideAngle endAngle = math.pi - 0.1 * sideAngle shaftProfile = [] while startAngle < endAngle: unitPolar = euclidean.getWiddershinsUnitPolar(startAngle) shaftProfile.append(unitPolar * radius) startAngle += sideAngle if abs(sides) % 2 == 1: shaftProfile.append(complex(-radius, 0.0)) horizontalBegin = radius - depthTop horizontalEnd = depthBottom - radius shaftProfile = euclidean.getHorizontallyBoundedPath(horizontalBegin, horizontalEnd, shaftProfile) for shaftPointIndex, shaftPoint in enumerate(shaftProfile): shaftProfile[shaftPointIndex] = complex(shaftPoint.imag, shaftPoint.real) shaftPath = euclidean.getVector3Path(euclidean.getMirrorPath(shaftProfile)) if sides > 0: shaftPath.reverse() return shaftPath
def getToothProfileCylinderByProfile(derivation, pitchRadius, teeth, toothProfileHalf): 'Get profile for one tooth of a cylindrical gear.' profileFirst = toothProfileHalf[0] profileSecond = toothProfileHalf[1] firstMinusSecond = profileFirst - profileSecond remainingDedendum = abs(profileFirst) - pitchRadius + derivation.dedendum firstMinusSecond *= remainingDedendum / abs(firstMinusSecond) extensionPoint = profileFirst + firstMinusSecond if derivation.rootBevel > 0.0: unitPolar = euclidean.getWiddershinsUnitPolar(-2.0 / float(teeth) * math.pi) mirrorPoint = complex(-extensionPoint.real, extensionPoint.imag) * unitPolar bevelPath = getBevelPath(profileFirst, derivation.rootBevel, extensionPoint, mirrorPoint) toothProfileHalf = bevelPath + toothProfileHalf else: toothProfileHalf.insert(0, extensionPoint) if derivation.tipBevel > 0.0: profileLast = toothProfileHalf[-1] profilePenultimate = toothProfileHalf[-2] mirrorPoint = complex(-profileLast.real, profileLast.imag) bevelPath = getBevelPath(profilePenultimate, derivation.tipBevel, profileLast, mirrorPoint) bevelPath.reverse() toothProfileHalf = toothProfileHalf[: -1] + bevelPath return euclidean.getMirrorPath(toothProfileHalf)