Exemplo n.º 1
0
def getGeometryOutput(xmlElement):
    "Get vector3 vertexes from attribute dictionary."
    fontFamily = evaluate.getEvaluatedStringDefault('Gentium Basic Regular',
                                                    'font-family', xmlElement)
    fontFamily = evaluate.getEvaluatedStringDefault(fontFamily, 'fontFamily',
                                                    xmlElement)
    fontSize = evaluate.getEvaluatedFloatDefault(12.0, 'font-size', xmlElement)
    fontSize = evaluate.getEvaluatedFloatDefault(fontSize, 'fontSize',
                                                 xmlElement)
    textString = evaluate.getEvaluatedStringDefault(xmlElement.text, 'text',
                                                    xmlElement)
    if textString == '':
        print('Warning, textString is empty in getGeometryOutput in text for:')
        print(xmlElement)
        return []
    geometryOutput = []
    for textComplexLoop in svg_reader.getTextComplexLoops(
            fontFamily, fontSize, textString):
        textComplexLoop.reverse()
        vector3Path = euclidean.getVector3Path(textComplexLoop)
        sideLoop = lineation.SideLoop(vector3Path, None, None)
        sideLoop.rotate(xmlElement)
        geometryOutput += lineation.getGeometryOutputByManipulation(
            sideLoop, xmlElement)
    return geometryOutput
Exemplo n.º 2
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.fontFamily = evaluate.getEvaluatedStringDefault('Gentium Basic Regular', 'font-family', xmlElement)
		self.fontFamily = evaluate.getEvaluatedStringDefault(self.fontFamily, 'fontFamily', xmlElement)
		self.fontSize = evaluate.getEvaluatedFloatDefault(12.0, 'font-size', xmlElement)
		self.fontSize = evaluate.getEvaluatedFloatDefault(self.fontSize, 'fontSize', xmlElement)
		self.textString = xmlElement.text
		self.textString = evaluate.getEvaluatedStringDefault(self.textString, 'text', xmlElement)
Exemplo n.º 3
0
 def setToXMLElement(self, xmlElement):
     "Set to the xmlElement."
     self.fontFamily = evaluate.getEvaluatedStringDefault(self.fontFamily, "font-family", xmlElement)
     self.fontFamily = evaluate.getEvaluatedStringDefault(self.fontFamily, "fontFamily", xmlElement)
     self.fontSize = evaluate.getEvaluatedFloatDefault(self.fontSize, "font-size", xmlElement)
     self.fontSize = evaluate.getEvaluatedFloatDefault(self.fontSize, "fontSize", xmlElement)
     if self.textString == "":
         self.textString = xmlElement.text
     self.textString = evaluate.getEvaluatedStringDefault(self.textString, "text", xmlElement)
Exemplo n.º 4
0
	def setToXMLElement(self, xmlElement):
		"Set to the xmlElement."
		self.fontFamily = evaluate.getEvaluatedStringDefault(self.fontFamily, 'font-family', xmlElement)
		self.fontFamily = evaluate.getEvaluatedStringDefault(self.fontFamily, 'fontFamily', xmlElement)
		self.fontSize = evaluate.getEvaluatedFloatDefault(self.fontSize, 'font-size', xmlElement)
		self.fontSize = evaluate.getEvaluatedFloatDefault(self.fontSize, 'fontSize', xmlElement)
		if self.textString == '':
			self.textString = xmlElement.text
		self.textString = evaluate.getEvaluatedStringDefault(self.textString, 'text', xmlElement)
Exemplo n.º 5
0
 def setToXMLElement(self, xmlElement):
     "Set to the xmlElement."
     self.fontFamily = evaluate.getEvaluatedStringDefault(
         self.fontFamily, 'font-family', xmlElement)
     self.fontFamily = evaluate.getEvaluatedStringDefault(
         self.fontFamily, 'fontFamily', xmlElement)
     self.fontSize = evaluate.getEvaluatedFloatDefault(
         self.fontSize, 'font-size', xmlElement)
     self.fontSize = evaluate.getEvaluatedFloatDefault(
         self.fontSize, 'fontSize', xmlElement)
     if self.textString == '':
         self.textString = xmlElement.text
     self.textString = evaluate.getEvaluatedStringDefault(
         self.textString, 'text', xmlElement)
Exemplo n.º 6
0
 def setToXMLElement(self, xmlElement):
     "Set to the xmlElement."
     self.inradius = lineation.getComplexByPrefixes(
         ['demisize', 'inradius'], self.inradius, xmlElement)
     self.inradius = lineation.getComplexByMultiplierPrefix(
         2.0, 'size', self.inradius, xmlElement)
     self.demiwidth = lineation.getFloatByPrefixBeginEnd(
         'demiwidth', 'width', self.inradius.real, xmlElement)
     self.demiheight = lineation.getFloatByPrefixBeginEnd(
         'demiheight', 'height', self.inradius.imag, xmlElement)
     self.packingDensity = evaluate.getEvaluatedFloatByKeys(
         self.packingDensity, ['packingDensity', 'density'], xmlElement)
     self.radius = lineation.getComplexByPrefixBeginEnd(
         'elementRadius', 'elementDiameter', self.radius, xmlElement)
     self.radius = lineation.getComplexByPrefixBeginEnd(
         'radius', 'diameter', self.radius, xmlElement)
     self.seed = evaluate.getEvaluatedIntDefault(self.seed, 'seed',
                                                 xmlElement)
     if len(self.target) < 1:
         self.target = evaluate.getTransformedPathsByKey(
             'target', xmlElement)
     self.typeString = evaluate.getEvaluatedStringDefault(
         self.typeString, 'type', xmlElement)
     self.zigzag = evaluate.getEvaluatedBooleanDefault(
         self.zigzag, 'zigzag', xmlElement)
	def __init__(self, xmlElement):
		'Set defaults.'
		self.length = evaluate.getEvaluatedFloatDefault(50.0, 'length', xmlElement)
		self.demilength = 0.5 * self.length
		self.radius = lineation.getFloatByPrefixBeginEnd('radius', 'diameter', 5.0, xmlElement)
		self.cageClearanceOverRadius = evaluate.getEvaluatedFloatDefault(0.05, 'cageClearanceOverRadius', xmlElement)
		self.cageClearance = self.cageClearanceOverRadius * self.radius
		self.cageClearance = evaluate.getEvaluatedFloatDefault(self.cageClearance, 'cageClearance', xmlElement)
		self.racewayClearanceOverRadius = evaluate.getEvaluatedFloatDefault(0.1, 'racewayClearanceOverRadius', xmlElement)
		self.racewayClearance = self.racewayClearanceOverRadius * self.radius
		self.racewayClearance = evaluate.getEvaluatedFloatDefault(self.racewayClearance, 'racewayClearance', xmlElement)
		self.typeMenuRadioStrings = 'assembly integral'.split()
		self.typeString = evaluate.getEvaluatedStringDefault('assembly', 'type', xmlElement)
		self.typeStringFirstCharacter = self.typeString[: 1 ].lower()
		self.wallThicknessOverRadius = evaluate.getEvaluatedFloatDefault(0.5, 'wallThicknessOverRadius', xmlElement)
		self.wallThickness = self.wallThicknessOverRadius * self.radius
		self.wallThickness = evaluate.getEvaluatedFloatDefault(self.wallThickness, 'wallThickness', xmlElement)
		self.zenithAngle = evaluate.getEvaluatedFloatDefault(45.0, 'zenithAngle', xmlElement)
		self.zenithRadian = math.radians(self.zenithAngle)
		self.demiheight = self.radius * math.cos(self.zenithRadian) - self.racewayClearance
		self.height = self.demiheight + self.demiheight
		self.radiusPlusClearance = self.radius + self.cageClearance
		self.cageRadius = self.radiusPlusClearance + self.wallThickness
		self.demiwidth = self.cageRadius
		self.bearingCenterX = self.cageRadius - self.demilength
		separation = self.cageRadius + self.radiusPlusClearance
		bearingLength = -self.bearingCenterX - self.bearingCenterX
		self.numberOfSteps = int(math.floor(bearingLength / separation))
		self.stepX = bearingLength / float(self.numberOfSteps)
		self.bearingCenterXs = getBearingCenterXs(self.bearingCenterX, self.numberOfSteps, self.stepX)
		self.xmlElement = xmlElement
		if self.typeStringFirstCharacter == 'a':
			self.setAssemblyCage()
		self.rectangleCenterX = self.demiwidth - self.demilength
Exemplo n.º 8
0
	def setToXMLElement(self, xmlElement):
		"Set to the xmlElement."
		self.closed = evaluate.getEvaluatedBooleanDefault(False, 'closed', xmlElement)
		self.end = evaluate.getVector3ByPrefix('end', self.end, xmlElement)
		self.start = evaluate.getVector3ByPrefix('start', self.start, xmlElement)
		self.step = evaluate.getEvaluatedFloatDefault(self.step, 'step', xmlElement)
		self.steps = evaluate.getEvaluatedFloatDefault(self.steps, 'steps', xmlElement)
		self.typeString = evaluate.getEvaluatedStringDefault(self.typeString, 'type', xmlElement)
Exemplo n.º 9
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.closed = evaluate.getEvaluatedBooleanDefault(False, 'closed', xmlElement)
		self.end = evaluate.getVector3ByPrefix(Vector3(), 'end', xmlElement)
		self.start = evaluate.getVector3ByPrefix(Vector3(), 'start', xmlElement)
		self.step = evaluate.getEvaluatedFloatDefault(None, 'step', xmlElement)
		self.steps = evaluate.getEvaluatedFloatDefault(None, 'steps', xmlElement)
		self.typeMenuRadioStrings = 'average maximum minimum'.split()
		self.typeString = evaluate.getEvaluatedStringDefault('minimum', 'type', xmlElement)
