Пример #1
0
def getArcPath(xmlElement):
    "Get the arc path.rx ry x-axis-rotation large-arc-flag sweep-flag"
    begin = xmlElement.getPreviousVertex(Vector3())
    end = evaluate.getVector3FromXMLElement(xmlElement)
    largeArcFlag = evaluate.getEvaluatedBooleanDefault(True, 'largeArcFlag',
                                                       xmlElement)
    radius = lineation.getComplexByPrefix('radius', complex(1.0, 1.0),
                                          xmlElement)
    sweepFlag = evaluate.getEvaluatedBooleanDefault(True, 'sweepFlag',
                                                    xmlElement)
    xAxisRotation = math.radians(
        evaluate.getEvaluatedFloatDefault(0.0, 'xAxisRotation', xmlElement))
    arcComplexes = svg_reader.getArcComplexes(begin.dropAxis(), end.dropAxis(),
                                              largeArcFlag, radius, sweepFlag,
                                              xAxisRotation)
    path = []
    if len(arcComplexes) < 1:
        return []
    incrementZ = (end.z - begin.z) / float(len(arcComplexes))
    z = begin.z
    for pointIndex in xrange(len(arcComplexes)):
        pointComplex = arcComplexes[pointIndex]
        z += incrementZ
        path.append(Vector3(pointComplex.real, pointComplex.imag, z))
    if len(path) > 0:
        path[-1] = end
    return path
Пример #2
0
def processXMLElement(xmlElement):
    'Process the xml element.'
    fileName = evaluate.getEvaluatedValue('file', xmlElement)
    if fileName == None:
        return
    parserFileName = xmlElement.getRoot().parser.fileName
    absoluteFileName = archive.getAbsoluteFolderPath(parserFileName, fileName)
    absoluteFileName = os.path.abspath(absoluteFileName)
    if 'models/' not in absoluteFileName:
        print(
            'Warning, models/ was not in the absolute file path, so for security nothing will be done for:'
        )
        print(xmlElement)
        print('For which the absolute file path is:')
        print(absoluteFileName)
        print(
            'The import tool can only read a file which has models/ in the file path.'
        )
        print(
            'To import the file, move the file into a folder called model/ or a subfolder which is inside the model folder tree.'
        )
        return
    xmlText = ''
    if fileName.endswith('.xml'):
        xmlText = archive.getFileText(absoluteFileName)
    else:
        xmlText = getXMLFromCarvingFileName(absoluteFileName)
    print('The import tool is opening the file:')
    print(absoluteFileName)
    if xmlText == '':
        print(
            'The file %s could not be found by processXMLElement in import.' %
            fileName)
        return
    if '_importName' in xmlElement.attributeDictionary:
        xmlElement.importName = xmlElement.attributeDictionary['_importName']
    else:
        xmlElement.importName = archive.getUntilDot(fileName)
        if evaluate.getEvaluatedBooleanDefault(True, 'basename', xmlElement):
            xmlElement.importName = os.path.basename(xmlElement.importName)
        xmlElement.attributeDictionary['_importName'] = xmlElement.importName
    importXMLElement = xml_simple_reader.XMLElement()
    xml_simple_reader.XMLSimpleReader(parserFileName, importXMLElement,
                                      xmlText)
    for child in importXMLElement.children:
        child.copyXMLChildren('', xmlElement)
        euclidean.removeElementsFromDictionary(child.attributeDictionary,
                                               ['id', 'name'])
        xmlElement.attributeDictionary.update(child.attributeDictionary)
        if evaluate.getEvaluatedBooleanDefault(False, 'overwriteRoot',
                                               xmlElement):
            xmlElement.getRoot().attributeDictionary.update(
                child.attributeDictionary)
    group.processShape(group.Group, xmlElement)
Пример #3
0
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
    "Get path with overhangs removed or filled in."
    if len(loop) < 3:
        return [loop]
    if not evaluate.getEvaluatedBooleanDefault(True, prefix + 'activate',
                                               xmlElement):
        return [loop]
    overhangAngle = evaluate.getOverhangSupportAngle(xmlElement)
    overhangPlaneAngle = euclidean.getWiddershinsUnitPolar(0.5 * math.pi -
                                                           overhangAngle)
    overhangVerticalAngle = math.radians(
        evaluate.getEvaluatedFloatDefault(0.0, prefix + 'inclination',
                                          xmlElement))
    if overhangVerticalAngle != 0.0:
        overhangVerticalCosine = abs(math.cos(overhangVerticalAngle))
        if overhangVerticalCosine == 0.0:
            return [loop]
        imaginaryTimesCosine = overhangPlaneAngle.imag * overhangVerticalCosine
        overhangPlaneAngle = euclidean.getNormalized(
            complex(overhangPlaneAngle.real, imaginaryTimesCosine))
    alongAway = AlongAway(loop, overhangPlaneAngle)
    if euclidean.getIsWiddershinsByVector3(loop):
        alterWiddershinsSupportedPath(alongAway, close)
    else:
        alterClockwiseSupportedPath(alongAway, xmlElement)
    return [
        euclidean.getLoopWithoutCloseSequentialPoints(close, alongAway.loop)
    ]
