def addLighteningHoles(derivation, gearHolePaths, negatives, pitchRadius, positives): "Add lightening holes." positiveVertexes = matrix.getVertexes(positives) bottomPath = euclidean.getTopPath(positiveVertexes) topPath = euclidean.getBottomPath(positiveVertexes) copyShallow = derivation.xmlElement.getCopyShallow() copyShallow.attributeDictionary['path'] = [Vector3(0.0, 0.0, bottomPath), Vector3(0.0, 0.0, topPath)] extrudeDerivation = extrude.ExtrudeDerivation(copyShallow) vector3LighteningHoles = getLighteningHoles(derivation, gearHolePaths, pitchRadius) extrude.addNegativesPositives(extrudeDerivation, negatives, vector3LighteningHoles, positives)
def addLighteningHoles(derivation, gearHolePaths, negatives, pitchRadius, positives): "Add lightening holes." extrudeDerivation = extrude.ExtrudeDerivation() positiveVertexes = matrix.getVertexes(positives) bottomPath = euclidean.getTopPath(positiveVertexes) topPath = euclidean.getBottomPath(positiveVertexes) extrudeDerivation.offsetPathDefault = [Vector3(0.0, 0.0, bottomPath), Vector3(0.0, 0.0, topPath)] extrudeDerivation.setToXMLElement(derivation.copyShallow) vector3LighteningHoles = getLighteningHoles(derivation, gearHolePaths, pitchRadius) extrude.addNegativesPositives(extrudeDerivation, negatives, vector3LighteningHoles, positives)
def addNegativeSphere(derivation, negatives, x): 'Add negative sphere at x.' radius = Vector3(derivation.radiusPlusClearance, derivation.radiusPlusClearance, derivation.radiusPlusClearance) sphereOutput = sphere.getGeometryOutput( radius, derivation.xmlElement.getCopyShallow()) euclidean.translateVector3Path(matrix.getVertexes(sphereOutput), Vector3(x, 0.0, derivation.demiheight)) negatives.append(sphereOutput)
def addShaft(derivation, negatives, positives): "Add shaft." if len(derivation.shaftPath) < 3: return extrudeDerivation = extrude.ExtrudeDerivation() positiveVertexes = matrix.getVertexes(positives) bottomPath = euclidean.getTopPath(positiveVertexes) topPath = euclidean.getBottomPath(positiveVertexes) extrudeDerivation.offsetPathDefault = [Vector3(0.0, 0.0, bottomPath), Vector3(0.0, 0.0, topPath)] extrudeDerivation.setToXMLElement(derivation.copyShallow) extrude.addNegativesPositives(extrudeDerivation, negatives, [derivation.shaftPath], positives)
def getGeometryOutputByEndStart(endZ, inradiusComplex, start, topOverBottom, xmlElement): 'Get cylinder triangle mesh by endZ, inradius and start.' inradius = Vector3(inradiusComplex.real, inradiusComplex.imag, 0.5 * abs(endZ - start.z)) cylinderOutput = getGeometryOutput(inradius, topOverBottom, xmlElement) vertexes = matrix.getVertexes(cylinderOutput) if endZ < start.z: for vertex in vertexes: vertex.z = -vertex.z translation = Vector3(start.x, start.y, inradius.z + min(start.z, endZ)) euclidean.translateVector3Path(vertexes, translation) return cylinderOutput
def addShaft(derivation, negatives, positives): "Add shaft." if len(derivation.shaftPath) < 3: return positiveVertexes = matrix.getVertexes(positives) bottomPath = euclidean.getTopPath(positiveVertexes) topPath = euclidean.getBottomPath(positiveVertexes) copyShallow = derivation.xmlElement.getCopyShallow() copyShallow.attributeDictionary['path'] = [Vector3(0.0, 0.0, bottomPath), Vector3(0.0, 0.0, topPath)] extrudeDerivation = extrude.ExtrudeDerivation(copyShallow) extrude.addNegativesPositives(extrudeDerivation, negatives, [derivation.shaftPath], positives)
def addNegativeSphere(derivation, negatives, x): 'Add negative sphere at x.' radius = Vector3(derivation.radiusPlusClearance, derivation.radiusPlusClearance, derivation.radiusPlusClearance) sphereOutput = sphere.getGeometryOutput(radius, derivation.xmlElement.getCopyShallow()) euclidean.translateVector3Path(matrix.getVertexes(sphereOutput), Vector3(x, 0.0, derivation.demiheight)) negatives.append(sphereOutput)
def translateNegativesPositives(negatives, positives, translation): 'Translate the negatives and postives.' euclidean.translateVector3Path(matrix.getVertexes(negatives), translation) euclidean.translateVector3Path(matrix.getVertexes(positives), translation)