Exemplo n.º 10
0
def getGeometryOutput(xmlElement):
	"Get vector3 vertexes from attribute dictionary."
	fontFamily = evaluate.getEvaluatedStringDefault('Gentium Basic Regular', 'font-family', xmlElement)
	fontFamily = evaluate.getEvaluatedStringDefault(fontFamily, 'fontFamily', xmlElement)
	fontSize = evaluate.getEvaluatedFloatDefault(12.0, 'font-size', xmlElement)
	fontSize = evaluate.getEvaluatedFloatDefault(fontSize, 'fontSize', xmlElement)
	textString = evaluate.getEvaluatedStringDefault(xmlElement.text, 'text', xmlElement)
	if textString == '':
		print('Warning, textString is empty in getGeometryOutput in text for:')
		print(xmlElement)
		return []
	geometryOutput = []
	for textComplexLoop in svg_reader.getTextComplexLoops(fontFamily, fontSize, textString):
		textComplexLoop.reverse()
		vector3Path = euclidean.getVector3Path(textComplexLoop)
		sideLoop = lineation.SideLoop(vector3Path, None, None)
		sideLoop.rotate(xmlElement)
		geometryOutput += lineation.getGeometryOutputByManipulation(sideLoop, xmlElement)
	return geometryOutput
Exemplo n.º 11
0
def writeXMLElement(fileNames, target, xmlElement):
	"Write target."
	object = target.object
	if object == None:
		print('Warning, writeTarget in write could not get object for:')
		print(xmlElement)
		return
	fileNameRoot = evaluate.getEvaluatedStringDefault('', 'name', target)
	fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'id', target)
	fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'file', xmlElement)
	fileNameRoot += evaluate.getEvaluatedStringDefault('', 'suffix', xmlElement)
	extension = evaluate.getEvaluatedStringDefault(object.getFabricationExtension(), 'extension', xmlElement)
	fileName = '%s.%s' % (fileNameRoot, extension)
	suffixIndex = 1
	while fileName in fileNames:
		fileName = '%s_%s.%s' % (fileNameRoot, suffixIndex, extension)
		suffixIndex += 1
	folderName = evaluate.getEvaluatedStringDefault('', 'folder', xmlElement)
	absoluteFolderDirectory = os.path.join(os.path.dirname(xmlElement.getRoot().parser.fileName), folderName)
	absoluteFileName = os.path.abspath(os.path.join(absoluteFolderDirectory, fileName))
	if 'models/' not in absoluteFileName:
		print('Warning, models/ was not in the absolute file path, so for security nothing will be done for:')
		print(xmlElement)
		print('For which the absolute file path is:')
		print(absoluteFileName)
		print('The write tool can only write a file which has models/ in the file path.')
		print('To write the file, move the file into a folder called model/ or a subfolder which is inside the model folder tree.')
		return
	fileNames.append(fileName)
	archive.makeDirectory(absoluteFolderDirectory)
	if not evaluate.getEvaluatedBooleanDefault(True, 'writeMatrix', xmlElement):
		object.matrix4X4 = matrix.Matrix()
	print('The write tool generated the file:')
	print(absoluteFileName)
	archive.writeFileText(absoluteFileName, object.getFabricationText())
Exemplo n.º 12
0
def writeXMLElement(fileNames, target, xmlElement):
    "Write target."
    object = target.object
    if object == None:
        print('Warning, writeTarget in write could not get object for:')
        print(xmlElement)
        return
    fileNameRoot = evaluate.getEvaluatedStringDefault('', 'name', target)
    fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'id',
                                                      target)
    fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'file',
                                                      xmlElement)
    fileNameRoot += evaluate.getEvaluatedStringDefault('', 'suffix',
                                                       xmlElement)
    extension = evaluate.getEvaluatedStringDefault(
        object.getFabricationExtension(), 'extension', xmlElement)
    fileName = '%s.%s' % (fileNameRoot, extension)
    suffixIndex = 1
    while fileName in fileNames:
        fileName = '%s_%s.%s' % (fileNameRoot, suffixIndex, extension)
        suffixIndex += 1
    fileNames.append(fileName)
    folderName = evaluate.getEvaluatedStringDefault('', 'folder', xmlElement)
    absoluteFolderDirectory = os.path.join(
        os.path.dirname(xmlElement.getRoot().parser.fileName), folderName)
    archive.makeDirectory(absoluteFolderDirectory)
    archive.writeFileText(os.path.join(absoluteFolderDirectory, fileName),
                          object.getFabricationText())
Exemplo n.º 13
0
 def __init__(self, xmlElement):
     'Set defaults.'
     self.closed = evaluate.getEvaluatedBooleanDefault(
         False, 'closed', xmlElement)
     self.end = evaluate.getVector3ByPrefix(Vector3(), 'end', xmlElement)
     self.start = evaluate.getVector3ByPrefix(Vector3(), 'start',
                                              xmlElement)
     self.step = evaluate.getEvaluatedFloatDefault(None, 'step', xmlElement)
     self.steps = evaluate.getEvaluatedFloatDefault(None, 'steps',
                                                    xmlElement)
     self.typeMenuRadioStrings = 'average maximum minimum'.split()
     self.typeString = evaluate.getEvaluatedStringDefault(
         'minimum', 'type', xmlElement)
Exemplo n.º 14
0
 def setToXMLElement(self, xmlElement):
     "Set to the xmlElement."
     self.closed = evaluate.getEvaluatedBooleanDefault(
         False, 'closed', xmlElement)
     self.end = evaluate.getVector3ByPrefix(self.end, 'end', xmlElement)
     self.start = evaluate.getVector3ByPrefix(self.start, 'start',
                                              xmlElement)
     self.step = evaluate.getEvaluatedFloatDefault(self.step, 'step',
                                                   xmlElement)
     self.steps = evaluate.getEvaluatedFloatDefault(self.steps, 'steps',
                                                    xmlElement)
     self.typeString = evaluate.getEvaluatedStringDefault(
         self.typeString, 'type', xmlElement)
Exemplo n.º 15
0
	def setToXMLElement(self, xmlElement):
		"Set to the xmlElement."
		self.inradius = lineation.getComplexByPrefixes(['demisize', 'inradius'], self.inradius, xmlElement)
		self.inradius = lineation.getComplexByMultiplierPrefix(2.0, 'size', self.inradius, xmlElement)
		self.demiwidth = lineation.getFloatByPrefixBeginEnd('demiwidth', 'width', self.inradius.real, xmlElement)
		self.demiheight = lineation.getFloatByPrefixBeginEnd('demiheight', 'height', self.inradius.imag, xmlElement)
		self.packingDensity = evaluate.getEvaluatedFloatByKeys(self.packingDensity, ['packingDensity', 'density'], xmlElement)
		self.radius = lineation.getComplexByPrefixBeginEnd('elementRadius', 'elementDiameter', self.radius, xmlElement)
		self.radius = lineation.getComplexByPrefixBeginEnd('radius', 'diameter', self.radius, xmlElement)
		self.seed = evaluate.getEvaluatedIntDefault(self.seed, 'seed', xmlElement)
		if len(self.target) < 1:
			self.target = evaluate.getTransformedPathsByKey('target', xmlElement)
		self.typeString = evaluate.getEvaluatedStringDefault(self.typeString, 'type', xmlElement)
		self.zigzag = evaluate.getEvaluatedBooleanDefault(self.zigzag, 'zigzag', xmlElement)
Exemplo n.º 16
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.inradius = lineation.getComplexByPrefixes(['demisize', 'inradius'], complex(10.0, 10.0), xmlElement)
		self.inradius = lineation.getComplexByMultiplierPrefix(2.0, 'size', self.inradius, xmlElement)
		self.demiwidth = lineation.getFloatByPrefixBeginEnd('demiwidth', 'width', self.inradius.real, xmlElement)
		self.demiheight = lineation.getFloatByPrefixBeginEnd('demiheight', 'height', self.inradius.imag, xmlElement)
		self.packingDensity = evaluate.getEvaluatedFloatByKeys(0.2, ['packingDensity', 'density'], xmlElement)
		self.radius = lineation.getComplexByPrefixBeginEnd('elementRadius', 'elementDiameter', complex(1.0, 1.0), xmlElement)
		self.radius = lineation.getComplexByPrefixBeginEnd('radius', 'diameter', self.radius, xmlElement)
		self.seed = evaluate.getEvaluatedIntDefault(None, 'seed', xmlElement)
		self.target = evaluate.getTransformedPathsByKey([], 'target', xmlElement)
		self.typeMenuRadioStrings = 'hexagonal random rectangular'.split()
		self.typeString = evaluate.getEvaluatedStringDefault('rectangular', 'type', xmlElement)
		self.zigzag = evaluate.getEvaluatedBooleanDefault(True, 'zigzag', xmlElement)
