Ejemplo n.º 1
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.basename = evaluate.getEvaluatedBoolean(True, 'basename', xmlElement)
		self.fileName = evaluate.getEvaluatedString('', 'file', xmlElement)
		self.importName = evaluate.getEvaluatedString(None, '_importName', xmlElement)
		self.overwriteRoot = evaluate.getEvaluatedBoolean(False, 'overwriteRoot', xmlElement)
		self.xmlElement = xmlElement
Ejemplo n.º 2
0
def writeXMLObject(absoluteFolderDirectory, derivation, fileNames, target,
                   xmlObject):
    "Write one instance of the xmlObject."
    extension = evaluate.getEvaluatedString(
        xmlObject.getFabricationExtension(), derivation.elementNode,
        'extension')
    fileNameRoot = derivation.fileName
    if fileNameRoot == '':
        fileNameRoot = evaluate.getEvaluatedString('', target, 'name')
        fileNameRoot = evaluate.getEvaluatedString(fileNameRoot, target, 'id')
        fileNameRoot += derivation.suffix
    fileName = '%s.%s' % (fileNameRoot, extension)
    suffixIndex = 2
    while fileName in fileNames:
        fileName = '%s_%s.%s' % (fileNameRoot, suffixIndex, extension)
        suffixIndex += 1
    absoluteFileName = os.path.join(absoluteFolderDirectory, fileName)
    fileNames.append(fileName)
    archive.makeDirectory(absoluteFolderDirectory)
    if not derivation.writeMatrix:
        xmlObject.matrix4X4 = matrix.Matrix()
    print('The write tool generated the file:')
    print(absoluteFileName)
    archive.writeFileText(
        absoluteFileName,
        xmlObject.getFabricationText(derivation.addLayerTemplate))
Ejemplo n.º 3
0
 def __init__(self, xmlElement):
     "Set defaults."
     self.fontFamily = evaluate.getEvaluatedString("Gentium Basic Regular", "font-family", xmlElement)
     self.fontFamily = evaluate.getEvaluatedString(self.fontFamily, "fontFamily", xmlElement)
     self.fontSize = evaluate.getEvaluatedFloat(12.0, "font-size", xmlElement)
     self.fontSize = evaluate.getEvaluatedFloat(self.fontSize, "fontSize", xmlElement)
     self.textString = xmlElement.text
     self.textString = evaluate.getEvaluatedString(self.textString, "text", xmlElement)
Ejemplo n.º 4
0
Archivo: text.py Proyecto: Ademan/Cura
 def __init__(self, elementNode):
     "Set defaults."
     self.fontFamily = evaluate.getEvaluatedString("Gentium Basic Regular", elementNode, "font-family")
     self.fontFamily = evaluate.getEvaluatedString(self.fontFamily, elementNode, "fontFamily")
     self.fontSize = evaluate.getEvaluatedFloat(12.0, elementNode, "font-size")
     self.fontSize = evaluate.getEvaluatedFloat(self.fontSize, elementNode, "fontSize")
     self.textString = elementNode.getTextContent()
     self.textString = evaluate.getEvaluatedString(self.textString, elementNode, "text")
Ejemplo n.º 5
0
 def __init__(self, elementNode):
     "Set defaults."
     self.appendDocumentElement = evaluate.getEvaluatedBoolean(False, elementNode, "appendDocumentElement")
     self.appendElement = evaluate.getEvaluatedBoolean(False, elementNode, "appendElement")
     self.basename = evaluate.getEvaluatedBoolean(True, elementNode, "basename")
     self.elementNode = elementNode
     self.fileName = evaluate.getEvaluatedString("", elementNode, "file")
     self.importName = evaluate.getEvaluatedString(None, elementNode, "_importName")
Ejemplo n.º 6
0
Archivo: text.py Proyecto: Sciumo/SFACT
	def __init__(self, xmlElement):
		"""Set defaults."""
		self.fontFamily = evaluate.getEvaluatedString('Gentium Basic Regular', 'font-family', xmlElement)
		self.fontFamily = evaluate.getEvaluatedString(self.fontFamily, 'fontFamily', xmlElement)
		self.fontSize = evaluate.getEvaluatedFloat(12.0, 'font-size', xmlElement)
		self.fontSize = evaluate.getEvaluatedFloat(self.fontSize, 'fontSize', xmlElement)
		self.textString = xmlElement.text
		self.textString = evaluate.getEvaluatedString(self.textString, 'text', xmlElement)
