Exemplo n.º 1
0
def getGeometryOutput(xmlElement):
	"Get vector3 vertexes from attribute dictionary."
	inradius = lineation.getComplexByPrefixes(['demisize', 'inradius'], complex(1.0, 1.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)
	bottomDemiwidth = lineation.getFloatByPrefixBeginEnd('bottomdemiwidth', 'bottomwidth', demiwidth, xmlElement)
	topDemiwidth = lineation.getFloatByPrefixBeginEnd('topdemiwidth', 'topwidth', demiwidth, xmlElement)
	interiorAngle = evaluate.getEvaluatedFloatDefault(90.0, 'interiorangle', xmlElement)
	topRight = complex(topDemiwidth, demiheight)
	topLeft = complex(-topDemiwidth, demiheight)
	bottomLeft = complex(-bottomDemiwidth, -demiheight)
	bottomRight = complex(bottomDemiwidth, -demiheight)
	if interiorAngle != 90.0:
		interiorPlaneAngle = euclidean.getWiddershinsUnitPolar(math.radians(interiorAngle - 90.0))
		topRight = (topRight - bottomRight) * interiorPlaneAngle + bottomRight
		topLeft = (topLeft - bottomLeft) * interiorPlaneAngle + bottomLeft
	revolutions = evaluate.getEvaluatedIntOne('revolutions', xmlElement)
	lineation.setClosedAttribute(revolutions, xmlElement)
	complexLoop = [topRight, topLeft, bottomLeft, bottomRight]
	originalLoop = complexLoop[:]
	for revolution in xrange(1, revolutions):
		complexLoop += originalLoop
	spiral = lineation.Spiral(0.25, xmlElement)
	loop = []
	loopCentroid = euclidean.getLoopCentroid(originalLoop)
	for point in complexLoop:
		unitPolar = euclidean.getNormalized(point - loopCentroid)
		loop.append(spiral.getSpiralPoint(unitPolar, Vector3(point.real, point.imag)))
	return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop, 0.5 * math.pi), xmlElement)
Exemplo n.º 2
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.º 3
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.inradius = lineation.getInradius(complex(1.0, 1.0), elementNode)
		self.demiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, 'demiwidth', 'width', self.inradius.real)
		self.demiheight = lineation.getFloatByPrefixBeginEnd(elementNode, 'demiheight', 'height', self.inradius.imag)
		self.bottomDemiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, 'bottomdemiwidth', 'bottomwidth', self.demiwidth)
		self.topDemiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, 'topdemiwidth', 'topwidth', self.demiwidth)
		self.interiorAngle = evaluate.getEvaluatedFloat(90.0, elementNode, 'interiorangle')
		self.revolutions = evaluate.getEvaluatedInt(1, elementNode, 'revolutions')
		self.spiral = evaluate.getVector3ByPrefix(None, elementNode, 'spiral')
Exemplo n.º 4
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.inradius = lineation.getInradius(complex(1.0, 1.0), elementNode)
		self.demiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, 'demiwidth', 'width', self.inradius.real)
		self.demiheight = lineation.getFloatByPrefixBeginEnd(elementNode, 'demiheight', 'height', self.inradius.imag)
		self.bottomDemiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, 'bottomdemiwidth', 'bottomwidth', self.demiwidth)
		self.topDemiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, 'topdemiwidth', 'topwidth', self.demiwidth)
		self.interiorAngle = evaluate.getEvaluatedFloat(90.0, elementNode, 'interiorangle')
		self.revolutions = evaluate.getEvaluatedInt(1, elementNode, 'revolutions')
		self.spiral = evaluate.getVector3ByPrefix(None, elementNode, 'spiral')
Exemplo n.º 5
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.bottomDemiwidth = lineation.getFloatByPrefixBeginEnd('bottomdemiwidth', 'bottomwidth', self.demiwidth, xmlElement)
		self.topDemiwidth = lineation.getFloatByPrefixBeginEnd('topdemiwidth', 'topwidth', self.demiwidth, xmlElement)
		self.interiorAngle = evaluate.getEvaluatedFloatDefault(self.interiorAngle, 'interiorangle', xmlElement)
		self.revolutions = evaluate.getEvaluatedIntDefault(self.revolutions, 'revolutions', xmlElement)
		self.spiral = evaluate.getVector3ByPrefix(self.spiral, 'spiral', xmlElement)
Exemplo n.º 6
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.inradius = lineation.getComplexByPrefixes(['demisize', 'inradius'], complex(1.0, 1.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.bottomDemiwidth = lineation.getFloatByPrefixBeginEnd('bottomdemiwidth', 'bottomwidth', self.demiwidth, xmlElement)
		self.topDemiwidth = lineation.getFloatByPrefixBeginEnd('topdemiwidth', 'topwidth', self.demiwidth, xmlElement)
		self.interiorAngle = evaluate.getEvaluatedFloatDefault(90.0, 'interiorangle', xmlElement)
		self.revolutions = evaluate.getEvaluatedIntDefault(1, 'revolutions', xmlElement)
		self.spiral = evaluate.getVector3ByPrefix(None, 'spiral', xmlElement)
Exemplo n.º 7
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.bottomDemiwidth = lineation.getFloatByPrefixBeginEnd('bottomdemiwidth', 'bottomwidth', self.demiwidth, xmlElement)
		self.topDemiwidth = lineation.getFloatByPrefixBeginEnd('topdemiwidth', 'topwidth', self.demiwidth, xmlElement)
		self.interiorAngle = evaluate.getEvaluatedFloatDefault(self.interiorAngle, 'interiorangle', xmlElement)
		self.revolutions = evaluate.getEvaluatedIntDefault(self.revolutions, 'revolutions', xmlElement)
		self.spiral = evaluate.getVector3ByPrefix(self.spiral, 'spiral', xmlElement)
Exemplo n.º 8
0
Arquivo: square.py Projeto: Aeva/SFACT
 def __init__(self, elementNode):
     "Set defaults."
     self.inradius = lineation.getInradius(complex(1.0, 1.0), elementNode)
     self.demiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, "demiwidth", "width", self.inradius.real)
     self.demiheight = lineation.getFloatByPrefixBeginEnd(elementNode, "demiheight", "height", self.inradius.imag)
     self.bottomDemiwidth = lineation.getFloatByPrefixBeginEnd(
         elementNode, "bottomdemiwidth", "bottomwidth", self.demiwidth
     )
     self.topDemiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, "topdemiwidth", "topwidth", self.demiwidth)
     self.interiorAngle = evaluate.getEvaluatedFloat(90.0, elementNode, "interiorangle")
     self.revolutions = evaluate.getEvaluatedInt(1, elementNode, "revolutions")
     self.spiral = evaluate.getVector3ByPrefix(None, elementNode, "spiral")