Exemplo n.º 17
0
def getGeometryOutput(xmlElement):
	"Get vector3 vertexes from attribute dictionary."
	start = evaluate.getVector3ByPrefix('start', Vector3(), xmlElement)
	end = evaluate.getVector3ByPrefix('end', Vector3(), xmlElement)
	endMinusStart = end - start
	endMinusStartLength = abs(endMinusStart)
	if endMinusStartLength <= 0.0:
		print('Warning, end is the same as start in getGeometryOutput in line for:')
		print(start)
		print(end)
		print(xmlElement)
		return None
	steps = evaluate.getEvaluatedFloatDefault(None, 'steps', xmlElement)
	step = evaluate.getEvaluatedFloatDefault(None, 'step', xmlElement)
	xmlElement.attributeDictionary['closed'] = str(evaluate.getEvaluatedBooleanDefault(False, 'closed', xmlElement))
	if step == None and steps == None:
		return lineation.getGeometryOutputByLoop(lineation.SideLoop([start, end]), xmlElement)
	loop = [start]
	if step != None and steps != None:
		stepVector = step / endMinusStartLength * endMinusStart
		end = start + stepVector * steps
		return getGeometryOutputByStep(end, loop, steps, stepVector, xmlElement)
	if step == None:
		stepVector = endMinusStart / steps
		return getGeometryOutputByStep(end, loop, steps, stepVector, xmlElement)
	typeString = evaluate.getEvaluatedStringDefault('minimum', 'type', xmlElement)
	endMinusStartLengthOverStep = endMinusStartLength / step
	if typeString == 'average':
		steps = max(1.0, round(endMinusStartLengthOverStep))
		stepVector = step / endMinusStartLength * endMinusStart
		end = start + stepVector * steps
		return getGeometryOutputByStep(end, loop, steps, stepVector, xmlElement)
	if typeString == 'maximum':
		steps = math.ceil(endMinusStartLengthOverStep)
		if steps < 1.0:
			return lineation.getGeometryOutputByLoop(lineation.SideLoop([start, end]), xmlElement)
		stepVector = endMinusStart / steps
		return getGeometryOutputByStep(end, loop, steps, stepVector, xmlElement)
	if typeString == 'minimum':
		steps = math.floor(endMinusStartLengthOverStep)
		if steps < 1.0:
			return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop), xmlElement)
		stepVector = endMinusStart / steps
		return getGeometryOutputByStep(end, loop, steps, stepVector, xmlElement)
	print('Warning, the step type was not one of (average, maximum or minimum) in getGeometryOutput in line for:')
	print(typeString)
	print(xmlElement)
	loop.append(end)
	return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop), xmlElement)
Exemplo n.º 18
0
 def __init__(self, xmlElement):
     'Set defaults.'
     self.length = evaluate.getEvaluatedFloatDefault(
         50.0, 'length', xmlElement)
     self.demilength = 0.5 * self.length
     self.radius = lineation.getFloatByPrefixBeginEnd(
         'radius', 'diameter', 5.0, xmlElement)
     self.cageClearanceOverRadius = evaluate.getEvaluatedFloatDefault(
         0.05, 'cageClearanceOverRadius', xmlElement)
     self.cageClearance = self.cageClearanceOverRadius * self.radius
     self.cageClearance = evaluate.getEvaluatedFloatDefault(
         self.cageClearance, 'cageClearance', xmlElement)
     self.racewayClearanceOverRadius = evaluate.getEvaluatedFloatDefault(
         0.1, 'racewayClearanceOverRadius', xmlElement)
     self.racewayClearance = self.racewayClearanceOverRadius * self.radius
     self.racewayClearance = evaluate.getEvaluatedFloatDefault(
         self.racewayClearance, 'racewayClearance', xmlElement)
     self.typeMenuRadioStrings = 'assembly integral'.split()
     self.typeString = evaluate.getEvaluatedStringDefault(
         'assembly', 'type', xmlElement)
     self.typeStringFirstCharacter = self.typeString[:1].lower()
     self.wallThicknessOverRadius = evaluate.getEvaluatedFloatDefault(
         0.5, 'wallThicknessOverRadius', xmlElement)
     self.wallThickness = self.wallThicknessOverRadius * self.radius
     self.wallThickness = evaluate.getEvaluatedFloatDefault(
         self.wallThickness, 'wallThickness', xmlElement)
     self.zenithAngle = evaluate.getEvaluatedFloatDefault(
         45.0, 'zenithAngle', xmlElement)
     self.zenithRadian = math.radians(self.zenithAngle)
     self.demiheight = self.radius * math.cos(
         self.zenithRadian) - self.racewayClearance
     self.height = self.demiheight + self.demiheight
     self.radiusPlusClearance = self.radius + self.cageClearance
     self.cageRadius = self.radiusPlusClearance + self.wallThickness
     self.demiwidth = self.cageRadius
     self.bearingCenterX = self.cageRadius - self.demilength
     separation = self.cageRadius + self.radiusPlusClearance
     bearingLength = -self.bearingCenterX - self.bearingCenterX
     self.numberOfSteps = int(math.floor(bearingLength / separation))
     self.stepX = bearingLength / float(self.numberOfSteps)
     self.bearingCenterXs = getBearingCenterXs(self.bearingCenterX,
                                               self.numberOfSteps,
                                               self.stepX)
     self.xmlElement = xmlElement
     if self.typeStringFirstCharacter == 'a':
         self.setAssemblyCage()
     self.rectangleCenterX = self.demiwidth - self.demilength
Exemplo n.º 19
0
def writeXMLElement(fileNames, target, xmlElement):
    "Write target."
    object = target.object
    if object == None:
        print('Warning, writeTarget in write could not get object for:')
        print(xmlElement)
        return
    fileNameRoot = evaluate.getEvaluatedStringDefault('', 'name', target)
    fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'id',
                                                      target)
    fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'file',
                                                      xmlElement)
    fileNameRoot += evaluate.getEvaluatedStringDefault('', 'suffix',
                                                       xmlElement)
    extension = evaluate.getEvaluatedStringDefault(
        object.getFabricationExtension(), 'extension', xmlElement)
    fileName = '%s.%s' % (fileNameRoot, extension)
    suffixIndex = 1
    while fileName in fileNames:
        fileName = '%s_%s.%s' % (fileNameRoot, suffixIndex, extension)
        suffixIndex += 1
    folderName = evaluate.getEvaluatedStringDefault('', 'folder', xmlElement)
    absoluteFolderDirectory = os.path.join(
        os.path.dirname(xmlElement.getRoot().parser.fileName), folderName)
    absoluteFileName = os.path.abspath(
        os.path.join(absoluteFolderDirectory, fileName))
    if 'models/' not in absoluteFileName:
        print(
            'Warning, models/ was not in the absolute file path, so for security nothing will be done for:'
        )
        print(xmlElement)
        print('For which the absolute file path is:')
        print(absoluteFileName)
        print(
            'The write tool can only write a file which has models/ in the file path.'
        )
        print(
            'To write the file, move the file into a folder called model/ or a subfolder which is inside the model folder tree.'
        )
        return
    fileNames.append(fileName)
    archive.makeDirectory(absoluteFolderDirectory)
    if not evaluate.getEvaluatedBooleanDefault(True, 'writeMatrix',
                                               xmlElement):
        object.matrix4X4 = matrix.Matrix()
    print('The write tool generated the file:')
    print(absoluteFileName)
    archive.writeFileText(absoluteFileName, object.getFabricationText())
Exemplo n.º 20
0
def getGeometryOutput(xmlElement):
	"Get vector3 vertexes from attribute dictionary."
	inradius = lineation.getComplexByPrefixes(['demisize', 'inradius'], complex(5.0, 5.0), xmlElement)
	inradius = lineation.getComplexByMultiplierPrefix(2.0, 'size', inradius, xmlElement)
	demiwidth = lineation.getFloatByPrefixBeginEnd('demiwidth', 'width', inradius.real, xmlElement)
	demiheight = lineation.getFloatByPrefixBeginEnd('demiheight', 'height', inradius.imag, xmlElement)
	radius = lineation.getComplexByPrefixBeginEnd('elementRadius', 'elementDiameter', complex(1.0, 1.0), xmlElement)
	radius = lineation.getComplexByPrefixBeginEnd('radius', 'diameter', radius, xmlElement)
	diameter = radius + radius
	typeString = evaluate.getEvaluatedStringDefault('rectangular', 'type', xmlElement)
	typeStringTwoCharacters = typeString.lower()[: 2]
	typeStringFirstCharacter = typeStringTwoCharacters[: 1]
	zigzag = evaluate.getEvaluatedBooleanDefault(True, 'zigzag', xmlElement)
	topRight = complex(demiwidth, demiheight)
	bottomLeft = -topRight
	loopsComplex = [euclidean.getSquareLoopWiddershins(bottomLeft, topRight)]
	paths = evaluate.getTransformedPathsByKey('target', xmlElement)
	if len(paths) > 0:
		loopsComplex = euclidean.getComplexPaths(paths)
	maximumComplex = euclidean.getMaximumByPathsComplex(loopsComplex)
	minimumComplex = euclidean.getMinimumByPathsComplex(loopsComplex)
	gridPath = None
	if typeStringTwoCharacters == 'he':
		gridPath = getHexagonalGrid(diameter, loopsComplex, maximumComplex, minimumComplex, zigzag)
	elif typeStringTwoCharacters == 'ra' or typeStringFirstCharacter == 'a':
		gridPath = getRandomGrid(diameter, loopsComplex, maximumComplex, minimumComplex, xmlElement)
	elif typeStringTwoCharacters == 're' or typeStringFirstCharacter == 'e':
		gridPath = getRectangularGrid(diameter, loopsComplex, maximumComplex, minimumComplex, zigzag)
	if gridPath == None:
		print('Warning, the step type was not one of (hexagonal, random or rectangular) in getGeometryOutput in grid for:')
		print(typeString)
		print(xmlElement)
		return []
	loop = euclidean.getVector3Path(gridPath)
	xmlElement.attributeDictionary['closed'] = 'false'
	return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop, 0.5 * math.pi), xmlElement)
