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) xmlText = '' if fileName.endswith('.xml'): xmlText = archive.getFileText(absoluteFileName) else: xmlText = getXMLFromCarvingFileName(absoluteFileName) if xmlText == '': print( 'The file %s could not be found in the folder which the fabmetheus xml file is in.' % fileName) return if '_importname' in xmlElement.attributeDictionary: xmlElement.importName = xmlElement.attributeDictionary['_importname'] else: xmlElement.importName = archive.getUntilDot(fileName) xmlElement.attributeDictionary['_importname'] = xmlElement.importName XMLSimpleReader(parserFileName, xmlElement, xmlText) originalChildren = xmlElement.children[:] xmlElement.children = [] for child in originalChildren: for subchild in child.children: subchild.setParentAddToChildren(xmlElement) for attributeDictionaryKey in child.attributeDictionary.keys(): if attributeDictionaryKey != 'version': xmlElement.attributeDictionary[ attributeDictionaryKey] = child.attributeDictionary[ attributeDictionaryKey] group.processShape(group.Group, xmlElement)
def processXMLElement(xmlElement): "Process the xml element." fileName = evaluate.getEvaluatedValue("file", xmlElement) if fileName == None: return parserFileName = xmlElement.getRoot().parser.fileName absoluteFileName = gcodec.getAbsoluteFolderPath(parserFileName, fileName) xmlText = "" if fileName.endswith(".xml"): xmlText = gcodec.getFileText(absoluteFileName) else: xmlText = getXMLFromCarvingFileName(absoluteFileName) if xmlText == "": print("The file %s could not be found in the folder which the fabmetheus xml file is in." % fileName) return if "_importname" in xmlElement.attributeDictionary: xmlElement.importName = xmlElement.attributeDictionary["_importname"] else: xmlElement.importName = gcodec.getUntilDot(fileName) xmlElement.attributeDictionary["_importname"] = xmlElement.importName XMLSimpleReader(parserFileName, xmlElement, xmlText) originalChildren = xmlElement.children[:] xmlElement.children = [] for child in originalChildren: for subchild in child.children: subchild.setParentAddToChildren(xmlElement) for attributeDictionaryKey in child.attributeDictionary.keys(): if attributeDictionaryKey != "version": xmlElement.attributeDictionary[attributeDictionaryKey] = child.attributeDictionary[ attributeDictionaryKey ] group.processShape(group.Group, xmlElement)
def processXMLElement( xmlElement, xmlProcessor ): "Process the xml element." fileName = evaluate.getEvaluatedValue('file', xmlElement ) if fileName == None: return parserFileName = xmlElement.getRoot().parser.fileName absoluteFileName = gcodec.getAbsoluteFolderPath( parserFileName, fileName ) xmlText = '' if fileName.endswith('.xml'): xmlText = gcodec.getFileText( absoluteFileName ) else: xmlText = getXMLFromCarvingFileName( absoluteFileName ) if xmlText == '': print('The file %s could not be found in the folder which the fabmetheus xml file is in.' % fileName ) return if '_importname' in xmlElement.attributeDictionary: xmlElement.importName = xmlElement.attributeDictionary['_importname'] else: xmlElement.importName = gcodec.getUntilDot( fileName ) xmlElement.attributeDictionary['_importname'] = xmlElement.importName XMLSimpleReader( parserFileName, xmlElement, xmlText ) originalChildren = xmlElement.children[ : ] xmlElement.children = [] for child in originalChildren: for subchild in child.children: subchild.setParentAddToChildren(xmlElement) for attributeDictionaryKey in child.attributeDictionary.keys(): if attributeDictionaryKey != 'version': xmlElement.attributeDictionary[ attributeDictionaryKey ] = child.attributeDictionary[ attributeDictionaryKey ] group.processShape( group.Group, xmlElement, xmlProcessor ) root = xmlElement.getRoot() root.idDictionary[ xmlElement.importName ] = evaluate.ElementID(xmlElement) root.nameDictionary[ xmlElement.importName ] = evaluate.ElementName(xmlElement)
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)
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)
def processXMLElement( xmlElement, xmlProcessor ): "Process the xml element." fileName = evaluate.getEvaluatedValue( 'file', xmlElement ) if fileName == None: return parserFileName = xmlElement.getRoot().parser.fileName absoluteFileName = gcodec.getAbsoluteFolderPath( parserFileName, fileName ) xmlText = getXMLFromFileName( absoluteFileName ) if xmlText == '': print( 'The file %s could not be found in the folder which the fabmetheus xml file is in.' % fileName ) return if '_importname' in xmlElement.attributeDictionary: xmlElement.importName = xmlElement.attributeDictionary[ '_importname' ] else: xmlElement.importName = gcodec.getUntilDot( fileName ) xmlElement.attributeDictionary[ '_importname' ] = xmlElement.importName XMLSimpleParser( parserFileName, xmlElement, xmlText ) group.processShape( group.Group, xmlElement, xmlProcessor ) root = xmlElement.getRoot() root.idDictionary[ xmlElement.importName ] = evaluate.ElementID( xmlElement ) root.nameDictionary[ xmlElement.importName ] = evaluate.ElementName( xmlElement )
def processXMLElement(xmlElement, xmlProcessor): "Process the xml element." fileName = evaluate.getEvaluatedValue('file', xmlElement) if fileName == None: return parserFileName = xmlElement.getRoot().parser.fileName absoluteFileName = gcodec.getAbsoluteFolderPath(parserFileName, fileName) xmlText = getXMLFromFileName(absoluteFileName) if xmlText == '': print( 'The file %s could not be found in the folder which the fabmetheus xml file is in.' % fileName) return if '_importname' in xmlElement.attributeDictionary: xmlElement.importName = xmlElement.attributeDictionary['_importname'] else: xmlElement.importName = gcodec.getUntilDot(fileName) xmlElement.attributeDictionary['_importname'] = xmlElement.importName XMLSimpleParser(parserFileName, xmlElement, xmlText) group.processShape(group.Group, xmlElement, xmlProcessor) root = xmlElement.getRoot() root.idDictionary[xmlElement.importName] = evaluate.ElementID(xmlElement) root.nameDictionary[xmlElement.importName] = evaluate.ElementName( xmlElement)
def processXMLElement(xmlElement): "Process the xml element." group.processShape( Union, xmlElement)
def processXMLElement(xmlElement): "Process the xml element." group.processShape(Sphere, xmlElement)
def processXMLElement(xmlElement): "Process the xml element." group.processShape(Difference, xmlElement)
def processXMLElement( xmlElement, xmlProcessor ): "Process the xml element." group.processShape( TriangleMesh, xmlElement, xmlProcessor )
def processXMLElement(xmlElement): 'Process the xml element.' group.processShape( Cylinder, xmlElement)
def processXMLElement(xmlElement): 'Process the xml element.' group.processShape( TriangleMesh, xmlElement)
def processXMLElement( xmlElement, xmlProcessor ): "Process the xml element." group.processShape( Sphere, xmlElement, xmlProcessor )
def processXMLElement(xmlElement, xmlProcessor): "Process the xml element." group.processShape(TriangleMesh, xmlElement, xmlProcessor)
def processXMLElement(xmlElement, xmlProcessor): "Process the xml element." group.processShape(Cube, xmlElement, xmlProcessor)
def processXMLElement(xmlElement): "Process the xml element." group.processShape( Cylinder, xmlElement)
def processXMLElement(xmlElement): 'Process the xml element.' group.processShape(Sphere, xmlElement)
def processXMLElement(xmlElement): "Process the xml element." group.processShape(Intersection, xmlElement)
def processXMLElement(xmlElement): "Process the xml element." group.processShape( Intersection, xmlElement)
def processXMLElement(xmlElement, xmlProcessor): "Process the xml element." group.processShape(Cylinder, xmlElement, xmlProcessor)