Beispiel #1
0
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
Beispiel #2
0
def getGearProfileRack(derivation, toothProfile):
	'Get gear profile for rack.'
	derivation.extraRackDemilength = 0.0
	for complexPoint in derivation.helixPath:
		derivation.extraRackDemilength = max(abs(derivation.helixThickness * complexPoint.imag), derivation.extraRackDemilength)
	rackDemilengthPlus = derivation.rackDemilength
	if derivation.pinionThickness > 0.0:
		derivation.extraRackDemilength *= 1.1
		rackDemilengthPlus += derivation.extraRackDemilength
	teethRack = int(math.ceil(rackDemilengthPlus / derivation.wavelength))
	gearProfile = []
	for toothIndex in xrange(-teethRack, teethRack + 1):
		translateComplex = complex(-toothIndex * derivation.wavelength, 0.0)
		translatedPath = euclidean.getTranslatedComplexPath(toothProfile, translateComplex)
		gearProfile += translatedPath
	gearProfile = euclidean.getHorizontallyBoundedPath(rackDemilengthPlus, -rackDemilengthPlus, gearProfile)
	firstPoint = gearProfile[0]
	lastPoint = gearProfile[-1]
	rackWidth = derivation.rackWidth
	minimumRackWidth = 1.1 * derivation.dedendum
	if rackWidth < minimumRackWidth:
		rackWidth = minimumRackWidth
		print('Warning, rackWidth is too small in getGearProfileRack in gear.')
		print('RackWidth will be set to a bit more than the dedendum.')
	gearProfile += [complex(lastPoint.real, -rackWidth),complex(firstPoint.real, -rackWidth)]
	return gearProfile
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