Exemplo n.º 21
0
 def __init__(self, xmlElement):
     'Set defaults.'
     self.inradius = lineation.getComplexByPrefixes(
         ['demisize', 'inradius'], complex(10.0, 10.0), xmlElement)
     self.inradius = lineation.getComplexByMultiplierPrefix(
         2.0, 'size', self.inradius, xmlElement)
     self.demiwidth = lineation.getFloatByPrefixBeginEnd(
         'demiwidth', 'width', self.inradius.real, xmlElement)
     self.demiheight = lineation.getFloatByPrefixBeginEnd(
         'demiheight', 'height', self.inradius.imag, xmlElement)
     self.packingDensity = evaluate.getEvaluatedFloatByKeys(
         0.2, ['packingDensity', 'density'], xmlElement)
     self.radius = lineation.getComplexByPrefixBeginEnd(
         'elementRadius', 'elementDiameter', complex(1.0, 1.0), xmlElement)
     self.radius = lineation.getComplexByPrefixBeginEnd(
         'radius', 'diameter', self.radius, xmlElement)
     self.seed = evaluate.getEvaluatedIntDefault(None, 'seed', xmlElement)
     self.target = evaluate.getTransformedPathsByKey([], 'target',
                                                     xmlElement)
     self.typeMenuRadioStrings = 'hexagonal random rectangular'.split()
     self.typeString = evaluate.getEvaluatedStringDefault(
         'rectangular', 'type', xmlElement)
     self.zigzag = evaluate.getEvaluatedBooleanDefault(
         True, 'zigzag', xmlElement)
Exemplo n.º 22
0
def writeXMLElement(fileNames, target, xmlElement):
	"Write target."
	object = target.object
	if object == None:
		print('Warning, writeTarget in write could not get object for:')
		print(xmlElement)
		return
	fileNameRoot = evaluate.getEvaluatedStringDefault('', 'name', target)
	fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'id', target)
	fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'file', xmlElement)
	fileNameRoot += evaluate.getEvaluatedStringDefault('', 'suffix', xmlElement)
	extension = evaluate.getEvaluatedStringDefault(object.getFabricationExtension(), 'extension', xmlElement)
	fileName = '%s.%s' % (fileNameRoot, extension)
	suffixIndex = 1
	while fileName in fileNames:
		fileName = '%s_%s.%s' % (fileNameRoot, suffixIndex, extension)
		suffixIndex += 1
	fileNames.append(fileName)
	folderName = evaluate.getEvaluatedStringDefault('', 'folder', xmlElement)
	absoluteFolderDirectory = os.path.join(os.path.dirname(xmlElement.getRoot().parser.fileName), folderName)
	archive.makeDirectory(absoluteFolderDirectory)
	archive.writeFileText(os.path.join(absoluteFolderDirectory, fileName), object.getFabricationText())
Exemplo n.º 23
0
 def setToXMLElement(self, xmlElement):
     "Set to the xmlElement."
     self.bevelOverClearance = evaluate.getEvaluatedFloatDefault(
         self.bevelOverClearance, 'bevelOverClearance', xmlElement)
     self.clearanceOverWavelength = evaluate.getEvaluatedFloatDefault(
         self.clearanceOverWavelength, 'clearanceOverWavelength',
         xmlElement)
     self.collarWidthOverShaftRadius = evaluate.getEvaluatedFloatDefault(
         self.collarWidthOverShaftRadius, 'collarWidthOverShaftRadius',
         xmlElement)
     self.creationType = evaluate.getEvaluatedStringDefault(
         self.creationType, 'creationType', xmlElement)
     self.helixAngle = evaluate.getEvaluatedFloatDefault(
         self.helixAngle, 'helixAngle', xmlElement)
     self.helixType = evaluate.getEvaluatedStringDefault(
         self.helixType, 'helixType', xmlElement)
     self.lighteningHoleMarginOverRimWidth = evaluate.getEvaluatedFloatDefault(
         self.lighteningHoleMarginOverRimWidth,
         'lighteningHoleMarginOverRimWidth', xmlElement)
     self.lighteningHoleMinimumRadius = evaluate.getEvaluatedFloatDefault(
         self.lighteningHoleMinimumRadius, 'lighteningHoleMinimumRadius',
         xmlElement)
     self.moveType = evaluate.getEvaluatedStringDefault(
         self.moveType, 'moveType', xmlElement)
     self.pitchRadius = evaluate.getEvaluatedFloatDefault(
         self.pitchRadius, 'pitchRadius', xmlElement)
     self.pressureAngle = evaluate.getEvaluatedFloatDefault(
         self.pressureAngle, 'pressureAngle', xmlElement)
     self.profileDefinitionSurfaces = evaluate.getEvaluatedIntDefault(
         self.profileDefinitionSurfaces, 'profileDefinitionSurfaces',
         xmlElement)
     self.rackLengthOverRadius = evaluate.getEvaluatedFloatDefault(
         self.rackLengthOverRadius, 'rackLengthOverRadius', xmlElement)
     self.rackWidthOverThickness = evaluate.getEvaluatedFloatDefault(
         self.rackWidthOverThickness, 'rackWidthOverThickness', xmlElement)
     self.rimWidthOverRadius = evaluate.getEvaluatedFloatDefault(
         self.rimWidthOverRadius, 'rimWidthOverRadius', xmlElement)
     self.shaftDepthBottomOverRadius = evaluate.getEvaluatedFloatDefault(
         self.shaftDepthBottomOverRadius, 'shaftDepthBottomOverRadius',
         xmlElement)
     self.shaftDepthTopOverRadius = evaluate.getEvaluatedFloatDefault(
         self.shaftDepthTopOverRadius, 'shaftDepthOverRadius', xmlElement)
     self.shaftDepthTopOverRadius = evaluate.getEvaluatedFloatDefault(
         self.shaftDepthTopOverRadius, 'shaftDepthTopOverRadius',
         xmlElement)
     self.shaftRadiusOverPitchRadius = evaluate.getEvaluatedFloatDefault(
         self.shaftRadiusOverPitchRadius, 'shaftRadiusOverPitchRadius',
         xmlElement)
     self.shaftSides = evaluate.getEvaluatedIntDefault(
         self.shaftSides, 'shaftSides', xmlElement)
     self.teethPinion = evaluate.getEvaluatedIntDefault(
         self.teethPinion, 'teeth', xmlElement)
     self.teethPinion = evaluate.getEvaluatedIntDefault(
         self.teethPinion, 'teethPinion', xmlElement)
     self.teethSecond = evaluate.getEvaluatedIntDefault(
         self.teethSecond, 'teethSecond', xmlElement)
     self.thickness = evaluate.getEvaluatedFloatDefault(
         self.thickness, 'thickness', xmlElement)
     # Set absolute variables.
     self.wavelength = self.pitchRadius * 2.0 * math.pi / float(
         self.teethPinion)
     if self.clearance == None:
         self.clearance = self.wavelength * self.clearanceOverWavelength
     self.clearance = evaluate.getEvaluatedFloatDefault(
         self.clearance, 'clearance', xmlElement)
     if self.bevel == None:
         self.bevel = self.clearance * self.bevelOverClearance
     self.bevel = evaluate.getEvaluatedFloatDefault(self.bevel, 'bevel',
                                                    xmlElement)
     if self.rackLength == None:
         self.rackLength = self.pitchRadius * self.rackLengthOverRadius
     self.rackLength = evaluate.getEvaluatedFloatDefault(
         self.rackLength, 'rackLength', xmlElement)
     if self.rackWidth == None:
         self.rackWidth = self.thickness * self.rackWidthOverThickness
     self.rackWidth = evaluate.getEvaluatedFloatDefault(
         self.rackWidth, 'rackWidth', xmlElement)
     if self.rimWidth == None:
         self.rimWidth = self.pitchRadius * self.rimWidthOverRadius
     self.rimWidth = evaluate.getEvaluatedFloatDefault(
         self.rimWidth, 'rimWidth', xmlElement)
     if self.shaftRadius == None:
         self.shaftRadius = self.pitchRadius * self.shaftRadiusOverPitchRadius
     self.shaftRadius = evaluate.getEvaluatedFloatDefault(
         self.shaftRadius, 'shaftRadius', xmlElement)
     if self.collarWidth == None:
         self.collarWidth = self.shaftRadius * self.collarWidthOverShaftRadius
     self.collarWidth = evaluate.getEvaluatedFloatDefault(
         self.collarWidth, 'collarWidth', xmlElement)
     if self.lighteningHoleMargin == None:
         self.lighteningHoleMargin = self.rimWidth * self.lighteningHoleMarginOverRimWidth
     self.lighteningHoleMargin = evaluate.getEvaluatedFloatDefault(
         self.lighteningHoleMargin, 'lighteningHoleMargin', xmlElement)
     if self.shaftDepthBottom == None:
         self.shaftDepthBottom = self.shaftRadius * self.shaftDepthBottomOverRadius
     self.shaftDepthBottom = evaluate.getEvaluatedFloatDefault(
         self.shaftDepthBottom, 'shaftDepthBottom', xmlElement)
     if self.shaftDepthTop == None:
         self.shaftDepthTop = self.shaftRadius * self.shaftDepthTopOverRadius
     self.shaftDepthTop = evaluate.getEvaluatedFloatDefault(
         self.shaftDepthTop, 'shaftDepth', xmlElement)
     self.shaftDepthTop = evaluate.getEvaluatedFloatDefault(
         self.shaftDepthTop, 'shaftDepthTop', xmlElement)
     # Set derived values.
     self.helixRadian = math.radians(self.helixAngle)
     self.tanHelix = math.tan(self.helixRadian)
     self.helixThickness = self.tanHelix * self.thickness
     self.pressureRadian = math.radians(self.pressureAngle)
     self.cosPressure = math.cos(self.pressureRadian)
     self.sinPressure = math.sin(self.pressureRadian)
     self.tanPressure = math.tan(self.pressureRadian)
     # tooth multiplied by 0.99 is because at greater than 0.99 there is an intersection
     self.xToothMultiplier = 0.99 - 0.01 * self.tanHelix
     self.halfWavelength = 0.5 * self.wavelength
     self.quarterWavelength = 0.25 * self.wavelength
     self.pinionToothProfile = getToothProfileHalfCylinder(
         self, self.pitchRadius, self.teethPinion)
     self.addendum = self.pinionToothProfile[-1].imag - self.pitchRadius
     self.dedendum = abs(
         self.pinionToothProfile[-1]) - self.pitchRadius + self.clearance
     self.xmlElement = xmlElement