Exemplo n.º 9
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.inradius = lineation.getInradius(complex(10.0, 10.0), elementNode)
		self.demiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, 'demiwidth', 'width', self.inradius.real)
		self.demiheight = lineation.getFloatByPrefixBeginEnd(elementNode, 'demiheight', 'height', self.inradius.imag)
		self.density = evaluate.getEvaluatedFloat(0.2, elementNode, 'density')
		self.radius = lineation.getComplexByPrefixBeginEnd(elementNode, 'elementRadius', 'elementDiameter', complex(1.0, 1.0))
		self.radius = lineation.getComplexByPrefixBeginEnd(elementNode, 'radius', 'diameter', self.radius)
		self.seed = evaluate.getEvaluatedInt(None, elementNode, 'seed')
		self.target = evaluate.getTransformedPathsByKey([], elementNode, 'target')
		self.typeMenuRadioStrings = 'hexagonal random rectangular'.split()
		self.typeString = evaluate.getEvaluatedString('rectangular', elementNode, 'type')
		self.zigzag = evaluate.getEvaluatedBoolean(True, elementNode, 'zigzag')
Exemplo n.º 10
0
 def __init__(self, xmlElement):
     "Set defaults."
     self.inradius = lineation.getComplexByPrefixes(["demisize", "inradius"], complex(1.0, 1.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.bottomDemiwidth = lineation.getFloatByPrefixBeginEnd(
         "bottomdemiwidth", "bottomwidth", self.demiwidth, xmlElement
     )
     self.topDemiwidth = lineation.getFloatByPrefixBeginEnd("topdemiwidth", "topwidth", self.demiwidth, xmlElement)
     self.interiorAngle = evaluate.getEvaluatedFloat(90.0, "interiorangle", xmlElement)
     self.revolutions = evaluate.getEvaluatedInt(1, "revolutions", xmlElement)
     self.spiral = evaluate.getVector3ByPrefix(None, "spiral", xmlElement)
Exemplo n.º 11
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.º 12
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.getEvaluatedInt(None, 'seed', xmlElement)
		self.target = evaluate.getTransformedPathsByKey([], 'target', xmlElement)
		self.typeMenuRadioStrings = 'hexagonal random rectangular'.split()
		self.typeString = evaluate.getEvaluatedString('rectangular', 'type', xmlElement)
		self.zigzag = evaluate.getEvaluatedBoolean(True, 'zigzag', xmlElement)
Exemplo n.º 13
0
 def __init__(self, elementNode):
     "Set defaults."
     self.inradius = lineation.getInradius(complex(10.0, 10.0), elementNode)
     self.demiwidth = lineation.getFloatByPrefixBeginEnd(elementNode, "demiwidth", "width", self.inradius.real)
     self.demiheight = lineation.getFloatByPrefixBeginEnd(elementNode, "demiheight", "height", self.inradius.imag)
     self.density = evaluate.getEvaluatedFloat(0.2, elementNode, "density")
     self.radius = lineation.getComplexByPrefixBeginEnd(
         elementNode, "elementRadius", "elementDiameter", complex(1.0, 1.0)
     )
     self.radius = lineation.getComplexByPrefixBeginEnd(elementNode, "radius", "diameter", self.radius)
     self.seed = evaluate.getEvaluatedInt(None, elementNode, "seed")
     self.target = evaluate.getTransformedPathsByKey([], elementNode, "target")
     self.typeMenuRadioStrings = "hexagonal random rectangular".split()
     self.typeString = evaluate.getEvaluatedString("rectangular", elementNode, "type")
     self.zigzag = evaluate.getEvaluatedBoolean(True, elementNode, "zigzag")
Exemplo n.º 14
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.length = evaluate.getEvaluatedFloat(50.0, elementNode, 'length')
		self.demilength = 0.5 * self.length
		self.elementNode = elementNode
		self.radius = lineation.getFloatByPrefixBeginEnd(elementNode, 'radius', 'diameter', 5.0)
		self.cageClearanceOverRadius = evaluate.getEvaluatedFloat(0.05, elementNode, 'cageClearanceOverRadius')
		self.cageClearance = self.cageClearanceOverRadius * self.radius
		self.cageClearance = evaluate.getEvaluatedFloat(self.cageClearance, elementNode, 'cageClearance')
		self.racewayClearanceOverRadius = evaluate.getEvaluatedFloat(0.1, elementNode, 'racewayClearanceOverRadius')
		self.racewayClearance = self.racewayClearanceOverRadius * self.radius
		self.racewayClearance = evaluate.getEvaluatedFloat(self.racewayClearance, elementNode, 'racewayClearance')
		self.typeMenuRadioStrings = 'assembly integral'.split()
		self.typeString = evaluate.getEvaluatedString('assembly', elementNode, 'type')
		self.typeStringFirstCharacter = self.typeString[: 1 ].lower()
		self.wallThicknessOverRadius = evaluate.getEvaluatedFloat(0.5, elementNode, 'wallThicknessOverRadius')
		self.wallThickness = self.wallThicknessOverRadius * self.radius
		self.wallThickness = evaluate.getEvaluatedFloat(self.wallThickness, elementNode, 'wallThickness')
		self.zenithAngle = evaluate.getEvaluatedFloat(45.0, elementNode, 'zenithAngle')
		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)
		if self.typeStringFirstCharacter == 'a':
			self.setAssemblyCage()
		self.rectangleCenterX = self.demiwidth - self.demilength
Exemplo n.º 15
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.º 16
0
 def __init__(self, elementNode):
     "Set defaults."
     self.bevelOverRadius = evaluate.getEvaluatedFloat(0.2, elementNode, "bevelOverRadius")
     self.boltRadiusOverRadius = evaluate.getEvaluatedFloat(0.0, elementNode, "boltRadiusOverRadius")
     self.columns = evaluate.getEvaluatedInt(2, elementNode, "columns")
     self.elementNode = elementNode
     self.heightOverRadius = evaluate.getEvaluatedFloat(2.0, elementNode, "heightOverRadius")
     self.interiorOverhangRadians = setting.getInteriorOverhangRadians(elementNode)
     self.overhangSpan = setting.getOverhangSpan(elementNode)
     self.pegClearanceOverRadius = evaluate.getEvaluatedFloat(0.0, elementNode, "pegClearanceOverRadius")
     self.pegRadians = math.radians(evaluate.getEvaluatedFloat(2.0, elementNode, "pegAngle"))
     self.pegHeightOverHeight = evaluate.getEvaluatedFloat(0.4, elementNode, "pegHeightOverHeight")
     self.pegRadiusOverRadius = evaluate.getEvaluatedFloat(0.7, elementNode, "pegRadiusOverRadius")
     self.radius = lineation.getFloatByPrefixBeginEnd(elementNode, "radius", "width", 5.0)
     self.rows = evaluate.getEvaluatedInt(1, elementNode, "rows")
     self.topBevelOverRadius = evaluate.getEvaluatedFloat(0.2, elementNode, "topBevelOverRadius")
     # Set derived values.
     self.bevel = evaluate.getEvaluatedFloat(self.bevelOverRadius * self.radius, elementNode, "bevel")
     self.boltRadius = evaluate.getEvaluatedFloat(self.boltRadiusOverRadius * self.radius, elementNode, "boltRadius")
     self.boltSides = evaluate.getSidesMinimumThreeBasedOnPrecision(elementNode, self.boltRadius)
     self.bottomLeftCenter = complex(-float(self.columns - 1), -float(self.rows - 1)) * self.radius
     self.height = evaluate.getEvaluatedFloat(self.heightOverRadius * self.radius, elementNode, "height")
     self.hollowPegSockets = []
     centerY = self.bottomLeftCenter.imag
     diameter = self.radius + self.radius
     self.pegExistence = CellExistence(
         self.columns, self.rows, evaluate.getEvaluatedValue(None, elementNode, "pegs")
     )
     self.socketExistence = CellExistence(
         self.columns, self.rows, evaluate.getEvaluatedValue(None, elementNode, "sockets")
     )
     for rowIndex in xrange(self.rows):
         centerX = self.bottomLeftCenter.real
         for columnIndex in xrange(self.columns):
             hollowPegSocket = HollowPegSocket(complex(centerX, centerY))
             hollowPegSocket.shouldAddPeg = self.pegExistence.getIsInExistence(columnIndex, rowIndex)
             hollowPegSocket.shouldAddSocket = self.socketExistence.getIsInExistence(columnIndex, rowIndex)
             self.hollowPegSockets.append(hollowPegSocket)
             centerX += diameter
         centerY += diameter
     self.pegClearance = evaluate.getEvaluatedFloat(
         self.pegClearanceOverRadius * self.radius, elementNode, "pegClearance"
     )
     halfPegClearance = 0.5 * self.pegClearance
     self.pegHeight = evaluate.getEvaluatedFloat(self.pegHeightOverHeight * self.height, elementNode, "pegHeight")
     self.pegRadius = evaluate.getEvaluatedFloat(self.pegRadiusOverRadius * self.radius, elementNode, "pegRadius")
     sides = 24 * max(1, math.floor(evaluate.getSidesBasedOnPrecision(elementNode, self.pegRadius) / 24))
     self.socketRadius = self.pegRadius + halfPegClearance
     self.pegSides = evaluate.getEvaluatedInt(sides, elementNode, "pegSides")
     self.pegRadius -= halfPegClearance
     self.pegRadiusArealized = evaluate.getRadiusArealizedBasedOnAreaRadius(
         elementNode, self.pegRadius, self.pegSides
     )
     self.socketSides = evaluate.getEvaluatedInt(sides, elementNode, "socketSides")
     self.socketRadiusArealized = evaluate.getRadiusArealizedBasedOnAreaRadius(
         elementNode, self.socketRadius, self.socketSides
     )
     self.topBevel = evaluate.getEvaluatedFloat(self.topBevelOverRadius * self.radius, elementNode, "topBevel")
     self.topBevelPositions = evaluate.getEvaluatedString("nwse", elementNode, "topBevelPositions").lower()
     self.topRight = complex(float(self.columns), float(self.rows)) * self.radius
Exemplo n.º 17
0
 def __init__(self, elementNode):
     'Set defaults.'
     self.bevelOverRadius = evaluate.getEvaluatedFloat(
         0.25, elementNode, 'bevelOverRadius')
     self.clearanceOverRadius = evaluate.getEvaluatedFloat(
         0.0, elementNode, 'clearanceOverRadius')
     self.elementNode = elementNode
     self.endZ = evaluate.getEvaluatedFloat(10.0, elementNode, 'endZ')
     self.start = evaluate.getVector3ByPrefix(Vector3(), elementNode,
                                              'start')
     self.radius = lineation.getFloatByPrefixBeginEnd(
         elementNode, 'radius', 'diameter', 2.0)
     self.sides = evaluate.getSidesMinimumThreeBasedOnPrecision(
         elementNode, max(self.radius.real, self.radius.imag))
     self.radiusArealized = evaluate.getRadiusArealizedBasedOnAreaRadius(
         elementNode, self.radius, self.sides)
     self.topOverBottom = evaluate.getEvaluatedFloat(
         0.8, elementNode, 'topOverBottom')
     setTopOverBottomByRadius(self, self.endZ, self.radiusArealized,
                              self.start.z)
     # Set derived variables.
     self.bevel = evaluate.getEvaluatedFloat(
         self.bevelOverRadius * self.radiusArealized, elementNode, 'bevel')
     self.clearance = evaluate.getEvaluatedFloat(
         self.clearanceOverRadius * self.radiusArealized, elementNode,
         'clearance')
Exemplo n.º 18
0
	def setToXMLElement(self, xmlElement):
		"Set to the xmlElement."
		self.end = evaluate.getVector3ByPrefix(self.end, 'end', xmlElement)
		self.start = evaluate.getVector3ByPrefix(self.start, 'start', xmlElement)
		self.radius = lineation.getFloatByPrefixBeginEnd('radius', 'diameter', self.radius, xmlElement)
		size = evaluate.getEvaluatedFloatDefault(None, 'size', xmlElement)
		if size != None:
			self.radius = 0.5 * size
		self.xmlElement = xmlElement
Exemplo n.º 19
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.end = evaluate.getVector3ByPrefix(Vector3(0.0, 0.0, 1.0), 'end', xmlElement)
		self.start = evaluate.getVector3ByPrefix(Vector3(), 'start', xmlElement)
		self.radius = lineation.getFloatByPrefixBeginEnd('radius', 'diameter', 1.0, xmlElement)
		size = evaluate.getEvaluatedFloatDefault(None, 'size', xmlElement)
		if size != None:
			self.radius = 0.5 * size
		self.xmlElement = xmlElement
Exemplo n.º 20
0
 def __init__(self, xmlElement):
     "Set defaults."
     self.end = evaluate.getVector3ByPrefix(Vector3(0.0, 0.0, 1.0), "end", xmlElement)
     self.start = evaluate.getVector3ByPrefix(Vector3(), "start", xmlElement)
     self.radius = lineation.getFloatByPrefixBeginEnd("radius", "diameter", 1.0, xmlElement)
     size = evaluate.getEvaluatedFloat(None, "size", xmlElement)
     if size != None:
         self.radius = 0.5 * size
     self.xmlElement = xmlElement
Exemplo n.º 21
0
Arquivo: _drill.py Projeto: Aeva/SFACT
	def __init__(self, elementNode):
		'Set defaults.'
		self.elementNode = elementNode
		self.end = evaluate.getVector3ByPrefix(Vector3(0.0, 0.0, 1.0), elementNode, 'end')
		self.start = evaluate.getVector3ByPrefix(Vector3(), elementNode, 'start')
		self.radius = lineation.getFloatByPrefixBeginEnd(elementNode, 'radius', 'diameter', 1.0)
		size = evaluate.getEvaluatedFloat(None, elementNode, 'size')
		if size is not None:
			self.radius = 0.5 * size
Exemplo n.º 22
0
 def __init__(self, elementNode):
     'Set defaults.'
     self.inradius = lineation.getInradius(complex(10.0, 10.0), elementNode)
     self.demiwidth = lineation.getFloatByPrefixBeginEnd(
         elementNode, 'demiwidth', 'width', self.inradius.real)
     self.demiheight = lineation.getFloatByPrefixBeginEnd(
         elementNode, 'demiheight', 'height', self.inradius.imag)
     self.density = evaluate.getEvaluatedFloat(0.2, elementNode, 'density')
     self.radius = lineation.getComplexByPrefixBeginEnd(
         elementNode, 'elementRadius', 'elementDiameter', complex(1.0, 1.0))
     self.radius = lineation.getComplexByPrefixBeginEnd(
         elementNode, 'radius', 'diameter', self.radius)
     self.seed = evaluate.getEvaluatedInt(None, elementNode, 'seed')
     self.target = evaluate.getTransformedPathsByKey([], elementNode,
                                                     'target')
     self.typeMenuRadioStrings = 'hexagonal random rectangular'.split()
     self.typeString = evaluate.getEvaluatedString('rectangular',
                                                   elementNode, 'type')
     self.zigzag = evaluate.getEvaluatedBoolean(True, elementNode, 'zigzag')
Exemplo n.º 23
0
 def setToXMLElement(self, xmlElement):
     "Set to the xmlElement."
     self.end = evaluate.getVector3ByPrefix(self.end, 'end', xmlElement)
     self.start = evaluate.getVector3ByPrefix(self.start, 'start',
                                              xmlElement)
     self.radius = lineation.getFloatByPrefixBeginEnd(
         'radius', 'diameter', self.radius, xmlElement)
     size = evaluate.getEvaluatedFloatDefault(None, 'size', xmlElement)
     if size != None:
         self.radius = 0.5 * size
     self.xmlElement = xmlElement
Exemplo n.º 24
0
	def __init__(self, xmlElement):
		'Set defaults.'
		end = evaluate.getVector3ByPrefix(None, 'end', xmlElement)
		start = evaluate.getVector3ByPrefix(Vector3(), 'start', xmlElement)
		inclinationDegree = math.degrees(getInclination(end, start))
		self.inclination = math.radians(evaluate.getEvaluatedFloat(inclinationDegree, 'inclination', xmlElement))
		self.radius = lineation.getFloatByPrefixBeginEnd('radius', 'diameter', 1.0, xmlElement)
		size = evaluate.getEvaluatedFloat(None, 'size', xmlElement)
		if size != None:
			self.radius = 0.5 * size
		self.xmlElement = xmlElement
Exemplo n.º 25
0
 def setToXMLElement(self, xmlElement):
     "Set to the xmlElement."
     end = evaluate.getVector3ByPrefix("end", None, xmlElement)
     start = evaluate.getVector3ByPrefix("start", Vector3(), xmlElement)
     inclinationDegree = math.degrees(getInclination(end, start))
     self.inclination = math.radians(evaluate.getEvaluatedFloatDefault(inclinationDegree, "inclination", xmlElement))
     self.radius = lineation.getFloatByPrefixBeginEnd("radius", "diameter", self.radius, xmlElement)
     size = evaluate.getEvaluatedFloatDefault(None, "size", xmlElement)
     if size != None:
         self.radius = 0.5 * size
     self.xmlElement = xmlElement
Exemplo n.º 26
0
	def setToXMLElement(self, xmlElement):
		"Set to the xmlElement."
		end = evaluate.getVector3ByPrefix(None, 'end', xmlElement)
		start = evaluate.getVector3ByPrefix(Vector3(), 'start', xmlElement)
		inclinationDegree = math.degrees(getInclination(end, start))
		self.inclination = math.radians(evaluate.getEvaluatedFloatDefault(inclinationDegree, 'inclination', xmlElement))
		self.radius = lineation.getFloatByPrefixBeginEnd('radius', 'diameter', self.radius, xmlElement)
		size = evaluate.getEvaluatedFloatDefault(None, 'size', xmlElement)
		if size != None:
			self.radius = 0.5 * size
		self.xmlElement = xmlElement
Exemplo n.º 27
0
def getGeometryOutput(xmlElement):
    "Get vector3 vertexes from attribute dictionary."
    inradius = lineation.getComplexByPrefixes(['demisize', 'inradius'],
                                              complex(1.0, 1.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)
    bottomDemiwidth = lineation.getFloatByPrefixBeginEnd(
        'bottomdemiwidth', 'bottomwidth', demiwidth, xmlElement)
    topDemiwidth = lineation.getFloatByPrefixBeginEnd('topdemiwidth',
                                                      'topwidth', demiwidth,
                                                      xmlElement)
    interiorAngle = evaluate.getEvaluatedFloatDefault(90.0, 'interiorangle',
                                                      xmlElement)
    topRight = complex(topDemiwidth, demiheight)
    topLeft = complex(-topDemiwidth, demiheight)
    bottomLeft = complex(-bottomDemiwidth, -demiheight)
    bottomRight = complex(bottomDemiwidth, -demiheight)
    if interiorAngle != 90.0:
        interiorPlaneAngle = euclidean.getWiddershinsUnitPolar(
            math.radians(interiorAngle - 90.0))
        topRight = (topRight - bottomRight) * interiorPlaneAngle + bottomRight
        topLeft = (topLeft - bottomLeft) * interiorPlaneAngle + bottomLeft
    revolutions = evaluate.getEvaluatedIntOne('revolutions', xmlElement)
    lineation.setClosedAttribute(revolutions, xmlElement)
    complexLoop = [topRight, topLeft, bottomLeft, bottomRight]
    originalLoop = complexLoop[:]
    for revolution in xrange(1, revolutions):
        complexLoop += originalLoop
    spiral = lineation.Spiral(0.25, xmlElement)
    loop = []
    loopCentroid = euclidean.getLoopCentroid(originalLoop)
    for point in complexLoop:
        unitPolar = euclidean.getNormalized(point - loopCentroid)
        loop.append(
            spiral.getSpiralPoint(unitPolar, Vector3(point.real, point.imag)))
    return lineation.getGeometryOutputByLoop(
        lineation.SideLoop(loop, 0.5 * math.pi), xmlElement)
Exemplo n.º 28
0
 def __init__(self, elementNode):
     'Set defaults.'
     self.elementNode = elementNode
     self.end = evaluate.getVector3ByPrefix(Vector3(0.0, 0.0, 1.0),
                                            elementNode, 'end')
     self.start = evaluate.getVector3ByPrefix(Vector3(), elementNode,
                                              'start')
     self.radius = lineation.getFloatByPrefixBeginEnd(
         elementNode, 'radius', 'diameter', 1.0)
     size = evaluate.getEvaluatedFloat(None, elementNode, 'size')
     if size != None:
         self.radius = 0.5 * size
Exemplo n.º 29
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.endZ = evaluate.getEvaluatedFloatDefault(10.0, 'endZ', xmlElement)
		self.start = evaluate.getVector3ByPrefix(Vector3(), 'start', xmlElement)
		self.radius = lineation.getFloatByPrefixBeginEnd('radius', 'diameter', 2.0, xmlElement)
		self.topOverBottom = evaluate.getEvaluatedFloatDefault(0.8, 'topOverBottom', xmlElement)
		self.xmlElement = xmlElement
		# Set derived variables.
		self.bevelOverRadius = evaluate.getEvaluatedFloatDefault(0.25, 'bevelOverRadius', xmlElement)
		self.bevel = self.bevelOverRadius * self.radius
		self.bevel = evaluate.getEvaluatedFloatDefault(self.bevel, 'bevel', xmlElement)
		self.clearanceOverRadius = evaluate.getEvaluatedFloatDefault(0.0, 'clearanceOverRadius', xmlElement)
		self.clearance = self.clearanceOverRadius * self.radius
		self.clearance = evaluate.getEvaluatedFloatDefault(self.clearance, 'clearance', xmlElement)
Exemplo n.º 30
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.getEvaluatedInt(None, 'seed', xmlElement)
     self.target = evaluate.getTransformedPathsByKey([], 'target',
                                                     xmlElement)
     self.typeMenuRadioStrings = 'hexagonal random rectangular'.split()
     self.typeString = evaluate.getEvaluatedString('rectangular', 'type',
                                                   xmlElement)
     self.zigzag = evaluate.getEvaluatedBoolean(True, 'zigzag', xmlElement)
Exemplo n.º 31
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.º 32
0
Arquivo: peg.py Projeto: Ademan/Cura
	def __init__(self, elementNode):
		'Set defaults.'
		self.bevelOverRadius = evaluate.getEvaluatedFloat(0.25, elementNode, 'bevelOverRadius')
		self.clearanceOverRadius = evaluate.getEvaluatedFloat(0.0, elementNode, 'clearanceOverRadius')
		self.elementNode = elementNode
		self.endZ = evaluate.getEvaluatedFloat(10.0, elementNode, 'endZ')
		self.start = evaluate.getVector3ByPrefix(Vector3(), elementNode, 'start')
		self.radius = lineation.getFloatByPrefixBeginEnd(elementNode, 'radius', 'diameter', 2.0)
		self.sides = evaluate.getSidesMinimumThreeBasedOnPrecision(elementNode, max(self.radius.real, self.radius.imag))
		self.radiusArealized = evaluate.getRadiusArealizedBasedOnAreaRadius(elementNode, self.radius, self.sides)
		self.topOverBottom = evaluate.getEvaluatedFloat(0.8, elementNode, 'topOverBottom')
		setTopOverBottomByRadius(self, self.endZ, self.radiusArealized, self.start.z)
		# Set derived variables.
		self.bevel = evaluate.getEvaluatedFloat(self.bevelOverRadius * self.radiusArealized, elementNode, 'bevel')
		self.clearance = evaluate.getEvaluatedFloat(self.clearanceOverRadius * self.radiusArealized, elementNode, 'clearance')
Exemplo n.º 33
0
def getGeometryOutput(xmlElement):
	"Get vector3 vertices from attribute dictionary."
	inradius = complex( 1.0, 1.0 )
	inradius = lineation.getComplexByPrefixes( ['demisize', 'inradius'], inradius, 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 )
	bottomDemiwidth = lineation.getFloatByPrefixBeginEnd('bottomdemiwidth', 'bottomwidth', demiwidth, xmlElement )
	topDemiwidth = lineation.getFloatByPrefixBeginEnd('topdemiwidth', 'topwidth', demiwidth, xmlElement )
	interiorAngle = evaluate.getEvaluatedFloatDefault( 90.0, 'interiorangle', xmlElement )
	topRight = complex( topDemiwidth, demiheight )
	topLeft = complex( - topDemiwidth, demiheight )
	bottomLeft = complex( - bottomDemiwidth, - demiheight )
	bottomRight = complex( bottomDemiwidth, - demiheight )
	if interiorAngle != 90.0:
		interiorPlaneAngle = euclidean.getWiddershinsUnitPolar( math.radians( interiorAngle - 90.0 ) )
		topRight = ( topRight - bottomRight ) * interiorPlaneAngle + bottomRight
		topLeft = ( topLeft - bottomLeft ) * interiorPlaneAngle + bottomLeft
	loop = [
		Vector3( topRight.real, topRight.imag ),
		Vector3( topLeft.real, topLeft.imag ),
		Vector3( bottomLeft.real, bottomLeft.imag ),
		Vector3( bottomRight.real, bottomRight.imag ) ]
	return lineation.getGeometryOutputByLoop( lineation.SideLoop( loop, 0.5 * math.pi ), xmlElement )
Exemplo n.º 34
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.bevelOverRadius = evaluate.getEvaluatedFloat(0.2, 'bevelOverRadius', xmlElement)
		self.boltRadiusOverRadius = evaluate.getEvaluatedFloat(0.0, 'boltRadiusOverRadius', xmlElement)
		self.columns = evaluate.getEvaluatedInt(2, 'columns', xmlElement)
		self.heightOverRadius = evaluate.getEvaluatedFloat(2.0, 'heightOverRadius', xmlElement)
		self.interiorOverhangRadians = setting.getInteriorOverhangRadians(xmlElement)
		self.overhangSpan = setting.getOverhangSpan(xmlElement)
		self.pegClearanceOverRadius = evaluate.getEvaluatedFloat(0.0, 'pegClearanceOverRadius', xmlElement)
		self.pegRadians = math.radians(evaluate.getEvaluatedFloat(2.0, 'pegAngle', xmlElement))
		self.pegHeightOverHeight = evaluate.getEvaluatedFloat(0.4, 'pegHeightOverHeight', xmlElement)
		self.pegRadiusOverRadius = evaluate.getEvaluatedFloat(0.7, 'pegRadiusOverRadius', xmlElement)
		self.radius = lineation.getFloatByPrefixBeginEnd('radius', 'width', 5.0, xmlElement)
		self.rows = evaluate.getEvaluatedInt(1, 'rows', xmlElement)
		self.topBevelOverRadius = evaluate.getEvaluatedFloat(0.2, 'topBevelOverRadius', xmlElement)
		self.xmlElement = xmlElement
		# Set derived values.
		self.bevel = evaluate.getEvaluatedFloat(self.bevelOverRadius * self.radius, 'bevel', xmlElement)
		self.boltRadius = evaluate.getEvaluatedFloat(self.boltRadiusOverRadius * self.radius, 'boltRadius', xmlElement)
		self.boltSides = evaluate.getSidesMinimumThreeBasedOnPrecision(self.boltRadius, xmlElement)
		self.bottomLeftCenter = complex(-float(self.columns - 1), -float(self.rows - 1)) * self.radius
		self.height = evaluate.getEvaluatedFloat(self.heightOverRadius * self.radius, 'height', xmlElement)
		self.hollowPegSockets = []
		centerY = self.bottomLeftCenter.imag
		diameter = self.radius + self.radius
		self.pegExistence = CellExistence(self.columns, self.rows, evaluate.getEvaluatedValue(None, 'pegs', xmlElement))
		self.socketExistence = CellExistence(self.columns, self.rows, evaluate.getEvaluatedValue(None, 'sockets', xmlElement))
		for rowIndex in xrange(self.rows):
			centerX = self.bottomLeftCenter.real
			for columnIndex in xrange(self.columns):
				hollowPegSocket = HollowPegSocket(complex(centerX, centerY))
				hollowPegSocket.shouldAddPeg = self.pegExistence.getIsInExistence(columnIndex, rowIndex)
				hollowPegSocket.shouldAddSocket = self.socketExistence.getIsInExistence(columnIndex, rowIndex)
				self.hollowPegSockets.append(hollowPegSocket)
				centerX += diameter
			centerY += diameter
		self.pegClearance = evaluate.getEvaluatedFloat(self.pegClearanceOverRadius * self.radius, 'pegClearance', xmlElement)
		halfPegClearance = 0.5 * self.pegClearance
		self.pegHeight = evaluate.getEvaluatedFloat(self.pegHeightOverHeight * self.height, 'pegHeight', xmlElement)
		self.pegRadius = evaluate.getEvaluatedFloat(self.pegRadiusOverRadius * self.radius, 'pegRadius', xmlElement)
		sides = 24 * max(1, math.floor(evaluate.getSidesBasedOnPrecision(self.pegRadius, xmlElement) / 24))
		self.socketRadius = self.pegRadius + halfPegClearance
		self.pegSides = evaluate.getEvaluatedInt(sides, 'pegSides', xmlElement)
		self.socketSides = evaluate.getEvaluatedInt(sides, 'socketSides', xmlElement)
		self.pegRadius -= halfPegClearance
		self.topBevel = evaluate.getEvaluatedFloat(self.topBevelOverRadius * self.radius, 'topBevel', xmlElement)
		self.topBevelPositions = evaluate.getEvaluatedString('nwse', 'topBevelPositions', xmlElement).lower()
		self.topRight = complex(float(self.columns), float(self.rows)) * self.radius
Exemplo n.º 35
0
	def __init__(self, xmlElement):
		"""Set defaults."""
		self.bevelOverRadius = evaluate.getEvaluatedFloat(0.2, 'bevelOverRadius', xmlElement)
		self.boltRadiusOverRadius = evaluate.getEvaluatedFloat(0.0, 'boltRadiusOverRadius', xmlElement)
		self.columns = evaluate.getEvaluatedInt(2, 'columns', xmlElement)
		self.heightOverRadius = evaluate.getEvaluatedFloat(2.0, 'heightOverRadius', xmlElement)
		self.interiorOverhangRadians = setting.getInteriorOverhangRadians(xmlElement)
		self.overhangSpan = setting.getOverhangSpan(xmlElement)
		self.pegClearanceOverRadius = evaluate.getEvaluatedFloat(0.0, 'pegClearanceOverRadius', xmlElement)
		self.pegRadians = math.radians(evaluate.getEvaluatedFloat(2.0, 'pegAngle', xmlElement))
		self.pegHeightOverHeight = evaluate.getEvaluatedFloat(0.4, 'pegHeightOverHeight', xmlElement)
		self.pegRadiusOverRadius = evaluate.getEvaluatedFloat(0.7, 'pegRadiusOverRadius', xmlElement)
		self.radius = lineation.getFloatByPrefixBeginEnd('radius', 'width', 5.0, xmlElement)
		self.rows = evaluate.getEvaluatedInt(1, 'rows', xmlElement)
		self.topBevelOverRadius = evaluate.getEvaluatedFloat(0.2, 'topBevelOverRadius', xmlElement)
		self.xmlElement = xmlElement
		# Set derived values.
		self.bevel = evaluate.getEvaluatedFloat(self.bevelOverRadius * self.radius, 'bevel', xmlElement)
		self.boltRadius = evaluate.getEvaluatedFloat(self.boltRadiusOverRadius * self.radius, 'boltRadius', xmlElement)
		self.boltSides = evaluate.getSidesMinimumThreeBasedOnPrecision(self.boltRadius, xmlElement)
		self.bottomLeftCenter = complex(-float(self.columns - 1), -float(self.rows - 1)) * self.radius
		self.height = evaluate.getEvaluatedFloat(self.heightOverRadius * self.radius, 'height', xmlElement)
		self.hollowPegSockets = []
		centerY = self.bottomLeftCenter.imag
		diameter = self.radius + self.radius
		self.pegExistence = CellExistence(self.columns, self.rows, evaluate.getEvaluatedValue(None, 'pegs', xmlElement))
		self.socketExistence = CellExistence(self.columns, self.rows, evaluate.getEvaluatedValue(None, 'sockets', xmlElement))
		for rowIndex in xrange(self.rows):
			centerX = self.bottomLeftCenter.real
			for columnIndex in xrange(self.columns):
				hollowPegSocket = HollowPegSocket(complex(centerX, centerY))
				hollowPegSocket.shouldAddPeg = self.pegExistence.getIsInExistence(columnIndex, rowIndex)
				hollowPegSocket.shouldAddSocket = self.socketExistence.getIsInExistence(columnIndex, rowIndex)
				self.hollowPegSockets.append(hollowPegSocket)
				centerX += diameter
			centerY += diameter
		self.pegClearance = evaluate.getEvaluatedFloat(self.pegClearanceOverRadius * self.radius, 'pegClearance', xmlElement)
		halfPegClearance = 0.5 * self.pegClearance
		self.pegHeight = evaluate.getEvaluatedFloat(self.pegHeightOverHeight * self.height, 'pegHeight', xmlElement)
		self.pegRadius = evaluate.getEvaluatedFloat(self.pegRadiusOverRadius * self.radius, 'pegRadius', xmlElement)
		sides = 24 * max(1, math.floor(evaluate.getSidesBasedOnPrecision(self.pegRadius, xmlElement) / 24))
		self.socketRadius = self.pegRadius + halfPegClearance
		self.pegSides = evaluate.getEvaluatedInt(sides, 'pegSides', xmlElement)
		self.socketSides = evaluate.getEvaluatedInt(sides, 'socketSides', xmlElement)
		self.pegRadius -= halfPegClearance
		self.topBevel = evaluate.getEvaluatedFloat(self.topBevelOverRadius * self.radius, 'topBevel', xmlElement)
		self.topBevelPositions = evaluate.getEvaluatedString('nwse', 'topBevelPositions', xmlElement).lower()
		self.topRight = complex(float(self.columns), float(self.rows)) * self.radius
Exemplo n.º 36
0
	def __init__(self, elementNode):
		'Set defaults.'
		end = evaluate.getVector3ByPrefix(None, elementNode, 'end')
		start = evaluate.getVector3ByPrefix(Vector3(), elementNode, 'start')
		inclinationDegree = math.degrees(getInclination(end, start))
		self.elementNode = elementNode
		self.inclination = math.radians(evaluate.getEvaluatedFloat(inclinationDegree, elementNode, 'inclination'))
		self.overhangRadians = setting.getOverhangRadians(elementNode)
		self.overhangSpan = setting.getOverhangSpan(elementNode)
		self.radius = lineation.getFloatByPrefixBeginEnd(elementNode, 'radius', 'diameter', 1.0)
		size = evaluate.getEvaluatedFloat(None, elementNode, 'size')
		if size != None:
			self.radius = 0.5 * size
		self.sides = evaluate.getEvaluatedFloat(None, elementNode, 'sides')
		if self.sides == None:
			self.sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(elementNode, self.radius)
		self.radiusArealized = evaluate.getRadiusArealizedBasedOnAreaRadius(elementNode, self.radius, self.sides)
Exemplo n.º 37
0
 def __init__(self, xmlElement):
     'Set defaults.'
     self.endZ = evaluate.getEvaluatedFloat(10.0, 'endZ', xmlElement)
     self.start = evaluate.getVector3ByPrefix(Vector3(), 'start',
                                              xmlElement)
     self.radius = lineation.getFloatByPrefixBeginEnd(
         'radius', 'diameter', 2.0, xmlElement)
     self.topOverBottom = evaluate.getEvaluatedFloat(
         0.8, 'topOverBottom', xmlElement)
     self.xmlElement = xmlElement
     # Set derived variables.
     self.bevelOverRadius = evaluate.getEvaluatedFloat(
         0.25, 'bevelOverRadius', xmlElement)
     self.bevel = self.bevelOverRadius * self.radius
     self.bevel = evaluate.getEvaluatedFloat(self.bevel, 'bevel',
                                             xmlElement)
     self.clearanceOverRadius = evaluate.getEvaluatedFloat(
         0.0, 'clearanceOverRadius', xmlElement)
     self.clearance = self.clearanceOverRadius * self.radius
     self.clearance = evaluate.getEvaluatedFloat(self.clearance,
                                                 'clearance', xmlElement)
Exemplo n.º 38
0
 def __init__(self, elementNode):
     'Set defaults.'
     end = evaluate.getVector3ByPrefix(None, elementNode, 'end')
     start = evaluate.getVector3ByPrefix(Vector3(), elementNode, 'start')
     inclinationDegree = math.degrees(getInclination(end, start))
     self.elementNode = elementNode
     self.inclination = math.radians(
         evaluate.getEvaluatedFloat(inclinationDegree, elementNode,
                                    'inclination'))
     self.overhangRadians = setting.getOverhangRadians(elementNode)
     self.overhangSpan = setting.getOverhangSpan(elementNode)
     self.radius = lineation.getFloatByPrefixBeginEnd(
         elementNode, 'radius', 'diameter', 1.0)
     size = evaluate.getEvaluatedFloat(None, elementNode, 'size')
     if size != None:
         self.radius = 0.5 * size
     self.sides = evaluate.getEvaluatedFloat(None, elementNode, 'sides')
     if self.sides == None:
         self.sides = evaluate.getSidesMinimumThreeBasedOnPrecisionSides(
             elementNode, self.radius)
     self.radiusArealized = evaluate.getRadiusArealizedBasedOnAreaRadius(
         elementNode, self.radius, self.sides)
Exemplo n.º 39
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.º 40
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