Пример #1
0
def getOutputCylinder(gearDerivation, pitchRadius, shaftRimRadius, teeth,
                      twist, vector3GearProfile, vector3ShaftPath, xmlElement):
    "Get extrude output for a cylinder gear."
    vector3LighteningHoles = getLighteningHoles(gearDerivation, pitchRadius,
                                                shaftRimRadius, teeth)
    extrudeDerivation = extrude.ExtrudeDerivation()
    extrudeDerivation.offsetPathDefault = [
        Vector3(), Vector3(0.0, 0.0, gearDerivation.thickness)
    ]
    extrudeDerivation.setToXMLElement(xmlElement)
    negatives = []
    positives = []
    extrude.addNegativesPositives(extrudeDerivation, negatives,
                                  vector3LighteningHoles + [vector3ShaftPath],
                                  positives)
    if twist != 0.0:
        twistDegrees = math.degrees(twist)
        extrudeDerivation.twistPathDefault = []
        for complexPoint in getHelixComplexPath(gearDerivation, xmlElement):
            extrudeDerivation.twistPathDefault.append(
                Vector3(complexPoint.real, twistDegrees * complexPoint.imag))
        extrude.insertTwistPortions(extrudeDerivation, xmlElement)
    extrude.addNegativesPositives(extrudeDerivation, negatives,
                                  [vector3GearProfile], positives)
    return extrude.getGeometryOutputByNegativesPositives(
        extrudeDerivation, negatives, positives, xmlElement)
Пример #2
0
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)
Пример #3
0
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)
Пример #4
0
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)
Пример #5
0
def addCollarShaftSetDerivation(collarDerivation, collarThickness, derivation, negatives, positives, xmlElement):
	'Add collar and shaft.'
	collarSides = evaluate.getSidesMinimumThreeBasedOnPrecision(derivation.shaftRimRadius, xmlElement)
	collarProfile = euclidean.getComplexPolygon(complex(), derivation.shaftRimRadius, collarSides)
	vector3CollarProfile = euclidean.getVector3Path(collarProfile)
	extrude.addNegativesPositives(collarDerivation, negatives, [vector3CollarProfile], positives)
	addShaft(derivation, negatives, positives)
	drillZ = derivation.pinionThickness + 0.5 * collarThickness
	drillEnd = Vector3(0.0, derivation.shaftRimRadius, drillZ)
	drillStart = Vector3(0.0, 0.0, drillZ)
	teardrop.addNegativesByRadius(drillEnd, negatives, derivation.keywayRadius, drillStart, xmlElement)
Пример #6
0
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)
Пример #7
0
def getOutputRack(gearDerivation, vector3GearProfile, xmlElement):
	"Get extrude output for a rack."
	extrudeDerivation = extrude.ExtrudeDerivation()
	helixComplexPath = getHelixComplexPath(gearDerivation, xmlElement)
	extrudeDerivation.offsetPathDefault = []
	for complexPoint in getHelixComplexPath(gearDerivation, xmlElement):
		point = Vector3(gearDerivation.helixThickness * complexPoint.imag, 0.0, gearDerivation.thickness * complexPoint.real)
		extrudeDerivation.offsetPathDefault.append(point)
	extrudeDerivation.setToXMLElement(xmlElement)
	negatives = []
	positives = []
	extrude.addNegativesPositives(extrudeDerivation, negatives, [vector3GearProfile], positives)
	return extrude.getGeometryOutputByNegativesPositives(extrudeDerivation, negatives, positives, xmlElement)