Exemplo n.º 24
0
def getGeometryOutput(xmlElement):
    "Get vector3 vertexes from attribute dictionary."
    start = evaluate.getVector3ByPrefix('start', Vector3(), xmlElement)
    end = evaluate.getVector3ByPrefix('end', Vector3(), xmlElement)
    endMinusStart = end - start
    endMinusStartLength = abs(endMinusStart)
    if endMinusStartLength <= 0.0:
        print(
            'Warning, end is the same as start in getGeometryOutput in line for:'
        )
        print(start)
        print(end)
        print(xmlElement)
        return None
    steps = evaluate.getEvaluatedFloatDefault(None, 'steps', xmlElement)
    step = evaluate.getEvaluatedFloatDefault(None, 'step', xmlElement)
    xmlElement.attributeDictionary['closed'] = str(
        evaluate.getEvaluatedBooleanDefault(False, 'closed', xmlElement))
    if step == None and steps == None:
        return lineation.getGeometryOutputByLoop(
            lineation.SideLoop([start, end]), xmlElement)
    loop = [start]
    if step != None and steps != None:
        stepVector = step / endMinusStartLength * endMinusStart
        end = start + stepVector * steps
        return getGeometryOutputByStep(end, loop, steps, stepVector,
                                       xmlElement)
    if step == None:
        stepVector = endMinusStart / steps
        return getGeometryOutputByStep(end, loop, steps, stepVector,
                                       xmlElement)
    typeString = evaluate.getEvaluatedStringDefault('minimum', 'type',
                                                    xmlElement)
    endMinusStartLengthOverStep = endMinusStartLength / step
    if typeString == 'average':
        steps = max(1.0, round(endMinusStartLengthOverStep))
        stepVector = step / endMinusStartLength * endMinusStart
        end = start + stepVector * steps
        return getGeometryOutputByStep(end, loop, steps, stepVector,
                                       xmlElement)
    if typeString == 'maximum':
        steps = math.ceil(endMinusStartLengthOverStep)
        if steps < 1.0:
            return lineation.getGeometryOutputByLoop(
                lineation.SideLoop([start, end]), xmlElement)
        stepVector = endMinusStart / steps
        return getGeometryOutputByStep(end, loop, steps, stepVector,
                                       xmlElement)
    if typeString == 'minimum':
        steps = math.floor(endMinusStartLengthOverStep)
        if steps < 1.0:
            return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop),
                                                     xmlElement)
        stepVector = endMinusStart / steps
        return getGeometryOutputByStep(end, loop, steps, stepVector,
                                       xmlElement)
    print(
        'Warning, the step type was not one of (average, maximum or minimum) in getGeometryOutput in line for:'
    )
    print(typeString)
    print(xmlElement)
    loop.append(end)
    return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop),
                                             xmlElement)