Пример #4
0
def writeXMLElement(fileNames, target, xmlElement):
	"Write target."
	object = target.object
	if object == None:
		print('Warning, writeTarget in write could not get object for:')
		print(xmlElement)
		return
	fileNameRoot = evaluate.getEvaluatedStringDefault('', 'name', target)
	fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'id', target)
	fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'file', xmlElement)
	fileNameRoot += evaluate.getEvaluatedStringDefault('', 'suffix', xmlElement)
	extension = evaluate.getEvaluatedStringDefault(object.getFabricationExtension(), 'extension', xmlElement)
	fileName = '%s.%s' % (fileNameRoot, extension)
	suffixIndex = 1
	while fileName in fileNames:
		fileName = '%s_%s.%s' % (fileNameRoot, suffixIndex, extension)
		suffixIndex += 1
	folderName = evaluate.getEvaluatedStringDefault('', 'folder', xmlElement)
	absoluteFolderDirectory = os.path.join(os.path.dirname(xmlElement.getRoot().parser.fileName), folderName)
	absoluteFileName = os.path.abspath(os.path.join(absoluteFolderDirectory, fileName))
	if 'models/' not in absoluteFileName:
		print('Warning, models/ was not in the absolute file path, so for security nothing will be done for:')
		print(xmlElement)
		print('For which the absolute file path is:')
		print(absoluteFileName)
		print('The write tool can only write a file which has models/ in the file path.')
		print('To write the file, move the file into a folder called model/ or a subfolder which is inside the model folder tree.')
		return
	fileNames.append(fileName)
	archive.makeDirectory(absoluteFolderDirectory)
	if not evaluate.getEvaluatedBooleanDefault(True, 'writeMatrix', xmlElement):
		object.matrix4X4 = matrix.Matrix()
	print('The write tool generated the file:')
	print(absoluteFileName)
	archive.writeFileText(absoluteFileName, object.getFabricationText())
Пример #5
0
def processXMLElementByGeometry(geometryOutput, xmlElement):
	"Process the xml element by geometryOutput."
	if geometryOutput == None:
		return
	geometryOutput = evaluate.getVector3ListsRecursively(geometryOutput)
	if 'target' in xmlElement.attributeDictionary and not evaluate.getEvaluatedBooleanDefault(False, 'copy', xmlElement):
		target = evaluate.getEvaluatedLinkValue(str(xmlElement.attributeDictionary['target']).strip(), xmlElement)
		if target.__class__.__name__ == 'XMLElement':
			target.removeChildrenFromIDNameParent()
			xmlElement = target
			if xmlElement.object != None:
				if xmlElement.parent.object != None:
					if xmlElement.object in xmlElement.parent.object.archivableObjects:
						xmlElement.parent.object.archivableObjects.remove(xmlElement.object)
	firstElement = None
	if len(geometryOutput) > 0:
		firstElement = geometryOutput[0]
	if firstElement.__class__ == list:
		if len(firstElement) > 1:
			path.convertXMLElementRenameByPaths(geometryOutput, xmlElement)
		else:
			path.convertXMLElementRename(firstElement, xmlElement)
	else:
		path.convertXMLElementRename(geometryOutput, xmlElement)
	path.processXMLElement(xmlElement)
Пример #6
0
def processXMLElementByGeometry(geometryOutput, xmlElement):
    "Process the xml element by geometryOutput."
    if geometryOutput == None:
        return
    geometryOutput = evaluate.getVector3ListsRecursively(geometryOutput)
    if 'target' in xmlElement.attributeDictionary and not evaluate.getEvaluatedBooleanDefault(
            False, 'copy', xmlElement):
        target = evaluate.getEvaluatedLinkValue(
            str(xmlElement.attributeDictionary['target']).strip(), xmlElement)
        if target.__class__.__name__ == 'XMLElement':
            target.removeChildrenFromIDNameParent()
            xmlElement = target
            if xmlElement.object != None:
                if xmlElement.parent.object != None:
                    if xmlElement.object in xmlElement.parent.object.archivableObjects:
                        xmlElement.parent.object.archivableObjects.remove(
                            xmlElement.object)
    firstElement = None
    if len(geometryOutput) > 0:
        firstElement = geometryOutput[0]
    if firstElement.__class__ == list:
        if len(firstElement) > 1:
            path.convertXMLElementRenameByPaths(geometryOutput, xmlElement)
        else:
            path.convertXMLElementRename(firstElement, xmlElement)
    else:
        path.convertXMLElementRename(geometryOutput, xmlElement)
    path.processXMLElement(xmlElement)
Пример #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.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)
Пример #8
0
 def __init__(self, xmlElement):
     'Initialize.'
     self.interpolationDictionary = {}
     self.radius = lineation.getRadiusComplex(complex(), xmlElement)
     self.tiltFollow = evaluate.getEvaluatedBooleanDefault(
         True, 'tiltFollow', xmlElement)
     self.tiltTop = evaluate.getVector3ByPrefix(None, 'tiltTop', xmlElement)
     self.maximumUnbuckling = evaluate.getEvaluatedFloatDefault(
         5.0, 'maximumUnbuckling', xmlElement)
     scalePathDefault = [Vector3(1.0, 1.0, 0.0), Vector3(1.0, 1.0, 1.0)]
     self.interpolationDictionary['scale'] = Interpolation().getByPrefixZ(
         scalePathDefault, 'scale', xmlElement)
     self.target = evaluate.getTransformedPathsByKey([], 'target',
                                                     xmlElement)
     if self.tiltTop == None:
         offsetPathDefault = [Vector3(), Vector3(0.0, 0.0, 1.0)]
         self.interpolationDictionary['offset'] = Interpolation(
         ).getByPrefixZ(offsetPathDefault, '', xmlElement)
         tiltPathDefault = [Vector3(), Vector3(0.0, 0.0, 1.0)]
         self.interpolationDictionary['tilt'] = Interpolation(
         ).getByPrefixZ(tiltPathDefault, 'tilt', xmlElement)
         for point in self.interpolationDictionary['tilt'].path:
             point.x = math.radians(point.x)
             point.y = math.radians(point.y)
     else:
         offsetAlongDefault = [Vector3(), Vector3(1.0, 0.0, 0.0)]
         self.interpolationDictionary['offset'] = Interpolation(
         ).getByPrefixAlong(offsetAlongDefault, '', xmlElement)
     self.twist = evaluate.getEvaluatedFloatDefault(0.0, 'twist',
                                                    xmlElement)
     self.twistPathDefault = [Vector3(), Vector3(1.0, self.twist)]
     insertTwistPortions(self, xmlElement)