Пример #8
0
def getOutputCylinder(
		collarThickness, derivation, gearHolePaths, pitchRadius, teeth, twist, vector3GearProfile, xmlElement):
	"Get extrude output for a cylinder gear."
	extrudeDerivation = extrude.ExtrudeDerivation()
	extrudeDerivation.offsetPathDefault = [Vector3(), Vector3(0.0, 0.0, derivation.pinionThickness)]
	extrudeDerivation.setToXMLElement(derivation.copyShallow)
	negatives = []
	positives = []
	if twist != 0.0:
		twistDegrees = math.degrees(twist)
		extrudeDerivation.twistPathDefault = []
		for complexPoint in derivation.helixPath:
			extrudeDerivation.twistPathDefault.append(Vector3(complexPoint.real, twistDegrees * complexPoint.imag))
		extrude.insertTwistPortions(extrudeDerivation, xmlElement)
	if derivation.operatingAngle != 180.0:
		addBevelGear(derivation, extrudeDerivation, pitchRadius, positives, teeth, vector3GearProfile)
		addCollarShaft(collarThickness, derivation, negatives, positives, xmlElement)
		return extrude.getGeometryOutputByNegativesPositives(extrudeDerivation, negatives, positives, xmlElement)
	if pitchRadius > 0:
		extrude.addNegativesPositives(extrudeDerivation, negatives, vector3GearProfile, positives)
		addLighteningHoles(derivation, gearHolePaths, negatives, pitchRadius, positives)
		addCollarShaft(collarThickness, derivation, negatives, positives, xmlElement)
		return extrude.getGeometryOutputByNegativesPositives(extrudeDerivation, negatives, positives, xmlElement)
	if derivation.plateThickness <= 0.0:
		extrude.addNegativesPositives(extrudeDerivation, negatives, vector3GearProfile, positives)
		return extrude.getGeometryOutputByNegativesPositives(extrudeDerivation, negatives, positives, xmlElement)
	portionDirections = extrude.getSpacedPortionDirections(extrudeDerivation.interpolationDictionary)
	outerGearProfile = vector3GearProfile[0]
	outerLoopLists = extrude.getLoopListsByPath(extrudeDerivation, None, outerGearProfile, portionDirections)
	addBottomLoop(-derivation.plateClearance, outerLoopLists[0])
	geometryOutput = trianglemesh.getPillarsOutput(outerLoopLists)
	positives.append(geometryOutput)
	innerLoopLists = extrude.getLoopListsByPath(extrudeDerivation, None, vector3GearProfile[1], portionDirections)
	addBottomLoop(-derivation.plateClearance, innerLoopLists[0])
	geometryOutput = trianglemesh.getPillarsOutput(innerLoopLists)
	negatives.append(geometryOutput)
	connectionStart = Vector3(0.0, 0.0, -derivation.plateThickness)
	plateDerivation = extrude.ExtrudeDerivation()
	plateDerivation.offsetPathDefault = [connectionStart, Vector3(0.0, 0.0, -derivation.plateClearance)]
	plateDerivation.setToXMLElement(derivation.copyShallow)
	extrude.addNegativesPositives(plateDerivation, negatives, [outerGearProfile], positives)
	vector3LighteningHoles = getLighteningHoles(derivation, gearHolePaths, pitchRadius)
	extrude.addNegativesPositives(plateDerivation, negatives, vector3LighteningHoles, positives)
	addShaft(derivation, negatives, positives)
	connectionEnd = Vector3(0.0, 0.0, derivation.pinionThickness)
	positiveOutput = trianglemesh.getUnifiedOutput(positives)
	annulusPlateOutput = {'difference' : {'shapes' : [positiveOutput] + negatives}}
	if collarThickness <= 0.0:
		outputCylinder = extrude.getGeometryOutputByConnection(connectionEnd, connectionStart, annulusPlateOutput, xmlElement)
		return getLiftedOutput(derivation, outputCylinder, xmlElement)
	negatives = []
	positives = []
	connectionEnd = Vector3(0.0, 0.0, derivation.pinionThickness + collarThickness)
	collarDerivation = extrude.ExtrudeDerivation()
	collarDerivation.offsetPathDefault = [Vector3(0.0, 0.0, -derivation.plateClearance), connectionEnd]
	addCollarShaftSetDerivation(collarDerivation, collarThickness, derivation, negatives, positives, xmlElement)
	collarOutput = {'difference' : {'shapes' : positives + negatives}}
	cylinderOutput = {'union' : {'shapes' : [annulusPlateOutput, collarOutput]}}
	outputCylinder = extrude.getGeometryOutputByConnection(connectionEnd, connectionStart, cylinderOutput, xmlElement)
	return getLiftedOutput(derivation, outputCylinder, xmlElement)