Exemplo n.º 25
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.clearanceOverWavelength = evaluate.getEvaluatedFloatDefault(0.1, 'clearanceOverWavelength', xmlElement)
		self.collarWidthOverShaftRadius = evaluate.getEvaluatedFloatDefault(1.0, 'collarWidthOverShaftRadius', xmlElement)
		self.copyShallow = xmlElement.getCopyShallow()
		self.creationType = evaluate.getEvaluatedStringDefault('both', 'creationType', xmlElement)
		self.creationTypeMenuRadioStrings = 'both first second'.split()
		self.gearCollarThicknessOverThickness = evaluate.getEvaluatedFloatDefault(
			0.0, 'gearCollarThicknessOverThickness', xmlElement)
		self.helixAngle = evaluate.getEvaluatedFloatDefault(0.0, 'helixAngle', xmlElement)
		self.helixType = evaluate.getEvaluatedStringDefault('basic', 'helixType', xmlElement)
		self.helixTypeMenuRadioStrings = 'basic herringbone parabolic'.split()
		self.keywayRadiusOverRadius = evaluate.getEvaluatedFloatDefault(0.5, 'keywayRadiusOverRadius', xmlElement)
		self.lighteningHoleMarginOverRimWidth = evaluate.getEvaluatedFloatDefault(
			1.0, 'lighteningHoleMarginOverRimWidth', xmlElement)
		self.lighteningHoleMinimumRadius = evaluate.getEvaluatedFloatDefault(
			1.0, 'lighteningHoleMinimumRadius', xmlElement)
		self.moveType = evaluate.getEvaluatedStringDefault('separate', 'moveType', xmlElement)
		self.moveTypeMenuRadioStrings = 'mesh none separate vertical'.split()
		self.operatingAngle = evaluate.getEvaluatedFloatDefault(180.0, 'operatingAngle', xmlElement)
		self.pinionCollarThicknessOverThickness = evaluate.getEvaluatedFloatDefault(
			0.0, 'pinionCollarThicknessOverThickness', xmlElement)
		self.pinionThickness = evaluate.getEvaluatedFloatDefault(10.0, 'pinionThickness', xmlElement)
		self.pinionThickness = evaluate.getEvaluatedFloatDefault(self.pinionThickness, 'thickness', xmlElement)
		self.plateClearanceOverThickness = evaluate.getEvaluatedFloatDefault(0.2, 'plateClearanceOverThickness', xmlElement)
		self.plateThicknessOverThickness = evaluate.getEvaluatedFloatDefault(0.5, 'plateThicknessOverThickness', xmlElement)
		self.pressureAngle = evaluate.getEvaluatedFloatDefault(20.0, 'pressureAngle', xmlElement)
		self.profileSurfaces = evaluate.getEvaluatedIntDefault(11, 'profileSurfaces', xmlElement)
		self.rackHoleRadiusOverWidth = evaluate.getEvaluatedFloatDefault(0.0, 'rackHoleRadiusOverWidth', xmlElement)
		self.rackHoleBelowOverWidth = evaluate.getEvaluatedFloatDefault(0.6, 'rackHoleBelowOverWidth', xmlElement)
		self.rackHoleStepOverWidth = evaluate.getEvaluatedFloatDefault(1.0, 'rackHoleStepOverWidth', xmlElement)
		self.rackLengthOverRadius = evaluate.getEvaluatedFloatDefault(math.pi + math.pi, 'rackLengthOverRadius', xmlElement)
		self.rackWidthOverThickness = evaluate.getEvaluatedFloatDefault(1.0, 'rackWidthOverThickness', xmlElement)
		self.rimWidthOverRadius = evaluate.getEvaluatedFloatDefault(0.2, 'rimWidthOverRadius', xmlElement)
		self.rootBevelOverClearance = evaluate.getEvaluatedFloatDefault(0.5, 'rootBevelOverClearance', xmlElement)
		self.shaftDepthBottomOverRadius = evaluate.getEvaluatedFloatDefault(0.0, 'shaftDepthBottomOverRadius', xmlElement)
		self.shaftDepthTopOverRadius = evaluate.getEvaluatedFloatDefault(0.0, 'shaftDepthOverRadius', xmlElement)
		self.shaftDepthTopOverRadius = evaluate.getEvaluatedFloatDefault(
			self.shaftDepthTopOverRadius, 'shaftDepthTopOverRadius', xmlElement)
		self.shaftRadiusOverPitchRadius = evaluate.getEvaluatedFloatDefault(0.0, 'shaftRadiusOverPitchRadius', xmlElement)
		self.shaftSides = evaluate.getEvaluatedIntDefault(4, 'shaftSides', xmlElement)
		self.teethPinion = evaluate.getEvaluatedIntDefault(7, 'teeth', xmlElement)
		self.teethPinion = evaluate.getEvaluatedIntDefault(self.teethPinion, 'teethPinion', xmlElement)
		self.teethGear = evaluate.getEvaluatedIntDefault(17, 'teethGear', xmlElement)
		totalTeethOverPinionTeeth = float(self.teethGear + self.teethPinion) / float(self.teethPinion)
		self.centerDistance = evaluate.getEvaluatedFloatDefault(20.0 * totalTeethOverPinionTeeth, 'centerDistance', xmlElement)
		derivedPitchRadius = self.centerDistance / totalTeethOverPinionTeeth
		self.pitchRadius = evaluate.getEvaluatedFloatDefault(derivedPitchRadius, 'pitchRadius', xmlElement)
		self.tipBevelOverClearance = evaluate.getEvaluatedFloatDefault(0.1, 'tipBevelOverClearance', xmlElement)
		# tooth multiplied by 0.99999 to avoid an intersection
		self.toothWidthMultiplier = evaluate.getEvaluatedFloatDefault(0.99999, 'toothWidthMultiplier', xmlElement)
		# Set absolute variables.
		self.wavelength = self.pitchRadius * 2.0 * math.pi / float(self.teethPinion)
		self.clearance = self.wavelength * self.clearanceOverWavelength
		self.clearance = evaluate.getEvaluatedFloatDefault(self.clearance, 'clearance', xmlElement)
		self.gearCollarThickness = self.pinionThickness * self.gearCollarThicknessOverThickness
		self.gearCollarThickness = evaluate.getEvaluatedFloatDefault(self.gearCollarThickness, 'gearCollarThickness', xmlElement)
		self.gearHolePaths = evaluate.getTransformedPathsByKey([], 'gearHolePaths', xmlElement)
		self.pinionCollarThickness = self.pinionThickness * self.pinionCollarThicknessOverThickness
		self.pinionCollarThickness = evaluate.getEvaluatedFloatDefault(self.pinionCollarThickness, 'pinionCollarThickness', xmlElement)
		self.plateThickness = self.pinionThickness * self.plateThicknessOverThickness
		self.plateThickness = evaluate.getEvaluatedFloatDefault(self.plateThickness, 'plateThickness', xmlElement)
		self.plateClearance = self.plateThickness * self.plateClearanceOverThickness
		self.plateClearance = evaluate.getEvaluatedFloatDefault(self.plateClearance, 'plateClearance', xmlElement)
		self.rackLength = self.pitchRadius * self.rackLengthOverRadius
		self.rackLength = evaluate.getEvaluatedFloatDefault(self.rackLength, 'rackLength', xmlElement)
		self.rackDemilength = 0.5 * self.rackLength
		self.rackWidth = self.pinionThickness * self.rackWidthOverThickness
		self.rackWidth = evaluate.getEvaluatedFloatDefault(self.rackWidth, 'rackWidth', xmlElement)
		self.rimWidth = self.pitchRadius * self.rimWidthOverRadius
		self.rimWidth = evaluate.getEvaluatedFloatDefault(self.rimWidth, 'rimWidth', xmlElement)
		self.rootBevel = self.clearance * self.rootBevelOverClearance
		self.rootBevel = evaluate.getEvaluatedFloatDefault(self.rootBevel, 'rootBevel', xmlElement)
		self.shaftRadius = self.pitchRadius * self.shaftRadiusOverPitchRadius
		self.shaftRadius = evaluate.getEvaluatedFloatDefault(self.shaftRadius, 'shaftRadius', xmlElement)
		self.collarWidth = self.shaftRadius * self.collarWidthOverShaftRadius
		self.collarWidth = evaluate.getEvaluatedFloatDefault(self.collarWidth, 'collarWidth', xmlElement)
		self.keywayRadius = self.shaftRadius * self.keywayRadiusOverRadius
		self.keywayRadius = lineation.getFloatByPrefixBeginEnd('keywayRadius', 'keywayDiameter', self.keywayRadius, xmlElement)
		self.lighteningHoleMargin = self.rimWidth * self.lighteningHoleMarginOverRimWidth
		self.lighteningHoleMargin = evaluate.getEvaluatedFloatDefault(
			self.lighteningHoleMargin, 'lighteningHoleMargin', xmlElement)
		self.rackHoleBelow = self.rackWidth * self.rackHoleBelowOverWidth
		self.rackHoleBelow = evaluate.getEvaluatedFloatDefault(self.rackHoleBelow, 'rackHoleBelow', xmlElement)
		self.rackHoleRadius = self.rackWidth * self.rackHoleRadiusOverWidth
		self.rackHoleRadius = lineation.getFloatByPrefixBeginEnd('rackHoleRadius', 'rackHoleDiameter', self.rackHoleRadius, xmlElement)
		self.rackHoleStep = self.rackWidth * self.rackHoleStepOverWidth
		self.rackHoleStep = evaluate.getEvaluatedFloatDefault(self.rackHoleStep, 'rackHoleStep', xmlElement)
		self.shaftDepthBottom = self.shaftRadius * self.shaftDepthBottomOverRadius
		self.shaftDepthBottom = evaluate.getEvaluatedFloatDefault(self.shaftDepthBottom, 'shaftDepthBottom', xmlElement)
		self.shaftDepthTop = self.shaftRadius * self.shaftDepthTopOverRadius
		self.shaftDepthTop = evaluate.getEvaluatedFloatDefault(self.shaftDepthTop, 'shaftDepth', xmlElement)
		self.shaftDepthTop = evaluate.getEvaluatedFloatDefault(self.shaftDepthTop, 'shaftDepthTop', xmlElement)
		self.shaftPath = evaluate.getTransformedPathByKey([], 'shaftPath', xmlElement)
		if len(self.shaftPath) < 3:
			self.shaftPath = shaft.getShaftPath(self.shaftDepthBottom, self.shaftDepthTop, self.shaftRadius, -self.shaftSides)
		self.tipBevel = self.clearance * self.tipBevelOverClearance
		self.tipBevel = evaluate.getEvaluatedFloatDefault(self.tipBevel, 'tipBevel', xmlElement)
		# Set derived values.
		self.helixRadian = math.radians(self.helixAngle)
		if self.teethGear <= 0.0 and self.operatingAngle != 180.0:
			print('Warning, an operatingAngle other than 180 degrees can only work with a positive number of gear teeth.')
			print('Therefore the operatingAngle will be reset to 180 degrees.')
			self.operatingAngle = 180.0
		self.tanHelix = math.tan(self.helixRadian)
		self.helixThickness = self.tanHelix * self.pinionThickness
		self.operatingRadian = math.radians(self.operatingAngle)
		self.pitchRadiusGear = self.pitchRadius * float(self.teethGear) / float(self.teethPinion)
		self.pressureRadian = math.radians(self.pressureAngle)
		self.cosPressure = math.cos(self.pressureRadian)
		self.sinPressure = math.sin(self.pressureRadian)
		self.tanPressure = math.tan(self.pressureRadian)
		self.halfWavelength = 0.5 * self.wavelength
		self.helixPath = euclidean.getComplexPath(evaluate.getTransformedPathByKey([], 'helixPath', xmlElement))
		if len(self.helixPath) < 1:
			self.helixPath = getHelixComplexPath(self, xmlElement)
		self.quarterWavelength = 0.25 * self.wavelength
		self.shaftRimRadius = self.shaftRadius + self.collarWidth
		self.toothProfileHalf = getToothProfileHalfCylinder(self, self.pitchRadius)
		self.toothProfileHalf = getWidthMultipliedPath(self.toothProfileHalf, self.toothWidthMultiplier)
		self.addendum = self.toothProfileHalf[-1].imag - self.pitchRadius
		self.dedendum = abs(self.toothProfileHalf[-1]) - self.pitchRadius + self.clearance
		self.pinionToothProfile = getToothProfileCylinderByProfile(self, self.pitchRadius, self.teethPinion, self.toothProfileHalf)
		self.xmlElement = xmlElement