Пример #9
0
 def getOriginalRoot(self):
     'Get the original reparsed root element.'
     if evaluate.getEvaluatedBooleanDefault(True, 'getOriginalRoot',
                                            self.root):
         return XMLSimpleReader(self.fileName, self.parent,
                                self.xmlText).root
     return None
Пример #10
0
 def setToXMLElement(self, xmlElement):
     "Set to the xmlElement."
     self.radius = lineation.getRadiusComplex(self.radius, xmlElement)
     self.tiltFollow = evaluate.getEvaluatedBooleanDefault(self.tiltFollow, "tiltfollow", xmlElement)
     self.tiltTop = evaluate.getVector3ByPrefix("tilttop", self.tiltTop, xmlElement)
     self.maximumUnbuckling = evaluate.getEvaluatedFloatDefault(
         self.maximumUnbuckling, "maximumUnbuckling", xmlElement
     )
     self.interpolationDictionary["scale"] = Interpolation().getByPrefixZ(self.scalePathDefault, "scale", xmlElement)
     if len(self.target) < 1:
         self.target = evaluate.getTransformedPathsByKey("target", xmlElement)
     if self.tiltTop == None:
         self.interpolationDictionary["offset"] = Interpolation().getByPrefixZ(
             self.offsetPathDefault, "", xmlElement
         )
         self.interpolationDictionary["tilt"] = Interpolation().getByPrefixZ(
             self.tiltPathDefault, "tilt", xmlElement
         )
         for point in self.interpolationDictionary["tilt"].path:
             point.x = math.radians(point.x)
             point.y = math.radians(point.y)
     else:
         self.interpolationDictionary["offset"] = Interpolation().getByPrefixAlong(
             self.offsetAlongDefault, "", xmlElement
         )
     self.twist = evaluate.getEvaluatedFloatDefault(self.twist, "twist", xmlElement)
     if self.twist != 0.0:
         self.twistPathDefault = [Vector3(), Vector3(1.0, self.twist)]
     insertTwistPortions(self, xmlElement)
Пример #11
0
 def setToXMLElement(self, xmlElement):
     "Set to the xmlElement."
     self.radius = lineation.getRadiusComplex(self.radius, xmlElement)
     self.tiltFollow = evaluate.getEvaluatedBooleanDefault(
         self.tiltFollow, 'tiltfollow', xmlElement)
     self.tiltTop = evaluate.getVector3ByPrefix(self.tiltTop, 'tilttop',
                                                xmlElement)
     self.maximumUnbuckling = evaluate.getEvaluatedFloatDefault(
         self.maximumUnbuckling, 'maximumUnbuckling', xmlElement)
     self.interpolationDictionary['scale'] = Interpolation().getByPrefixZ(
         self.scalePathDefault, 'scale', xmlElement)
     if len(self.target) < 1:
         self.target = evaluate.getTransformedPathsByKey(
             'target', xmlElement)
     if self.tiltTop == None:
         self.interpolationDictionary['offset'] = Interpolation(
         ).getByPrefixZ(self.offsetPathDefault, '', xmlElement)
         self.interpolationDictionary['tilt'] = Interpolation(
         ).getByPrefixZ(self.tiltPathDefault, 'tilt', xmlElement)
         for point in self.interpolationDictionary['tilt'].path:
             point.x = math.radians(point.x)
             point.y = math.radians(point.y)
     else:
         self.interpolationDictionary['offset'] = Interpolation(
         ).getByPrefixAlong(self.offsetAlongDefault, '', xmlElement)
     self.twist = evaluate.getEvaluatedFloatDefault(self.twist, 'twist',
                                                    xmlElement)
     if self.twist != 0.0:
         self.twistPathDefault = [Vector3(), Vector3(1.0, self.twist)]
     insertTwistPortions(self, xmlElement)
Пример #12
0
	def setToXMLElement(self, xmlElement):
		"Set to the xmlElement."
		self.closed = evaluate.getEvaluatedBooleanDefault(False, 'closed', xmlElement)
		self.end = evaluate.getVector3ByPrefix('end', self.end, xmlElement)
		self.start = evaluate.getVector3ByPrefix('start', self.start, xmlElement)
		self.step = evaluate.getEvaluatedFloatDefault(self.step, 'step', xmlElement)
		self.steps = evaluate.getEvaluatedFloatDefault(self.steps, 'steps', xmlElement)
		self.typeString = evaluate.getEvaluatedStringDefault(self.typeString, 'type', xmlElement)
Пример #13
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.closed = evaluate.getEvaluatedBooleanDefault(False, 'closed', xmlElement)
		self.end = evaluate.getVector3ByPrefix(Vector3(), 'end', xmlElement)
		self.start = evaluate.getVector3ByPrefix(Vector3(), 'start', xmlElement)
		self.step = evaluate.getEvaluatedFloatDefault(None, 'step', xmlElement)
		self.steps = evaluate.getEvaluatedFloatDefault(None, 'steps', xmlElement)
		self.typeMenuRadioStrings = 'average maximum minimum'.split()
		self.typeString = evaluate.getEvaluatedStringDefault('minimum', 'type', xmlElement)
Пример #14
0
def transformIfFromEvaluatorCreation( path, xmlElement ):
	"Transform the path if the xmlElement came from a EvaluatorCreation."
	if not evaluate.getEvaluatedBooleanDefault( False, '_fromEvaluatorCreation', xmlElement ):
		return
	xmlElementMatrix = matrix4x4.Matrix4X4().getFromXMLElement( xmlElement )
	if xmlElementMatrix.getIsDefault():
		return
	for point in path:
		point.setToVector3( matrix4x4.getVector3TransformedByMatrix( xmlElementMatrix.matrixTetragrid, point ) )