Пример #9
0
def getOutputRack(gearDerivation, vector3GearProfile, xmlElement):
    "Get extrude output for a rack."
    extrudeDerivation = extrude.ExtrudeDerivation()
    helixComplexPath = getHelixComplexPath(gearDerivation, xmlElement)
    extrudeDerivation.offsetPathDefault = []
    for complexPoint in getHelixComplexPath(gearDerivation, xmlElement):
        point = Vector3(gearDerivation.helixThickness * complexPoint.imag, 0.0,
                        gearDerivation.thickness * complexPoint.real)
        extrudeDerivation.offsetPathDefault.append(point)
    extrudeDerivation.setToXMLElement(xmlElement)
    negatives = []
    positives = []
    extrude.addNegativesPositives(extrudeDerivation, negatives,
                                  [vector3GearProfile], positives)
    return extrude.getGeometryOutputByNegativesPositives(
        extrudeDerivation, negatives, positives, xmlElement)
Пример #10
0
def getOutputCylinder(gearDerivation, pitchRadius, shaftRimRadius, teeth, twist, vector3GearProfile, vector3ShaftPath, xmlElement):
	"Get extrude output for a cylinder gear."
	vector3LighteningHoles = getLighteningHoles(gearDerivation, pitchRadius, shaftRimRadius, teeth)
	extrudeDerivation = extrude.ExtrudeDerivation()
	extrudeDerivation.offsetPathDefault = [Vector3(), Vector3(0.0, 0.0, gearDerivation.thickness)]
	extrudeDerivation.setToXMLElement(xmlElement)
	negatives = []
	positives = []
	extrude.addNegativesPositives(extrudeDerivation, negatives, vector3LighteningHoles + [vector3ShaftPath], positives)
	if twist != 0.0:
		twistDegrees = math.degrees(twist)
		extrudeDerivation.twistPathDefault = []
		for complexPoint in getHelixComplexPath(gearDerivation, xmlElement):
			extrudeDerivation.twistPathDefault.append(Vector3(complexPoint.real, twistDegrees * complexPoint.imag))
		extrude.insertTwistPortions(extrudeDerivation, xmlElement)
	extrude.addNegativesPositives(extrudeDerivation, negatives, [vector3GearProfile], positives)
	return extrude.getGeometryOutputByNegativesPositives(extrudeDerivation, negatives, positives, xmlElement)
Пример #11
0
def getOutputRack(derivation, vector3GearProfile, xmlElement):
	"Get extrude output for a rack."
	path = []
	for complexPoint in derivation.helixPath:
		point = Vector3(derivation.helixThickness * complexPoint.imag, 0.0, derivation.pinionThickness * complexPoint.real)
		path.append(point)
	copyShallow = derivation.xmlElement.getCopyShallow()
	copyShallow.attributeDictionary['path'] = path
	extrudeDerivation = extrude.ExtrudeDerivation(copyShallow)
	negatives = []
	positives = []
	vector3RackProfiles = [vector3GearProfile]
	if derivation.extraRackDemilength > 0.0:
		yMaximum = -912345678.0
		yMinimum = 912345678.0
		for point in vector3GearProfile:
			yMaximum = max(point.y, yMaximum)
			yMinimum = min(point.y, yMinimum)
		muchLessThanWidth = 0.01 * derivation.rackWidth
		yMaximum += muchLessThanWidth
		yMinimum -= muchLessThanWidth
		extraRackLength = derivation.extraRackDemilength + derivation.extraRackDemilength
		rackDemilengthPlus = derivation.rackDemilength + extraRackLength
		leftNegative = [
			Vector3(-derivation.rackDemilength, yMaximum),
			Vector3(-derivation.rackDemilength, yMinimum),
			Vector3(-rackDemilengthPlus, yMinimum),
			Vector3(-rackDemilengthPlus, yMaximum)]
		vector3RackProfiles.append(leftNegative)
		rightNegative = [
			Vector3(rackDemilengthPlus, yMaximum),
			Vector3(rackDemilengthPlus, yMinimum),
			Vector3(derivation.rackDemilength, yMinimum),
			Vector3(derivation.rackDemilength, yMaximum)]
		vector3RackProfiles.append(rightNegative)
	addRackHoles(derivation, vector3RackProfiles, xmlElement)
	extrude.addNegativesPositives(extrudeDerivation, negatives, vector3RackProfiles, positives)
	return extrude.getGeometryOutputByNegativesPositives(extrudeDerivation, negatives, positives, xmlElement)