Exemplo n.º 26
0
	def setToXMLElement(self, xmlElement):
		"Set to the xmlElement."
		self.clearanceOverWavelength = evaluate.getEvaluatedFloatDefault(
			self.clearanceOverWavelength, 'clearanceOverWavelength', xmlElement)
		self.collarWidthOverShaftRadius = evaluate.getEvaluatedFloatDefault(
			self.collarWidthOverShaftRadius, 'collarWidthOverShaftRadius', xmlElement)
		self.copyShallow = xmlElement.getCopyShallow()
		self.creationType = evaluate.getEvaluatedStringDefault(self.creationType, 'creationType', xmlElement)
		self.gearCollarThicknessOverThickness = evaluate.getEvaluatedFloatDefault(
			self.gearCollarThicknessOverThickness, 'gearCollarThicknessOverThickness', xmlElement)
		self.helixAngle = evaluate.getEvaluatedFloatDefault(self.helixAngle, 'helixAngle', xmlElement)
		self.helixType = evaluate.getEvaluatedStringDefault(self.helixType, 'helixType', xmlElement)
		self.keywayRadiusOverRadius = evaluate.getEvaluatedFloatDefault(
			self.keywayRadiusOverRadius, 'keywayRadiusOverRadius', xmlElement)
		self.lighteningHoleMarginOverRimWidth = evaluate.getEvaluatedFloatDefault(
			self.lighteningHoleMarginOverRimWidth, 'lighteningHoleMarginOverRimWidth', xmlElement)
		self.lighteningHoleMinimumRadius = evaluate.getEvaluatedFloatDefault(
			self.lighteningHoleMinimumRadius, 'lighteningHoleMinimumRadius', xmlElement)
		self.moveType = evaluate.getEvaluatedStringDefault(self.moveType, 'moveType', xmlElement)
		self.operatingAngle = evaluate.getEvaluatedFloatDefault(self.operatingAngle, 'operatingAngle', xmlElement)
		self.pinionCollarThicknessOverThickness = evaluate.getEvaluatedFloatDefault(
			self.pinionCollarThicknessOverThickness, 'pinionCollarThicknessOverThickness', xmlElement)
		self.pinionThickness = evaluate.getEvaluatedFloatDefault(self.pinionThickness, 'pinionThickness', xmlElement)
		self.pinionThickness = evaluate.getEvaluatedFloatDefault(self.pinionThickness, 'thickness', xmlElement)
		self.pitchRadius = evaluate.getEvaluatedFloatDefault(self.pitchRadius, 'pitchRadius', xmlElement)
		self.plateClearanceOverThickness = evaluate.getEvaluatedFloatDefault(
			self.plateClearanceOverThickness, 'plateClearanceOverThickness', xmlElement)
		self.plateThicknessOverThickness = evaluate.getEvaluatedFloatDefault(
			self.plateThicknessOverThickness, 'plateThicknessOverThickness', xmlElement)
		self.pressureAngle = evaluate.getEvaluatedFloatDefault(self.pressureAngle, 'pressureAngle', xmlElement)
		self.profileSurfaces = evaluate.getEvaluatedIntDefault(self.profileSurfaces, 'profileSurfaces', xmlElement)
		self.rackHoleRadiusOverWidth = evaluate.getEvaluatedFloatDefault(
			self.rackHoleRadiusOverWidth, 'rackHoleRadiusOverWidth', xmlElement)
		self.rackHoleBelowOverWidth = evaluate.getEvaluatedFloatDefault(
			self.rackHoleBelowOverWidth, 'rackHoleBelowOverWidth', xmlElement)
		self.rackHoleStep = evaluate.getEvaluatedFloatDefault(
			self.rackHoleStep, 'rackHoleStep', xmlElement)
		self.rackLengthOverRadius = evaluate.getEvaluatedFloatDefault(self.rackLengthOverRadius, 'rackLengthOverRadius', xmlElement)
		self.rackWidthOverThickness = evaluate.getEvaluatedFloatDefault(
			self.rackWidthOverThickness, 'rackWidthOverThickness', xmlElement)
		self.rimWidthOverRadius = evaluate.getEvaluatedFloatDefault(self.rimWidthOverRadius, 'rimWidthOverRadius', xmlElement)
		self.rootBevelOverClearance = evaluate.getEvaluatedFloatDefault(
			self.rootBevelOverClearance, 'rootBevelOverClearance', xmlElement)
		self.shaftDepthBottomOverRadius = evaluate.getEvaluatedFloatDefault(
			self.shaftDepthBottomOverRadius, 'shaftDepthBottomOverRadius', xmlElement)
		self.shaftDepthTopOverRadius = evaluate.getEvaluatedFloatDefault(
			self.shaftDepthTopOverRadius, 'shaftDepthOverRadius', xmlElement)
		self.shaftDepthTopOverRadius = evaluate.getEvaluatedFloatDefault(
			self.shaftDepthTopOverRadius, 'shaftDepthTopOverRadius', xmlElement)
		self.shaftRadiusOverPitchRadius = evaluate.getEvaluatedFloatDefault(
			self.shaftRadiusOverPitchRadius, 'shaftRadiusOverPitchRadius', xmlElement)
		self.shaftSides = evaluate.getEvaluatedIntDefault(self.shaftSides, 'shaftSides', xmlElement)
		self.teethPinion = evaluate.getEvaluatedIntDefault(self.teethPinion, 'teeth', xmlElement)
		self.teethPinion = evaluate.getEvaluatedIntDefault(self.teethPinion, 'teethPinion', xmlElement)
		self.teethGear = evaluate.getEvaluatedIntDefault(self.teethGear, 'teethGear', xmlElement)
		self.tipBevelOverClearance = evaluate.getEvaluatedFloatDefault(self.tipBevelOverClearance, 'tipBevelOverClearance', xmlElement)
		self.toothWidthMultiplier = evaluate.getEvaluatedFloatDefault(self.toothWidthMultiplier, 'toothWidthMultiplier', xmlElement)
		# Set absolute variables.
		self.wavelength = self.pitchRadius * 2.0 * math.pi / float(self.teethPinion)
		if self.clearance == None:
			self.clearance = self.wavelength * self.clearanceOverWavelength
		self.clearance = evaluate.getEvaluatedFloatDefault(self.clearance, 'clearance', xmlElement)
		if self.gearCollarThickness == None:
			self.gearCollarThickness = self.pinionThickness * self.gearCollarThicknessOverThickness
		self.gearCollarThickness = evaluate.getEvaluatedFloatDefault(self.gearCollarThickness, 'gearCollarThickness', xmlElement)
		if self.gearHolePaths == None:
			self.gearHolePaths = evaluate.getTransformedPathsByKey('gearHolePaths', xmlElement)
		if self.pinionCollarThickness == None:
			self.pinionCollarThickness = self.pinionThickness * self.pinionCollarThicknessOverThickness
		self.pinionCollarThickness = evaluate.getEvaluatedFloatDefault(self.pinionCollarThickness, 'pinionCollarThickness', xmlElement)
		if self.plateThickness == None:
			self.plateThickness = self.pinionThickness * self.plateThicknessOverThickness
		self.plateThickness = evaluate.getEvaluatedFloatDefault(self.plateThickness, 'plateThickness', xmlElement)
		if self.plateClearance == None:
			self.plateClearance = self.plateThickness * self.plateClearanceOverThickness
		self.plateClearance = evaluate.getEvaluatedFloatDefault(self.plateClearance, 'plateClearance', xmlElement)
		if self.rackLength == None:
			self.rackLength = self.pitchRadius * self.rackLengthOverRadius
		self.rackLength = evaluate.getEvaluatedFloatDefault(self.rackLength, 'rackLength', xmlElement)
		self.rackDemilength = 0.5 * self.rackLength
		if self.rackWidth == None:
			self.rackWidth = self.pinionThickness * self.rackWidthOverThickness
		self.rackWidth = evaluate.getEvaluatedFloatDefault(self.rackWidth, 'rackWidth', xmlElement)
		if self.rimWidth == None:
			self.rimWidth = self.pitchRadius * self.rimWidthOverRadius
		self.rimWidth = evaluate.getEvaluatedFloatDefault(self.rimWidth, 'rimWidth', xmlElement)
		if self.rootBevel == None:
			self.rootBevel = self.clearance * self.rootBevelOverClearance
		self.rootBevel = evaluate.getEvaluatedFloatDefault(self.rootBevel, 'rootBevel', xmlElement)
		if self.shaftRadius == None:
			self.shaftRadius = self.pitchRadius * self.shaftRadiusOverPitchRadius
		self.shaftRadius = evaluate.getEvaluatedFloatDefault(self.shaftRadius, 'shaftRadius', xmlElement)
		if self.collarWidth == None:
			self.collarWidth = self.shaftRadius * self.collarWidthOverShaftRadius
		self.collarWidth = evaluate.getEvaluatedFloatDefault(self.collarWidth, 'collarWidth', xmlElement)
		if self.keywayRadius == None:
			self.keywayRadius = self.shaftRadius * self.keywayRadiusOverRadius
		self.keywayRadius = lineation.getFloatByPrefixBeginEnd('keywayRadius', 'keywayDiameter', self.keywayRadius, xmlElement)
		if self.lighteningHoleMargin == None:
			self.lighteningHoleMargin = self.rimWidth * self.lighteningHoleMarginOverRimWidth
		self.lighteningHoleMargin = evaluate.getEvaluatedFloatDefault(
			self.lighteningHoleMargin, 'lighteningHoleMargin', xmlElement)
		if self.rackHoleBelow == None:
			self.rackHoleBelow = self.rackWidth * self.rackHoleBelowOverWidth
		self.rackHoleBelow = evaluate.getEvaluatedFloatDefault(self.rackHoleBelow, 'rackHoleBelow', xmlElement)
		if self.rackHoleRadius == None:
			self.rackHoleRadius = self.rackWidth * self.rackHoleRadiusOverWidth
		self.rackHoleRadius = lineation.getFloatByPrefixBeginEnd('rackHoleRadius', 'rackHoleDiameter', self.rackHoleRadius, xmlElement)
		if self.rackHoleStep == None:
			self.rackHoleStep = self.rackWidth * self.rackHoleStepOverWidth
		self.rackHoleStep = evaluate.getEvaluatedFloatDefault(self.rackHoleStep, 'rackHoleStep', xmlElement)
		if self.shaftDepthBottom == None:
			self.shaftDepthBottom = self.shaftRadius * self.shaftDepthBottomOverRadius
		self.shaftDepthBottom = evaluate.getEvaluatedFloatDefault(self.shaftDepthBottom, 'shaftDepthBottom', xmlElement)
		if self.shaftDepthTop == None:
			self.shaftDepthTop = self.shaftRadius * self.shaftDepthTopOverRadius
		self.shaftDepthTop = evaluate.getEvaluatedFloatDefault(self.shaftDepthTop, 'shaftDepth', xmlElement)
		self.shaftDepthTop = evaluate.getEvaluatedFloatDefault(self.shaftDepthTop, 'shaftDepthTop', xmlElement)
		if self.shaftPath == None:
			self.shaftPath = evaluate.getTransformedPathByKey('shaftPath', xmlElement)
		if len(self.shaftPath) < 3:
			self.shaftPath = shaft.getShaftPath(self.shaftDepthBottom, self.shaftDepthTop, self.shaftRadius, -self.shaftSides)
		if self.tipBevel == None:
			self.tipBevel = self.clearance * self.tipBevelOverClearance
		self.tipBevel = evaluate.getEvaluatedFloatDefault(self.tipBevel, 'tipBevel', xmlElement)
		# Set derived values.
		self.helixRadian = math.radians(self.helixAngle)
		if self.teethGear <= 0.0 and self.operatingAngle != 180.0:
			print('Warning, an operatingAngle other than 180 degrees can only work with a positive number of gear teeth.')
			print('Therefore the operatingAngle will be reset to 180 degrees.')
			self.operatingAngle = 180.0
		self.tanHelix = math.tan(self.helixRadian)
		self.helixThickness = self.tanHelix * self.pinionThickness
		self.operatingRadian = math.radians(self.operatingAngle)
		self.pitchRadiusGear = self.pitchRadius * float(self.teethGear) / float(self.teethPinion)
		self.pressureRadian = math.radians(self.pressureAngle)
		self.cosPressure = math.cos(self.pressureRadian)
		self.sinPressure = math.sin(self.pressureRadian)
		self.tanPressure = math.tan(self.pressureRadian)
		self.halfWavelength = 0.5 * self.wavelength
		if self.helixPath == None:
			self.helixPath = euclidean.getComplexPath(evaluate.getTransformedPathByKey('helixPath', xmlElement))
		if len(self.helixPath) < 1:
			self.helixPath = getHelixComplexPath(self, xmlElement)
		self.quarterWavelength = 0.25 * self.wavelength
		self.shaftRimRadius = self.shaftRadius + self.collarWidth
		self.toothProfileHalf = getToothProfileHalfCylinder(self, self.pitchRadius)
		self.toothProfileHalf = getWidthMultipliedPath(self.toothProfileHalf, self.toothWidthMultiplier)
		self.addendum = self.toothProfileHalf[-1].imag - self.pitchRadius
		self.dedendum = abs(self.toothProfileHalf[-1]) - self.pitchRadius + self.clearance
		self.pinionToothProfile = getToothProfileCylinderByProfile(self, self.pitchRadius, self.teethPinion, self.toothProfileHalf)
		self.xmlElement = xmlElement