Пример #15
0
def getArcPath(xmlElement):
	"Get the arc path.rx ry x-axis-rotation large-arc-flag sweep-flag"
	begin = xmlElement.getPreviousVertex(Vector3())
	end = evaluate.getVector3FromXMLElement(xmlElement)
	largeArcFlag = evaluate.getEvaluatedBooleanDefault(True, 'largeArcFlag', xmlElement)
	radius = lineation.getComplexByPrefix('radius', complex(1.0, 1.0), xmlElement )
	sweepFlag = evaluate.getEvaluatedBooleanDefault(True, 'sweepFlag', xmlElement)
	xAxisRotation = math.radians(evaluate.getEvaluatedFloatZero('xAxisRotation', xmlElement ))
	arcComplexes = svg_reader.getArcComplexes(begin.dropAxis(), end.dropAxis(), largeArcFlag, radius, sweepFlag, xAxisRotation)
	path = []
	incrementZ = (end.z - begin.z) / float(len(arcComplexes))
	z = begin.z
	for pointIndex in xrange(len(arcComplexes)):
		pointComplex = arcComplexes[pointIndex]
		z += incrementZ
		path.append(Vector3(pointComplex.real, pointComplex.imag, z))
	if len(path) > 0:
		path[-1] = end
	return path
Пример #16
0
def processXMLElement(xmlElement):
	'Process the xml element.'
	fileName = evaluate.getEvaluatedValue('file', xmlElement )
	if fileName == None:
		return
	parserFileName = xmlElement.getRoot().parser.fileName
	absoluteFileName = archive.getAbsoluteFolderPath(parserFileName, fileName)
	absoluteFileName = os.path.abspath(absoluteFileName)
	if 'models/' not in absoluteFileName:
		print('Warning, models/ was not in the absolute file path, so for security nothing will be done for:')
		print(xmlElement)
		print('For which the absolute file path is:')
		print(absoluteFileName)
		print('The import tool can only read a file which has models/ in the file path.')
		print('To import the file, move the file into a folder called model/ or a subfolder which is inside the model folder tree.')
		return
	xmlText = ''
	if fileName.endswith('.xml'):
		xmlText = archive.getFileText(absoluteFileName)
	else:
		xmlText = getXMLFromCarvingFileName(absoluteFileName)
	print('The import tool is opening the file:')
	print(absoluteFileName)
	if xmlText == '':
		print('The file %s could not be found by processXMLElement in import.' % fileName)
		return
	if '_importName' in xmlElement.attributeDictionary:
		xmlElement.importName = xmlElement.attributeDictionary['_importName']
	else:
		xmlElement.importName = archive.getUntilDot(fileName)
		if evaluate.getEvaluatedBooleanDefault(True, 'basename', xmlElement):
			xmlElement.importName = os.path.basename(xmlElement.importName)
		xmlElement.attributeDictionary['_importName'] = xmlElement.importName
	importXMLElement = xml_simple_reader.XMLElement()
	xml_simple_reader.XMLSimpleReader(parserFileName, importXMLElement, xmlText)
	for child in importXMLElement.children:
		child.copyXMLChildren('', xmlElement)
		euclidean.removeElementsFromDictionary(child.attributeDictionary, ['id', 'name'])
		xmlElement.attributeDictionary.update(child.attributeDictionary)
		if evaluate.getEvaluatedBooleanDefault(False, 'overwriteRoot', xmlElement):
			xmlElement.getRoot().attributeDictionary.update(child.attributeDictionary)
	group.processShape(group.Group, xmlElement)
Пример #17
0
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
	"Get path with overhangs removed or filled in."
	if len(loop) < 2:
		return [loop]
	isClosed = evaluate.getEvaluatedBooleanDefault(False, prefix + 'closed', xmlElement)
	radius = lineation.getStrokeRadiusByPrefix(prefix, xmlElement )
	loopComplex = euclidean.getComplexPath(loop)
	if isClosed:
		loopComplexes = intercircle.getAroundsFromLoop(loopComplex, radius)
	else:
		loopComplexes = intercircle.getAroundsFromPath(loopComplex, radius)
	return euclidean.getVector3Paths(loopComplexes, loop[0].z)
Пример #18
0
def getGeometryOutput(xmlElement):
    "Get vector3 vertices from attribute dictionary."
    paths = evaluate.getPathsByKeys(['crosssection', 'section', 'target'],
                                    xmlElement)
    if len(euclidean.getConcatenatedList(paths)) == 0:
        print('Warning, in extrude there are no paths.')
        print(xmlElement.attributeDictionary)
        return None
    offsetPathDefault = [Vector3(), Vector3(0.0, 0.0, 1.0)]
    extrude = Extrude()
    extrude.tiltFollow = evaluate.getEvaluatedBooleanDefault(
        extrude.tiltFollow, 'tiltfollow', xmlElement)
    extrude.tiltTop = evaluate.getVector3ByPrefix('tilttop', extrude.tiltTop,
                                                  xmlElement)
    extrude.maximumUnbuckling = evaluate.getEvaluatedFloatDefault(
        5.0, 'maximumunbuckling', xmlElement)
    scalePathDefault = [Vector3(1.0, 1.0, 0.0), Vector3(1.0, 1.0, 1.0)]
    extrude.interpolationDictionary['scale'] = evaluate.Interpolation(
    ).getByPrefixZ(scalePathDefault, 'scale', xmlElement)
    if extrude.tiltTop == None:
        extrude.interpolationDictionary['offset'] = evaluate.Interpolation(
        ).getByPrefixZ(offsetPathDefault, '', xmlElement)
        tiltPathDefault = [Vector3(), Vector3(0.0, 0.0, 1.0)]
        interpolationTilt = evaluate.Interpolation().getByPrefixZ(
            tiltPathDefault, 'tilt', xmlElement)
        extrude.interpolationDictionary['tilt'] = interpolationTilt
        for point in interpolationTilt.path:
            point.x = math.radians(point.x)
            point.y = math.radians(point.y)
    else:
        offsetAlongDefault = [Vector3(), Vector3(1.0, 0.0, 0.0)]
        extrude.interpolationDictionary['offset'] = evaluate.Interpolation(
        ).getByPrefixAlong(offsetAlongDefault, '', xmlElement)
    insertTwistPortions(extrude.interpolationDictionary, xmlElement)
    segments = evaluate.getEvaluatedIntOne('segments', xmlElement)
    negatives = []
    positives = []
    portionDirections = evaluate.getSpacedPortionDirections(
        extrude.interpolationDictionary)
    for path in paths:
        endMultiplier = None
        if not euclidean.getIsWiddershinsByVector3(path):
            endMultiplier = 1.000001
        geometryOutput = getGeometryOutputByPath(endMultiplier, extrude, path,
                                                 portionDirections)
        if endMultiplier == None:
            positives.append(geometryOutput)
        else:
            negatives.append(geometryOutput)
    positiveOutput = trianglemesh.getUnifiedOutput(positives)
    if len(negatives) < 1:
        return positiveOutput
    return {'difference': [positiveOutput] + negatives}
