def getLiftedOutput(derivation, geometryOutput, xmlElement): "Get extrude output for a rack." if derivation.moveType.lower()[: 1] == 'm': return geometryOutput geometryOutputVertexes = matrix.getConnectionVertexes(geometryOutput) translation = Vector3(0.0, 0.0, -euclidean.getBottomPath(geometryOutputVertexes)) euclidean.translateVector3Path(geometryOutputVertexes, translation) return geometryOutput
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 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 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 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 addBottomLoop(deltaZ, loops): "Add bottom loop to loops." bottomLoop = loops[0] bottomAddition = [] bottomZ = euclidean.getBottomPath(bottomLoop) + deltaZ for point in bottomLoop: bottomAddition.append(Vector3Index(len(bottomAddition), point.x, point.y, bottomZ)) loops.insert(0, bottomAddition) numberOfVertexes = 0 for loop in loops: for point in loop: point.index = numberOfVertexes numberOfVertexes += 1