def getPathOutput(creationFirst, derivation, translation, vector3GearProfileFirst, vector3GearPaths, xmlElement): "Get gear path output." vector3GearProfileFirst = lineation.getPackedGeometryOutputByLoop(lineation.SideLoop(vector3GearProfileFirst), xmlElement) if creationFirst == 'f': return vector3GearProfileFirst packedGearGeometry = [] for vector3GearPath in vector3GearPaths: packedGearGeometry += lineation.getPackedGeometryOutputByLoop(lineation.SideLoop(vector3GearPath), xmlElement) if creationFirst == 's': return packedGearGeometry euclidean.translateVector3Paths(packedGearGeometry, translation) return vector3GearProfileFirst + packedGearGeometry
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)