Пример #19
0
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
	"Get path with overhangs removed or filled in."
	if len(loop) < 2:
		return [loop]
	isClosed = evaluate.getEvaluatedBooleanDefault(False, prefix + 'closed', xmlElement)
	radius = lineation.getStrokeRadiusByPrefix(prefix, xmlElement )
	loopComplex = euclidean.getComplexPath(loop)
	if isClosed:
		loopComplexes = intercircle.getAroundsFromLoop(loopComplex, radius)
	else:
		loopComplexes = intercircle.getAroundsFromPath(loopComplex, radius)
	return euclidean.getVector3Paths(loopComplexes, loop[0].z)
Пример #20
0
 def __init__(self, xmlElement):
     'Set defaults.'
     self.closed = evaluate.getEvaluatedBooleanDefault(
         False, 'closed', xmlElement)
     self.end = evaluate.getVector3ByPrefix(Vector3(), 'end', xmlElement)
     self.start = evaluate.getVector3ByPrefix(Vector3(), 'start',
                                              xmlElement)
     self.step = evaluate.getEvaluatedFloatDefault(None, 'step', xmlElement)
     self.steps = evaluate.getEvaluatedFloatDefault(None, 'steps',
                                                    xmlElement)
     self.typeMenuRadioStrings = 'average maximum minimum'.split()
     self.typeString = evaluate.getEvaluatedStringDefault(
         'minimum', 'type', xmlElement)
Пример #21
0
 def setToXMLElement(self, xmlElement):
     "Set to the xmlElement."
     self.closed = evaluate.getEvaluatedBooleanDefault(
         False, 'closed', xmlElement)
     self.end = evaluate.getVector3ByPrefix(self.end, 'end', xmlElement)
     self.start = evaluate.getVector3ByPrefix(self.start, 'start',
                                              xmlElement)
     self.step = evaluate.getEvaluatedFloatDefault(self.step, 'step',
                                                   xmlElement)
     self.steps = evaluate.getEvaluatedFloatDefault(self.steps, 'steps',
                                                    xmlElement)
     self.typeString = evaluate.getEvaluatedStringDefault(
         self.typeString, 'type', xmlElement)
Пример #22
0
	def __init__(self, xmlElement):
		'Set defaults.'
		self.inradius = lineation.getComplexByPrefixes(['demisize', 'inradius'], complex(10.0, 10.0), xmlElement)
		self.inradius = lineation.getComplexByMultiplierPrefix(2.0, 'size', self.inradius, xmlElement)
		self.demiwidth = lineation.getFloatByPrefixBeginEnd('demiwidth', 'width', self.inradius.real, xmlElement)
		self.demiheight = lineation.getFloatByPrefixBeginEnd('demiheight', 'height', self.inradius.imag, xmlElement)
		self.packingDensity = evaluate.getEvaluatedFloatByKeys(0.2, ['packingDensity', 'density'], xmlElement)
		self.radius = lineation.getComplexByPrefixBeginEnd('elementRadius', 'elementDiameter', complex(1.0, 1.0), xmlElement)
		self.radius = lineation.getComplexByPrefixBeginEnd('radius', 'diameter', self.radius, xmlElement)
		self.seed = evaluate.getEvaluatedIntDefault(None, 'seed', xmlElement)
		self.target = evaluate.getTransformedPathsByKey([], 'target', xmlElement)
		self.typeMenuRadioStrings = 'hexagonal random rectangular'.split()
		self.typeString = evaluate.getEvaluatedStringDefault('rectangular', 'type', xmlElement)
		self.zigzag = evaluate.getEvaluatedBooleanDefault(True, 'zigzag', xmlElement)