Ejemplo n.º 7
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.appendDocumentElement = evaluate.getEvaluatedBoolean(False, elementNode, 'appendDocumentElement')
		self.appendElement = evaluate.getEvaluatedBoolean(False, elementNode, 'appendElement')
		self.basename = evaluate.getEvaluatedBoolean(True, elementNode, 'basename')
		self.elementNode = elementNode
		self.fileName = evaluate.getEvaluatedString('', elementNode, 'file')
		self.importName = evaluate.getEvaluatedString(None, elementNode, '_importName')
Ejemplo n.º 8
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.fontFamily = evaluate.getEvaluatedString('Gentium Basic Regular', elementNode, 'font-family')
		self.fontFamily = evaluate.getEvaluatedString(self.fontFamily, elementNode, 'fontFamily')
		self.fontSize = evaluate.getEvaluatedFloat(12.0, elementNode, 'font-size')
		self.fontSize = evaluate.getEvaluatedFloat(self.fontSize, elementNode, 'fontSize')
		self.textString = elementNode.getTextContent()
		self.textString = evaluate.getEvaluatedString(self.textString, elementNode, 'text')
Ejemplo n.º 9
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.fontFamily = evaluate.getEvaluatedString('Gentium Basic Regular', elementNode, 'font-family')
		self.fontFamily = evaluate.getEvaluatedString(self.fontFamily, elementNode, 'fontFamily')
		self.fontSize = evaluate.getEvaluatedFloat(12.0, elementNode, 'font-size')
		self.fontSize = evaluate.getEvaluatedFloat(self.fontSize, elementNode, 'fontSize')
		self.textString = elementNode.getTextContent()
		self.textString = evaluate.getEvaluatedString(self.textString, elementNode, 'text')
Ejemplo n.º 10
0
Archivo: import.py Proyecto: Aeva/SFACT
	def __init__(self, elementNode):
		'Set defaults.'
		self.appendDocumentElement = evaluate.getEvaluatedBoolean(False, elementNode, 'appendDocumentElement')
		self.appendElement = evaluate.getEvaluatedBoolean(False, elementNode, 'appendElement')
		self.basename = evaluate.getEvaluatedBoolean(True, elementNode, 'basename')
		self.elementNode = elementNode
		self.fileName = evaluate.getEvaluatedString('', elementNode, 'file')
		self.importName = evaluate.getEvaluatedString(None, elementNode, '_importName')
Ejemplo n.º 11
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.addLayerTemplate = evaluate.getEvaluatedBoolean(False, elementNode, 'addLayerTemplate')
		self.elementNode = elementNode
		self.fileName = evaluate.getEvaluatedString('', elementNode, 'file')
		self.folderName = evaluate.getEvaluatedString('', elementNode, 'folder')
		self.suffix = evaluate.getEvaluatedString('', elementNode, 'suffix')
		self.targets = evaluate.getElementNodesByKey(elementNode, 'target')
		self.writeMatrix = evaluate.getEvaluatedBoolean(True, elementNode, 'writeMatrix')
Ejemplo n.º 12
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.addLayerTemplate = evaluate.getEvaluatedBoolean(False, 'addLayerTemplate', xmlElement)
		self.fileName = evaluate.getEvaluatedString('', 'file', xmlElement)
		self.folderName = evaluate.getEvaluatedString('', 'folder', xmlElement)
		self.suffix = evaluate.getEvaluatedString('', 'suffix', xmlElement)
		self.targets = evaluate.getXMLElementsByKey('target', xmlElement)
		self.writeMatrix = evaluate.getEvaluatedBoolean(True, 'writeMatrix', xmlElement)
		self.xmlElement = xmlElement
Ejemplo n.º 13
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.addLayerTemplate = evaluate.getEvaluatedBoolean(False, elementNode, 'addLayerTemplate')
		self.elementNode = elementNode
		self.fileName = evaluate.getEvaluatedString('', elementNode, 'file')
		self.folderName = evaluate.getEvaluatedString('', elementNode, 'folder')
		self.suffix = evaluate.getEvaluatedString('', elementNode, 'suffix')
		self.targets = evaluate.getElementNodesByKey(elementNode, 'target')
		self.writeMatrix = evaluate.getEvaluatedBoolean(True, elementNode, 'writeMatrix')