Exemplo n.º 27
0
	def setToXMLElement(self, xmlElement):
		"Set to the xmlElement."
		self.bevelOverClearance = evaluate.getEvaluatedFloatDefault(self.bevelOverClearance, 'bevelOverClearance', xmlElement)
		self.clearanceOverWavelength = evaluate.getEvaluatedFloatDefault(
			self.clearanceOverWavelength, 'clearanceOverWavelength', xmlElement)
		self.collarWidthOverShaftRadius = evaluate.getEvaluatedFloatDefault(
			self.collarWidthOverShaftRadius, 'collarWidthOverShaftRadius', xmlElement)
		self.creationType = evaluate.getEvaluatedStringDefault(self.creationType, 'creationType', xmlElement)
		self.helixAngle = evaluate.getEvaluatedFloatDefault(self.helixAngle, 'helixAngle', xmlElement)
		self.helixType = evaluate.getEvaluatedStringDefault(self.helixType, 'helixType', xmlElement)
		self.lighteningHoleMarginOverRimWidth = evaluate.getEvaluatedFloatDefault(
			self.lighteningHoleMarginOverRimWidth, 'lighteningHoleMarginOverRimWidth', xmlElement)
		self.lighteningHoleMinimumRadius = evaluate.getEvaluatedFloatDefault(
			self.lighteningHoleMinimumRadius, 'lighteningHoleMinimumRadius', xmlElement)
		self.moveType = evaluate.getEvaluatedStringDefault(self.moveType, 'moveType', xmlElement)
		self.pitchRadius = evaluate.getEvaluatedFloatDefault(self.pitchRadius, 'pitchRadius', xmlElement)
		self.pressureAngle = evaluate.getEvaluatedFloatDefault(self.pressureAngle, 'pressureAngle', xmlElement)
		self.profileDefinitionSurfaces = evaluate.getEvaluatedIntDefault(
			self.profileDefinitionSurfaces, 'profileDefinitionSurfaces', xmlElement)
		self.rackLengthOverRadius = evaluate.getEvaluatedFloatDefault(self.rackLengthOverRadius, 'rackLengthOverRadius', xmlElement)
		self.rackWidthOverThickness = evaluate.getEvaluatedFloatDefault(
			self.rackWidthOverThickness, 'rackWidthOverThickness', xmlElement)
		self.rimWidthOverRadius = evaluate.getEvaluatedFloatDefault(self.rimWidthOverRadius, 'rimWidthOverRadius', xmlElement)
		self.shaftDepthBottomOverRadius = evaluate.getEvaluatedFloatDefault(
			self.shaftDepthBottomOverRadius, 'shaftDepthBottomOverRadius', xmlElement)
		self.shaftDepthTopOverRadius = evaluate.getEvaluatedFloatDefault(
			self.shaftDepthTopOverRadius, 'shaftDepthOverRadius', xmlElement)
		self.shaftDepthTopOverRadius = evaluate.getEvaluatedFloatDefault(
			self.shaftDepthTopOverRadius, 'shaftDepthTopOverRadius', xmlElement)
		self.shaftRadiusOverPitchRadius = evaluate.getEvaluatedFloatDefault(
			self.shaftRadiusOverPitchRadius, 'shaftRadiusOverPitchRadius', xmlElement)
		self.shaftSides = evaluate.getEvaluatedIntDefault(self.shaftSides, 'shaftSides', xmlElement)
		self.teethPinion = evaluate.getEvaluatedIntDefault(self.teethPinion, 'teeth', xmlElement)
		self.teethPinion = evaluate.getEvaluatedIntDefault(self.teethPinion, 'teethPinion', xmlElement)
		self.teethSecond = evaluate.getEvaluatedIntDefault(self.teethSecond, 'teethSecond', xmlElement)
		self.thickness = evaluate.getEvaluatedFloatDefault(self.thickness, 'thickness', xmlElement)
		# Set absolute variables.
		self.wavelength = self.pitchRadius * 2.0 * math.pi / float(self.teethPinion)
		if self.clearance == None:
			self.clearance = self.wavelength * self.clearanceOverWavelength
		self.clearance = evaluate.getEvaluatedFloatDefault(self.clearance, 'clearance', xmlElement)
		if self.bevel == None:
			self.bevel = self.clearance * self.bevelOverClearance
		self.bevel = evaluate.getEvaluatedFloatDefault(self.bevel, 'bevel', xmlElement)
		if self.rackLength == None:
			self.rackLength = self.pitchRadius * self.rackLengthOverRadius
		self.rackLength = evaluate.getEvaluatedFloatDefault(self.rackLength, 'rackLength', xmlElement)
		if self.rackWidth == None:
			self.rackWidth = self.thickness * self.rackWidthOverThickness
		self.rackWidth = evaluate.getEvaluatedFloatDefault(self.rackWidth, 'rackWidth', xmlElement)
		if self.rimWidth == None:
			self.rimWidth = self.pitchRadius * self.rimWidthOverRadius
		self.rimWidth = evaluate.getEvaluatedFloatDefault(self.rimWidth, 'rimWidth', xmlElement)
		if self.shaftRadius == None:
			self.shaftRadius = self.pitchRadius * self.shaftRadiusOverPitchRadius
		self.shaftRadius = evaluate.getEvaluatedFloatDefault(self.shaftRadius, 'shaftRadius', xmlElement)
		if self.collarWidth == None:
			self.collarWidth = self.shaftRadius * self.collarWidthOverShaftRadius
		self.collarWidth = evaluate.getEvaluatedFloatDefault(self.collarWidth, 'collarWidth', xmlElement)
		if self.lighteningHoleMargin == None:
			self.lighteningHoleMargin = self.rimWidth * self.lighteningHoleMarginOverRimWidth
		self.lighteningHoleMargin = evaluate.getEvaluatedFloatDefault(
			self.lighteningHoleMargin, 'lighteningHoleMargin', xmlElement)
		if self.shaftDepthBottom == None:
			self.shaftDepthBottom = self.shaftRadius * self.shaftDepthBottomOverRadius
		self.shaftDepthBottom = evaluate.getEvaluatedFloatDefault(self.shaftDepthBottom, 'shaftDepthBottom', xmlElement)
		if self.shaftDepthTop == None:
			self.shaftDepthTop = self.shaftRadius * self.shaftDepthTopOverRadius
		self.shaftDepthTop = evaluate.getEvaluatedFloatDefault(self.shaftDepthTop, 'shaftDepth', xmlElement)
		self.shaftDepthTop = evaluate.getEvaluatedFloatDefault(self.shaftDepthTop, 'shaftDepthTop', xmlElement)
		# Set derived values.
		self.helixRadian = math.radians(self.helixAngle)
		self.tanHelix = math.tan(self.helixRadian)
		self.helixThickness = self.tanHelix * self.thickness
		self.pressureRadian = math.radians(self.pressureAngle)
		self.cosPressure = math.cos(self.pressureRadian)
		self.sinPressure = math.sin(self.pressureRadian)
		self.tanPressure = math.tan(self.pressureRadian)
		# tooth multiplied by 0.99 is because at greater than 0.99 there is an intersection
		self.xToothMultiplier = 0.99 - 0.01 * self.tanHelix
		self.halfWavelength = 0.5 * self.wavelength
		self.quarterWavelength = 0.25 * self.wavelength
		self.pinionToothProfile = getToothProfileHalfCylinder(self, self.pitchRadius, self.teethPinion)
		self.addendum = self.pinionToothProfile[-1].imag - self.pitchRadius
		self.dedendum = abs(self.pinionToothProfile[-1]) - self.pitchRadius + self.clearance
		self.xmlElement = xmlElement