Пример #23
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)
Пример #24
0
def getGeometryOutput(xmlElement):
	"Get vector3 vertexes from attribute dictionary."
	start = evaluate.getVector3ByPrefix('start', Vector3(), xmlElement)
	end = evaluate.getVector3ByPrefix('end', Vector3(), xmlElement)
	endMinusStart = end - start
	endMinusStartLength = abs(endMinusStart)
	if endMinusStartLength <= 0.0:
		print('Warning, end is the same as start in getGeometryOutput in line for:')
		print(start)
		print(end)
		print(xmlElement)
		return None
	steps = evaluate.getEvaluatedFloatDefault(None, 'steps', xmlElement)
	step = evaluate.getEvaluatedFloatDefault(None, 'step', xmlElement)
	xmlElement.attributeDictionary['closed'] = str(evaluate.getEvaluatedBooleanDefault(False, 'closed', xmlElement))
	if step == None and steps == None:
		return lineation.getGeometryOutputByLoop(lineation.SideLoop([start, end]), xmlElement)
	loop = [start]
	if step != None and steps != None:
		stepVector = step / endMinusStartLength * endMinusStart
		end = start + stepVector * steps
		return getGeometryOutputByStep(end, loop, steps, stepVector, xmlElement)
	if step == None:
		stepVector = endMinusStart / steps
		return getGeometryOutputByStep(end, loop, steps, stepVector, xmlElement)
	typeString = evaluate.getEvaluatedStringDefault('minimum', 'type', xmlElement)
	endMinusStartLengthOverStep = endMinusStartLength / step
	if typeString == 'average':
		steps = max(1.0, round(endMinusStartLengthOverStep))
		stepVector = step / endMinusStartLength * endMinusStart
		end = start + stepVector * steps
		return getGeometryOutputByStep(end, loop, steps, stepVector, xmlElement)
	if typeString == 'maximum':
		steps = math.ceil(endMinusStartLengthOverStep)
		if steps < 1.0:
			return lineation.getGeometryOutputByLoop(lineation.SideLoop([start, end]), xmlElement)
		stepVector = endMinusStart / steps
		return getGeometryOutputByStep(end, loop, steps, stepVector, xmlElement)
	if typeString == 'minimum':
		steps = math.floor(endMinusStartLengthOverStep)
		if steps < 1.0:
			return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop), xmlElement)
		stepVector = endMinusStart / steps
		return getGeometryOutputByStep(end, loop, steps, stepVector, xmlElement)
	print('Warning, the step type was not one of (average, maximum or minimum) in getGeometryOutput in line for:')
	print(typeString)
	print(xmlElement)
	loop.append(end)
	return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop), xmlElement)
Пример #25
0
def writeXMLElement(fileNames, target, xmlElement):
    "Write target."
    object = target.object
    if object == None:
        print('Warning, writeTarget in write could not get object for:')
        print(xmlElement)
        return
    fileNameRoot = evaluate.getEvaluatedStringDefault('', 'name', target)
    fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'id',
                                                      target)
    fileNameRoot = evaluate.getEvaluatedStringDefault(fileNameRoot, 'file',
                                                      xmlElement)
    fileNameRoot += evaluate.getEvaluatedStringDefault('', 'suffix',
                                                       xmlElement)
    extension = evaluate.getEvaluatedStringDefault(
        object.getFabricationExtension(), 'extension', xmlElement)
    fileName = '%s.%s' % (fileNameRoot, extension)
    suffixIndex = 1
    while fileName in fileNames:
        fileName = '%s_%s.%s' % (fileNameRoot, suffixIndex, extension)
        suffixIndex += 1
    folderName = evaluate.getEvaluatedStringDefault('', 'folder', xmlElement)
    absoluteFolderDirectory = os.path.join(
        os.path.dirname(xmlElement.getRoot().parser.fileName), folderName)
    absoluteFileName = os.path.abspath(
        os.path.join(absoluteFolderDirectory, fileName))
    if 'models/' not in absoluteFileName:
        print(
            'Warning, models/ was not in the absolute file path, so for security nothing will be done for:'
        )
        print(xmlElement)
        print('For which the absolute file path is:')
        print(absoluteFileName)
        print(
            'The write tool can only write a file which has models/ in the file path.'
        )
        print(
            'To write the file, move the file into a folder called model/ or a subfolder which is inside the model folder tree.'
        )
        return
    fileNames.append(fileName)
    archive.makeDirectory(absoluteFolderDirectory)
    if not evaluate.getEvaluatedBooleanDefault(True, 'writeMatrix',
                                               xmlElement):
        object.matrix4X4 = matrix.Matrix()
    print('The write tool generated the file:')
    print(absoluteFileName)
    archive.writeFileText(absoluteFileName, object.getFabricationText())
Пример #26
0
	def setToXMLElement(self, xmlElement):
		"Set to the xmlElement."
		self.tiltFollow = evaluate.getEvaluatedBooleanDefault(self.tiltFollow, 'tiltfollow', xmlElement)
		self.tiltTop = evaluate.getVector3ByPrefix('tilttop', self.tiltTop, xmlElement)
		self.maximumUnbuckling = evaluate.getEvaluatedFloatDefault(self.maximumUnbuckling, 'maximumUnbuckling', xmlElement)
		self.interpolationDictionary['scale'] = Interpolation().getByPrefixZ(self.scalePathDefault, 'scale', xmlElement)
		if self.tiltTop == None:
			self.interpolationDictionary['offset'] = Interpolation().getByPrefixZ(self.offsetPathDefault, '', xmlElement)
			self.interpolationDictionary['tilt'] = Interpolation().getByPrefixZ(self.tiltPathDefault, 'tilt', xmlElement)
			for point in self.interpolationDictionary['tilt'].path:
				point.x = math.radians(point.x)
				point.y = math.radians(point.y)
		else:
			self.interpolationDictionary['offset'] = Interpolation().getByPrefixAlong(self.offsetAlongDefault, '', xmlElement)
		self.twist = evaluate.getEvaluatedFloatDefault(self.twist, 'twist', xmlElement )
		if self.twist != 0.0:
			self.twistPathDefault = [Vector3(), Vector3(1.0, self.twist) ]
		insertTwistPortions(self, xmlElement)