Ejemplo n.º 14
0
 def __init__(self, xmlElement):
     'Set defaults.'
     self.basename = evaluate.getEvaluatedBoolean(True, 'basename',
                                                  xmlElement)
     self.fileName = evaluate.getEvaluatedString('', 'file', xmlElement)
     self.importName = evaluate.getEvaluatedString(None, '_importName',
                                                   xmlElement)
     self.overwriteRoot = evaluate.getEvaluatedBoolean(
         False, 'overwriteRoot', xmlElement)
     self.xmlElement = xmlElement
Ejemplo n.º 15
0
 def __init__(self, xmlElement):
     'Set defaults.'
     self.fontFamily = evaluate.getEvaluatedString('Gentium Basic Regular',
                                                   'font-family',
                                                   xmlElement)
     self.fontFamily = evaluate.getEvaluatedString(self.fontFamily,
                                                   'fontFamily', xmlElement)
     self.fontSize = evaluate.getEvaluatedFloat(12.0, 'font-size',
                                                xmlElement)
     self.fontSize = evaluate.getEvaluatedFloat(self.fontSize, 'fontSize',
                                                xmlElement)
     self.textString = xmlElement.text
     self.textString = evaluate.getEvaluatedString(self.textString, 'text',
                                                   xmlElement)
Ejemplo n.º 16
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
Ejemplo n.º 17
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.fileName = evaluate.getEvaluatedString('', elementNode, 'file')
		self.heightGrid = evaluate.getEvaluatedValue([], elementNode, 'heightGrid')
		self.inradius = evaluate.getVector3ByPrefixes(elementNode, ['demisize', 'inradius'], Vector3(10.0, 10.0, 5.0))
		self.inradius = evaluate.getVector3ByMultiplierPrefix(elementNode, 2.0, 'size', self.inradius)
		self.start = evaluate.getEvaluatedFloat(0.0, elementNode, 'start')
Ejemplo n.º 18
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.fileName = evaluate.getEvaluatedString('', elementNode, 'file')
		self.heightGrid = evaluate.getEvaluatedValue([], elementNode, 'heightGrid')
		self.inradius = evaluate.getVector3ByPrefixes(elementNode, ['demisize', 'inradius'], Vector3(10.0, 10.0, 5.0))
		self.inradius = evaluate.getVector3ByMultiplierPrefix(elementNode, 2.0, 'size', self.inradius)
		self.start = evaluate.getEvaluatedFloat(0.0, elementNode, 'start')
Ejemplo n.º 19
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.fileName = evaluate.getEvaluatedString('', 'file', xmlElement)
		self.heightGrid = evaluate.getEvaluatedValue([], 'heightGrid', xmlElement)
		self.inradius = evaluate.getVector3ByPrefixes(['demisize', 'inradius'], Vector3(10.0, 10.0, 5.0), xmlElement)
		self.inradius = evaluate.getVector3ByMultiplierPrefix(2.0, 'size', self.inradius, xmlElement)
		self.start = evaluate.getEvaluatedFloat(0.0, 'start', xmlElement)
Ejemplo n.º 20
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
Ejemplo n.º 21
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
Ejemplo n.º 22
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.closed = evaluate.getEvaluatedBoolean(False, elementNode, 'closed')
		self.end = evaluate.getVector3ByPrefix(Vector3(), elementNode, 'end')
		self.start = evaluate.getVector3ByPrefix(Vector3(), elementNode, 'start')
		self.step = evaluate.getEvaluatedFloat(None, elementNode, 'step')
		self.steps = evaluate.getEvaluatedFloat(None, elementNode, 'steps')
		self.typeMenuRadioStrings = 'average maximum minimum'.split()
		self.typeString = evaluate.getEvaluatedString('minimum', elementNode, 'type')
Ejemplo n.º 23
0
Archivo: grid.py Proyecto: 3DNogi/SFACT
	def __init__(self, elementNode):
		self.inradius = lineation.getInradiusFirstByHeightWidth(complex(10.0, 10.0), elementNode)
		self.density = evaluate.getEvaluatedFloat(0.2, elementNode, 'density')
		self.radius = lineation.getComplexByPrefixBeginEnd(elementNode, 'radius', 'diameter', complex(1.0, 1.0))
		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')
