Esempio n. 1
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)
Esempio n. 2
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)
Esempio n. 3
0
File: peg.py Progetto: Ademan/Cura
def getGeometryOutput(derivation, elementNode):
	'Get vector3 vertexes from attribute dictionary.'
	if derivation == None:
		derivation = PegDerivation(elementNode)
	positives = []
	radiusArealized = complex(derivation.radiusArealized, derivation.radiusArealized)
	addPegOutput(derivation.bevel, derivation.endZ, positives, radiusArealized, derivation.sides, derivation.start, derivation.topOverBottom)
	return extrude.getGeometryOutputByNegativesPositives(elementNode, [], positives)
Esempio n. 4
0
def getGeometryOutput(derivation, elementNode):
	'Get vector3 vertexes from attribute dictionary.'
	if derivation == None:
		derivation = PegDerivation(elementNode)
	positives = []
	radiusArealized = complex(derivation.radiusArealized, derivation.radiusArealized)
	addPegOutput(derivation.bevel, derivation.endZ, positives, radiusArealized, derivation.sides, derivation.start, derivation.topOverBottom)
	return extrude.getGeometryOutputByNegativesPositives(elementNode, [], positives)
Esempio n. 5
0
File: peg.py Progetto: Sciumo/SFACT
def getGeometryOutput(derivation, xmlElement):
	"""Get vector3 vertexes from attribute dictionary."""
	if derivation is None:
		derivation = PegDerivation(xmlElement)
	positives = []
	radius = complex(derivation.radius, derivation.radius)
	addPegOutput(derivation.bevel, derivation.endZ, positives, radius, derivation.start, derivation.topOverBottom, xmlElement)
	return extrude.getGeometryOutputByNegativesPositives([], positives, xmlElement)
Esempio n. 6
0
def getGeometryOutput(derivation, xmlElement):
	"Get vector3 vertexes from attribute dictionary."
	if derivation == None:
		derivation = DrillDerivation()
		derivation.setToXMLElement(xmlElement)
	extrudeDerivation = extrude.ExtrudeDerivation()
	negatives = []
	teardrop.addNegativesByDerivation(derivation.end, extrudeDerivation, negatives, derivation.radius, derivation.start, xmlElement)
	return extrude.getGeometryOutputByNegativesPositives(extrudeDerivation, [], negatives, xmlElement)
Esempio n. 7
0
def getGeometryOutput(elementNode):
	'Get vector3 vertexes from attribute dictionary.'
	derivation = LinearBearingCageDerivation(elementNode)
	negatives = []
	positives = []
	if derivation.typeStringFirstCharacter == 'a':
		addAssemblyCage(derivation, negatives, positives)
	else:
		addCage(derivation, derivation.height, negatives, positives)
	return extrude.getGeometryOutputByNegativesPositives(elementNode, negatives, positives)
Esempio n. 8
0
def getGeometryOutput(derivation, xmlElement):
    'Get vector3 vertexes from attribute dictionary.'
    if derivation == None:
        derivation = PegDerivation(xmlElement)
    positives = []
    radius = complex(derivation.radius, derivation.radius)
    addPegOutput(derivation.bevel, derivation.endZ, positives, radius,
                 derivation.start, derivation.topOverBottom, xmlElement)
    return extrude.getGeometryOutputByNegativesPositives([], positives,
                                                         xmlElement)
Esempio n. 9
0
def getGeometryOutput(elementNode):
	'Get vector3 vertexes from attribute dictionary.'
	derivation = LinearBearingCageDerivation(elementNode)
	negatives = []
	positives = []
	if derivation.typeStringFirstCharacter == 'a':
		addAssemblyCage(derivation, negatives, positives)
	else:
		addCage(derivation, derivation.height, negatives, positives)
	return extrude.getGeometryOutputByNegativesPositives(elementNode, negatives, positives)
Esempio n. 10
0
def getGeometryOutput(derivation, xmlElement):
    "Get vector3 vertexes from attribute dictionary."
    if derivation == None:
        derivation = DrillDerivation()
        derivation.setToXMLElement(xmlElement)
    extrudeDerivation = extrude.ExtrudeDerivation()
    negatives = []
    teardrop.addNegativesByDerivation(derivation.end, extrudeDerivation,
                                      negatives, derivation.radius,
                                      derivation.start, xmlElement)
    return extrude.getGeometryOutputByNegativesPositives(
        extrudeDerivation, [], negatives, xmlElement)
Esempio n. 11
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)
Esempio n. 12
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)
Esempio n. 13
0
def getGeometryOutput(xmlElement):
	'Get vector3 vertexes from attribute dictionary.'
	derivation = MechaslabDerivation(xmlElement)
	negatives = []
	positives = []
	addSlab(derivation, positives)
	for hollowPegSocket in derivation.hollowPegSockets:
		addHollowPegSocket(derivation, hollowPegSocket, negatives, positives)
	if 's' in derivation.topBevelPositions:
		addXGroove(derivation, negatives, -derivation.topRight.imag)
	if 'n' in derivation.topBevelPositions:
		addXGroove(derivation, negatives, derivation.topRight.imag)
	if 'w' in derivation.topBevelPositions:
		addYGroove(derivation, negatives, -derivation.topRight.real)
	if 'e' in derivation.topBevelPositions:
		addYGroove(derivation, negatives, derivation.topRight.real)
	return extrude.getGeometryOutputByNegativesPositives(negatives, positives, xmlElement)
Esempio n. 14
0
def getGeometryOutput(xmlElement):
	"""Get vector3 vertexes from attribute dictionary."""
	derivation = MechaslabDerivation(xmlElement)
	negatives = []
	positives = []
	addSlab(derivation, positives)
	for hollowPegSocket in derivation.hollowPegSockets:
		addHollowPegSocket(derivation, hollowPegSocket, negatives, positives)
	if 's' in derivation.topBevelPositions:
		addXGroove(derivation, negatives, -derivation.topRight.imag)
	if 'n' in derivation.topBevelPositions:
		addXGroove(derivation, negatives, derivation.topRight.imag)
	if 'w' in derivation.topBevelPositions:
		addYGroove(derivation, negatives, -derivation.topRight.real)
	if 'e' in derivation.topBevelPositions:
		addYGroove(derivation, negatives, derivation.topRight.real)
	return extrude.getGeometryOutputByNegativesPositives(negatives, positives, xmlElement)
Esempio n. 15
0
def getGeometryOutput(elementNode):
    "Get vector3 vertexes from attribute dictionary."
    derivation = MechaslabDerivation(elementNode)
    negatives = []
    positives = []
    addSlab(derivation, positives)
    for hollowPegSocket in derivation.hollowPegSockets:
        addHollowPegSocket(derivation, hollowPegSocket, negatives, positives)
    if "s" in derivation.topBevelPositions:
        addXGroove(derivation, negatives, -derivation.topRight.imag)
    if "n" in derivation.topBevelPositions:
        addXGroove(derivation, negatives, derivation.topRight.imag)
    if "w" in derivation.topBevelPositions:
        addYGroove(derivation, negatives, -derivation.topRight.real)
    if "e" in derivation.topBevelPositions:
        addYGroove(derivation, negatives, derivation.topRight.real)
    return extrude.getGeometryOutputByNegativesPositives(elementNode, negatives, positives)
Esempio n. 16
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)
Esempio n. 17
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)