Пример #27
0
def getGeometryOutput(xmlElement):
	"Get triangle mesh from attribute dictionary."
	paths = evaluate.getPathsByKeys( ['crosssection', 'section', 'target'], xmlElement )
	if len( euclidean.getConcatenatedList( paths ) ) == 0:
		print('Warning, in extrude there are no paths.')
		print( xmlElement.attributeDictionary )
		return None
	offsetPathDefault = [ Vector3(), Vector3( 0.0, 0.0, 1.0 ) ]
	extrude = Extrude()
	extrude.tiltFollow = evaluate.getEvaluatedBooleanDefault( extrude.tiltFollow, 'tiltfollow', xmlElement )
	extrude.tiltTop = evaluate.getVector3ByPrefix('tilttop', extrude.tiltTop, xmlElement )
	extrude.maximumUnbuckling = evaluate.getEvaluatedFloatDefault( 5.0, 'maximumunbuckling', xmlElement )
	scalePathDefault = [ Vector3( 1.0, 1.0, 0.0 ), Vector3( 1.0, 1.0, 1.0 ) ]
	extrude.interpolationDictionary['scale'] = Interpolation().getByPrefixZ( scalePathDefault, 'scale', xmlElement )
	if extrude.tiltTop == None:
		extrude.interpolationDictionary['offset'] = Interpolation().getByPrefixZ( offsetPathDefault, '', xmlElement )
		tiltPathDefault = [ Vector3(), Vector3( 0.0, 0.0, 1.0 ) ]
		interpolationTilt = Interpolation().getByPrefixZ( tiltPathDefault, 'tilt', xmlElement )
		extrude.interpolationDictionary['tilt'] = interpolationTilt
		for point in interpolationTilt.path:
			point.x = math.radians( point.x )
			point.y = math.radians( point.y )
	else:
		offsetAlongDefault = [ Vector3(), Vector3( 1.0, 0.0, 0.0 ) ]
		extrude.interpolationDictionary['offset'] = Interpolation().getByPrefixAlong( offsetAlongDefault, '', xmlElement )
	insertTwistPortions( extrude.interpolationDictionary, xmlElement )
	segments = evaluate.getEvaluatedIntOne('segments', xmlElement )
	negatives = []
	positives = []
	portionDirections = getSpacedPortionDirections( extrude.interpolationDictionary )
	for path in paths:
		endMultiplier = None
		if not euclidean.getIsWiddershinsByVector3( path ):
			endMultiplier = 1.000001
		geometryOutput = getGeometryOutputByPath( endMultiplier, extrude, path, portionDirections )
		if endMultiplier == None:
			positives.append( geometryOutput )
		else:
			negatives.append( geometryOutput )
	positiveOutput = trianglemesh.getUnifiedOutput( positives )
	interpolationOffset = extrude.interpolationDictionary['offset']
	if len( negatives ) < 1:
		return getGeometryOutputWithConnection( positiveOutput, interpolationOffset, xmlElement )
	return getGeometryOutputWithConnection( { 'difference' : [ positiveOutput ] + negatives }, interpolationOffset, xmlElement )
Пример #28
0
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
	"Get path with overhangs removed or filled in."
	if len(loop) < 3:
		return [loop]
	if not evaluate.getEvaluatedBooleanDefault( True, prefix + 'activate', xmlElement ):
		return [loop]
	overhangAngle = math.radians( xmlElement.getCascadeFloat( 45.0, 'overhang.supportangle') )
	overhangPlaneAngle = euclidean.getWiddershinsUnitPolar( 0.5 * math.pi - overhangAngle )
	overhangVerticalAngle = math.radians( evaluate.getEvaluatedFloatZero( prefix + 'inclination', xmlElement ) )
	if overhangVerticalAngle != 0.0:
		overhangVerticalCosine = abs( math.cos( overhangVerticalAngle ) )
		if overhangVerticalCosine == 0.0:
			return [loop]
		imaginaryTimesCosine = overhangPlaneAngle.imag * overhangVerticalCosine
		overhangPlaneAngle = euclidean.getNormalized( complex( overhangPlaneAngle.real, imaginaryTimesCosine ) )
	alongAway = AlongAway( loop, overhangPlaneAngle )
	if euclidean.getIsWiddershinsByVector3(loop):
		alterWiddershinsSupportedPath( alongAway, close )
	else:
		alterClockwiseSupportedPath( alongAway, xmlElement )
	return [ euclidean.getLoopWithoutCloseSequentialPoints( close,  alongAway.loop ) ]
Пример #29
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)
Пример #30
0
	def __init__(self, xmlElement):
		'Initialize.'
		self.interpolationDictionary = {}
		self.radius = lineation.getRadiusComplex(complex(), xmlElement)
		self.tiltFollow = evaluate.getEvaluatedBooleanDefault(True, 'tiltFollow', xmlElement)
		self.tiltTop = evaluate.getVector3ByPrefix(None, 'tiltTop', xmlElement)
		self.maximumUnbuckling = evaluate.getEvaluatedFloatDefault(5.0, 'maximumUnbuckling', xmlElement)
		scalePathDefault = [Vector3(1.0, 1.0, 0.0), Vector3(1.0, 1.0, 1.0)]
		self.interpolationDictionary['scale'] = Interpolation().getByPrefixZ(scalePathDefault, 'scale', xmlElement)
		self.target = evaluate.getTransformedPathsByKey([], 'target', xmlElement)
		if self.tiltTop == None:
			offsetPathDefault = [Vector3(), Vector3(0.0, 0.0, 1.0)]
			self.interpolationDictionary['offset'] = Interpolation().getByPrefixZ(offsetPathDefault, '', xmlElement)
			tiltPathDefault = [Vector3(), Vector3(0.0, 0.0, 1.0)]
			self.interpolationDictionary['tilt'] = Interpolation().getByPrefixZ(tiltPathDefault, 'tilt', xmlElement)
			for point in self.interpolationDictionary['tilt'].path:
				point.x = math.radians(point.x)
				point.y = math.radians(point.y)
		else:
			offsetAlongDefault = [Vector3(), Vector3(1.0, 0.0, 0.0)]
			self.interpolationDictionary['offset'] = Interpolation().getByPrefixAlong(offsetAlongDefault, '', xmlElement)
		self.twist = evaluate.getEvaluatedFloatDefault(0.0, 'twist', xmlElement )
		self.twistPathDefault = [Vector3(), Vector3(1.0, self.twist) ]
		insertTwistPortions(self, xmlElement)