Ejemplo n.º 24
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.closed = evaluate.getEvaluatedBoolean(False, elementNode, 'closed')
		self.end = evaluate.getVector3ByPrefix(Vector3(), elementNode, 'end')
		self.start = evaluate.getVector3ByPrefix(Vector3(), elementNode, 'start')
		self.step = evaluate.getEvaluatedFloat(None, elementNode, 'step')
		self.steps = evaluate.getEvaluatedFloat(None, elementNode, 'steps')
		self.typeMenuRadioStrings = 'average maximum minimum'.split()
		self.typeString = evaluate.getEvaluatedString('minimum', elementNode, 'type')
Ejemplo n.º 25
0
Archivo: line.py Proyecto: Sciumo/SFACT
	def __init__(self, xmlElement):
		"""Set defaults."""
		self.closed = evaluate.getEvaluatedBoolean(False, 'closed', xmlElement)
		self.end = evaluate.getVector3ByPrefix(Vector3(), 'end', xmlElement)
		self.start = evaluate.getVector3ByPrefix(Vector3(), 'start', xmlElement)
		self.step = evaluate.getEvaluatedFloat(None, 'step', xmlElement)
		self.steps = evaluate.getEvaluatedFloat(None, 'steps', xmlElement)
		self.typeMenuRadioStrings = 'average maximum minimum'.split()
		self.typeString = evaluate.getEvaluatedString('minimum', 'type', xmlElement)
Ejemplo n.º 26
0
	def __init__(self, elementNode):
		'Set defaults.'
		self.inradius = lineation.getInradiusFirstByHeightWidth(complex(10.0, 10.0), elementNode)
		self.density = evaluate.getEvaluatedFloat(0.2, elementNode, 'density')
		self.radius = lineation.getComplexByPrefixBeginEnd(elementNode, 'radius', 'diameter', complex(1.0, 1.0))
		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')
Ejemplo n.º 27
0
 def __init__(self, xmlElement):
     'Set defaults.'
     self.fileName = evaluate.getEvaluatedString('', 'file', xmlElement)
     self.heightGrid = evaluate.getEvaluatedValue([], 'heightGrid',
                                                  xmlElement)
     self.inradius = evaluate.getVector3ByPrefixes(['demisize', 'inradius'],
                                                   Vector3(10.0, 10.0, 5.0),
                                                   xmlElement)
     self.inradius = evaluate.getVector3ByMultiplierPrefix(
         2.0, 'size', self.inradius, xmlElement)
     self.start = evaluate.getEvaluatedFloat(0.0, 'start', xmlElement)
Ejemplo n.º 28
0
def writeXMLObject(absoluteFolderDirectory, derivation, fileNames, target, xmlObject):
	"Write one instance of the xmlObject."
	extension = evaluate.getEvaluatedString(xmlObject.getFabricationExtension(), derivation.elementNode, 'extension')
	fileNameRoot = derivation.fileName
	if fileNameRoot == '':
		fileNameRoot = evaluate.getEvaluatedString('', target, 'name')
		fileNameRoot = evaluate.getEvaluatedString(fileNameRoot, target, 'id')
		fileNameRoot += derivation.suffix
	fileName = '%s.%s' % (fileNameRoot, extension)
	suffixIndex = 2
	while fileName in fileNames:
		fileName = '%s_%s.%s' % (fileNameRoot, suffixIndex, extension)
		suffixIndex += 1
	absoluteFileName = os.path.join(absoluteFolderDirectory, fileName)
	fileNames.append(fileName)
	archive.makeDirectory(absoluteFolderDirectory)
	if not derivation.writeMatrix:
		xmlObject.matrix4X4 = matrix.Matrix()
	print('The write tool generated the file:')
	print(absoluteFileName)
	archive.writeFileText(absoluteFileName, xmlObject.getFabricationText(derivation.addLayerTemplate))
Ejemplo n.º 29
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)
Ejemplo n.º 30
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")
Ejemplo n.º 31
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
Ejemplo n.º 32
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
Ejemplo n.º 33
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)