Example #1
0
def getHelixComplexPath(gearDerivation, xmlElement):
    'Set gear helix path.'
    helixTypeFirstCharacter = gearDerivation.helixType.lower()[:1]
    if helixTypeFirstCharacter == 'b':
        return [complex(), complex(1.0, 1.0)]
    if helixTypeFirstCharacter == 'h':
        return [complex(), complex(0.5, 0.5), complex(1.0, 0.0)]
    if helixTypeFirstCharacter == 'p':
        helixComplexPath = []
        x = 0.0
        xStep = evaluate.getLayerThickness(
            gearDerivation.xmlElement) / gearDerivation.thickness
        justBelowOne = 1.0 - 0.5 * xStep
        while x < justBelowOne:
            distanceFromCenter = 0.5 - x
            parabolicTwist = 0.25 - distanceFromCenter * distanceFromCenter
            helixComplexPath.append(complex(x, parabolicTwist))
            x += xStep
        helixComplexPath.append(complex(1.0, 0.0))
        return helixComplexPath
    print(
        'Warning, the helix type was not one of (basic, herringbone or parabolic) in getHelixComplexPath in gear for:'
    )
    print(gearDerivation.helixType)
    print(gearDerivation.xmlElement)
Example #2
0
 def getTransformedPaths(self):
     "Get all transformed paths."
     importRadius = self.xmlElement.getCascadeFloat(
         1.5 * evaluate.getLayerThickness(self.xmlElement), 'importRadius')
     return euclidean.getVector3Paths(
         self.getLoopsFromObjectLoopsList(
             importRadius, self.getComplexTransformedPathLists()))
 def getTransformedPaths(self):
     "Get all transformed paths."
     importRadius = self.xmlElement.getCascadeFloat(
         1.5 * evaluate.getLayerThickness(self.xmlElement), "importRadius"
     )
     return euclidean.getVector3Paths(
         self.getLoopsFromObjectLoopsList(importRadius, self.getComplexTransformedPathLists())
     )
Example #4
0
def addBevelGear(derivation, extrudeDerivation, pitchRadius, positives, teeth, vector3GearProfile):
	"Get extrude output for a cylinder gear."
	totalPitchRadius = derivation.pitchRadiusGear + derivation.pitchRadius
	totalTeeth = derivation.teethPinion + derivation.teethGear
	portionDirections = extrude.getSpacedPortionDirections(extrudeDerivation.interpolationDictionary)
	loopLists = extrude.getLoopListsByPath(extrudeDerivation, None, vector3GearProfile[0], portionDirections)
	firstLoopList = loopLists[0]
	gearOverPinion = float(totalTeeth - teeth) / float(teeth)
	thirdLayerThickness = 0.33333333333 * evaluate.getLayerThickness(derivation.xmlElement)
	pitchRadian = math.atan(math.sin(derivation.operatingRadian) / (gearOverPinion + math.cos(derivation.operatingRadian)))
	coneDistance = pitchRadius / math.sin(pitchRadian)
	apex = Vector3(0.0, 0.0, math.sqrt(coneDistance * coneDistance - pitchRadius * pitchRadius))
	cosPitch = apex.z / coneDistance
	sinPitch = math.sin(pitchRadian)
	for loop in firstLoopList:
		for point in loop:
			alongWay = point.z / coneDistance
			oneMinusAlongWay = 1.0 - alongWay
			pointComplex = point.dropAxis()
			pointComplexLength = abs(pointComplex)
			deltaRadius = pointComplexLength - pitchRadius
			cosDeltaRadius = cosPitch * deltaRadius
			sinDeltaRadius = sinPitch * deltaRadius
			pointComplex *= (cosDeltaRadius + pitchRadius) / pointComplexLength
			point.x = pointComplex.real
			point.y = pointComplex.imag
			point.z += sinDeltaRadius
			point.x *= oneMinusAlongWay
			point.y *= oneMinusAlongWay
	addBottomLoop(-thirdLayerThickness, firstLoopList)
	topLoop = firstLoopList[-1]
	topAddition = []
	topZ = euclidean.getTopPath(topLoop) + thirdLayerThickness
	oldIndex = topLoop[-1].index
	for point in topLoop:
		oldIndex += 1
		topAddition.append(Vector3Index(oldIndex, 0.8 * point.x, 0.8 * point.y, topZ))
	firstLoopList.append(topAddition)
	translation = Vector3(0.0, 0.0, -euclidean.getBottomPaths(firstLoopList))
	euclidean.translateVector3Paths(firstLoopList, translation)
	geometryOutput = trianglemesh.getPillarsOutput(loopLists)
	positives.append(geometryOutput)
Example #5
0
def getHelixComplexPath(gearDerivation, xmlElement):
	'Set gear helix path.'
	helixTypeFirstCharacter = gearDerivation.helixType.lower()[: 1]
	if helixTypeFirstCharacter == 'b':
		return [complex(), complex(1.0, 1.0)]
	if helixTypeFirstCharacter == 'h':
		return [complex(), complex(0.5, 0.5), complex(1.0, 0.0)]
	if helixTypeFirstCharacter == 'p':
		helixComplexPath = []
		x = 0.0
		xStep = evaluate.getLayerThickness(gearDerivation.xmlElement) / gearDerivation.thickness
		justBelowOne = 1.0 - 0.5 * xStep
		while x < justBelowOne:
			distanceFromCenter = 0.5 - x
			parabolicTwist = 0.25 - distanceFromCenter * distanceFromCenter
			helixComplexPath.append(complex(x, parabolicTwist))
			x += xStep
		helixComplexPath.append(complex(1.0, 0.0))
		return helixComplexPath
	print('Warning, the helix type was not one of (basic, herringbone or parabolic) in getHelixComplexPath in gear for:')
	print(gearDerivation.helixType)
	print(gearDerivation.xmlElement)