Пример #31
0
 def __init__(self, xmlElement):
     'Set defaults.'
     self.inradius = lineation.getComplexByPrefixes(
         ['demisize', 'inradius'], complex(10.0, 10.0), xmlElement)
     self.inradius = lineation.getComplexByMultiplierPrefix(
         2.0, 'size', self.inradius, xmlElement)
     self.demiwidth = lineation.getFloatByPrefixBeginEnd(
         'demiwidth', 'width', self.inradius.real, xmlElement)
     self.demiheight = lineation.getFloatByPrefixBeginEnd(
         'demiheight', 'height', self.inradius.imag, xmlElement)
     self.packingDensity = evaluate.getEvaluatedFloatByKeys(
         0.2, ['packingDensity', 'density'], xmlElement)
     self.radius = lineation.getComplexByPrefixBeginEnd(
         'elementRadius', 'elementDiameter', complex(1.0, 1.0), xmlElement)
     self.radius = lineation.getComplexByPrefixBeginEnd(
         'radius', 'diameter', self.radius, xmlElement)
     self.seed = evaluate.getEvaluatedIntDefault(None, 'seed', xmlElement)
     self.target = evaluate.getTransformedPathsByKey([], 'target',
                                                     xmlElement)
     self.typeMenuRadioStrings = 'hexagonal random rectangular'.split()
     self.typeString = evaluate.getEvaluatedStringDefault(
         'rectangular', 'type', xmlElement)
     self.zigzag = evaluate.getEvaluatedBooleanDefault(
         True, 'zigzag', xmlElement)
Пример #32
0
def getGeometryOutput(xmlElement):
    "Get vector3 vertexes from attribute dictionary."
    start = evaluate.getVector3ByPrefix('start', Vector3(), xmlElement)
    end = evaluate.getVector3ByPrefix('end', Vector3(), xmlElement)
    endMinusStart = end - start
    endMinusStartLength = abs(endMinusStart)
    if endMinusStartLength <= 0.0:
        print(
            'Warning, end is the same as start in getGeometryOutput in line for:'
        )
        print(start)
        print(end)
        print(xmlElement)
        return None
    steps = evaluate.getEvaluatedFloatDefault(None, 'steps', xmlElement)
    step = evaluate.getEvaluatedFloatDefault(None, 'step', xmlElement)
    xmlElement.attributeDictionary['closed'] = str(
        evaluate.getEvaluatedBooleanDefault(False, 'closed', xmlElement))
    if step == None and steps == None:
        return lineation.getGeometryOutputByLoop(
            lineation.SideLoop([start, end]), xmlElement)
    loop = [start]
    if step != None and steps != None:
        stepVector = step / endMinusStartLength * endMinusStart
        end = start + stepVector * steps
        return getGeometryOutputByStep(end, loop, steps, stepVector,
                                       xmlElement)
    if step == None:
        stepVector = endMinusStart / steps
        return getGeometryOutputByStep(end, loop, steps, stepVector,
                                       xmlElement)
    typeString = evaluate.getEvaluatedStringDefault('minimum', 'type',
                                                    xmlElement)
    endMinusStartLengthOverStep = endMinusStartLength / step
    if typeString == 'average':
        steps = max(1.0, round(endMinusStartLengthOverStep))
        stepVector = step / endMinusStartLength * endMinusStart
        end = start + stepVector * steps
        return getGeometryOutputByStep(end, loop, steps, stepVector,
                                       xmlElement)
    if typeString == 'maximum':
        steps = math.ceil(endMinusStartLengthOverStep)
        if steps < 1.0:
            return lineation.getGeometryOutputByLoop(
                lineation.SideLoop([start, end]), xmlElement)
        stepVector = endMinusStart / steps
        return getGeometryOutputByStep(end, loop, steps, stepVector,
                                       xmlElement)
    if typeString == 'minimum':
        steps = math.floor(endMinusStartLengthOverStep)
        if steps < 1.0:
            return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop),
                                                     xmlElement)
        stepVector = endMinusStart / steps
        return getGeometryOutputByStep(end, loop, steps, stepVector,
                                       xmlElement)
    print(
        'Warning, the step type was not one of (average, maximum or minimum) in getGeometryOutput in line for:'
    )
    print(typeString)
    print(xmlElement)
    loop.append(end)
    return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop),
                                             xmlElement)
Пример #33
0
def getShouldReverse(xmlElement):
	"Determine if the loop should be reversed."
	return evaluate.getEvaluatedBooleanDefault(True, 'reverse', xmlElement)
Пример #34
0
def getShouldReverse(prefix, xmlElement):
    'Determine if the loop should be reversed.'
    return evaluate.getEvaluatedBooleanDefault(True, prefix + 'reverse',
                                               xmlElement)
Пример #35
0
	def getOriginalRoot(self):
		"Get the original reparsed root element."
		if evaluate.getEvaluatedBooleanDefault(True, 'getOriginalRoot', self.root):
			return XMLSimpleReader(self.fileName, self.parent, self.xmlText).root
		return None
Пример #36
0
def setClosedAttribute(revolutions, xmlElement):
	"Set the closed attribute of the xmlElement."
	xmlElement.attributeDictionary['closed'] = str(evaluate.getEvaluatedBooleanDefault(revolutions <= 1, 'closed', xmlElement)).lower()
Пример #37
0
def getShouldReverse(prefix, xmlElement):
	'Determine if the loop should be reversed.'
	return evaluate.getEvaluatedBooleanDefault(True, prefix + 'reverse', xmlElement)
Пример #38
0
def setClosedAttribute(revolutions, xmlElement):
    "Set the closed attribute of the xmlElement."
    xmlElement.attributeDictionary['closed'] = str(
        evaluate.getEvaluatedBooleanDefault(revolutions <= 1, 'closed',
                                            xmlElement)).lower()
Пример #39
0
def getShouldReverse(xmlElement):
    "Determine if the loop should be reversed."
    return evaluate.getEvaluatedBooleanDefault(True, 'reverse', xmlElement)