示例#1
0
def processXMLElementByDerivation(derivation, xmlElement):
    'Process the xml element by derivation.'
    if derivation == None:
        derivation = ImportDerivation(xmlElement)
    if derivation.fileName == None:
        return
    parserFileName = xmlElement.getParser().fileName
    absoluteFileName = archive.getAbsoluteFolderPath(parserFileName,
                                                     derivation.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 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 derivation.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.' %
            derivation.fileName)
        return
    if derivation.importName == None:
        xmlElement.importName = archive.getUntilDot(derivation.fileName)
        if derivation.basename:
            xmlElement.importName = os.path.basename(xmlElement.importName)
        xmlElement.attributeDictionary['_importName'] = xmlElement.importName
    else:
        xmlElement.importName = derivation.importName
    importXMLElement = xml_simple_reader.XMLElement()
    xml_simple_reader.XMLSimpleReader(parserFileName, importXMLElement,
                                      xmlText)
    for child in importXMLElement.children:
        child.copyXMLChildren('', xmlElement)
        evaluate.removeIdentifiersFromDictionary(child.attributeDictionary)
        xmlElement.attributeDictionary.update(child.attributeDictionary)
        if derivation.overwriteRoot:
            xmlElement.getRoot().attributeDictionary.update(
                child.attributeDictionary)
    xmlElement.className = 'group'
    evaluate.processArchivable(group.Group, xmlElement)
示例#2
0
文件: import.py 项目: rkoeppl/SFACT
def processXMLElementByDerivation(derivation, xmlElement):
    """Process the xml element by derivation."""
    if derivation is None:
        derivation = ImportDerivation(xmlElement)
    if derivation.fileName is None:
        return
    parserFileName = xmlElement.getParser().fileName
    absoluteFileName = archive.getAbsoluteFolderPath(parserFileName,
                                                     derivation.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 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 derivation.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.'
              % derivation.fileName)
        return
    if derivation.importName is None:
        xmlElement.importName = archive.getUntilDot(derivation.fileName)
        if derivation.basename:
            xmlElement.importName = os.path.basename(xmlElement.importName)
        xmlElement.attributeDictionary['_importName'] = xmlElement.importName
    else:
        xmlElement.importName = derivation.importName
    importXMLElement = xml_simple_reader.XMLElement()
    xml_simple_reader.XMLSimpleReader(parserFileName, importXMLElement,
                                      xmlText)
    for child in importXMLElement.children:
        child.copyXMLChildren('', xmlElement)
        evaluate.removeIdentifiersFromDictionary(child.attributeDictionary)
        xmlElement.attributeDictionary.update(child.attributeDictionary)
        if derivation.overwriteRoot:
            xmlElement.getRoot().attributeDictionary.update(
                child.attributeDictionary)
    xmlElement.className = 'group'
    evaluate.processArchivable(group.Group, xmlElement)
示例#3
0
def processElementNodeByDerivation(derivation, elementNode):
    'Process the xml element by derivation.'
    if derivation == None:
        derivation = ImportDerivation(elementNode)
    if derivation.fileName == None:
        return
    parserFileName = elementNode.getOwnerDocument().fileName
    absoluteFileName = archive.getAbsoluteFolderPath(parserFileName,
                                                     derivation.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(elementNode)
        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 derivation.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 processElementNode in import.' %
            derivation.fileName)
        return
    if derivation.importName == None:
        elementNode.attributes['_importName'] = archive.getUntilDot(
            derivation.fileName)
        if derivation.basename:
            elementNode.attributes['_importName'] = os.path.basename(
                elementNode.attributes['_importName'])
    xml_simple_reader.createAppendByText(elementNode, xmlText)
    if derivation.appendDocumentElement:
        appendAttributes(elementNode, elementNode.getDocumentElement())
    if derivation.appendElement:
        appendAttributes(elementNode, elementNode)
    elementNode.localName = 'group'
    evaluate.processArchivable(group.Group, elementNode)
示例#4
0
def processElementNodeByDerivation(derivation, elementNode):
    "Process the xml element by derivation."
    if derivation == None:
        derivation = ImportDerivation(elementNode)
    if derivation.fileName == None:
        return
    parserFileName = elementNode.getOwnerDocument().fileName
    absoluteFileName = archive.getAbsoluteFolderPath(parserFileName, derivation.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(elementNode)
        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 derivation.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 processElementNode in import." % derivation.fileName)
        return
    if derivation.importName == None:
        elementNode.attributes["_importName"] = archive.getUntilDot(derivation.fileName)
        if derivation.basename:
            elementNode.attributes["_importName"] = os.path.basename(elementNode.attributes["_importName"])
    xml_simple_reader.createAppendByText(elementNode, xmlText)
    if derivation.appendDocumentElement:
        appendAttributes(elementNode, elementNode.getDocumentElement())
    if derivation.appendElement:
        appendAttributes(elementNode, elementNode)
    elementNode.localName = "group"
    evaluate.processArchivable(group.Group, elementNode)
示例#5
0
文件: cylinder.py 项目: 3DNogi/SFACT
def processElementNode(elementNode):
	'Process the xml element.'
	evaluate.processArchivable(Cylinder, elementNode)
示例#6
0
def processXMLElement(xmlElement):
	"Process the xml element."
	evaluate.processArchivable(Path, xmlElement)
示例#7
0
def processElementNode(elementNode):
    "Process the xml element."
    evaluate.processArchivable(Intersection, elementNode)
示例#8
0
def processXMLElement(xmlElement):
	"Process the xml element."
	evaluate.processArchivable(Difference, xmlElement)
示例#9
0
def processElementNode(elementNode):
	'Process the xml element.'
	evaluate.processArchivable(Cube, elementNode)
示例#10
0
def processElementNode(elementNode):
	'Process the xml element.'
	evaluate.processArchivable(TriangleMesh, elementNode)
示例#11
0
文件: group.py 项目: 3DNogi/SFACT
def processElementNode(elementNode):
	"Process the xml element."
	evaluate.processArchivable(Group, elementNode)
示例#12
0
def processElementNode(elementNode):
    "Process the xml element."
    evaluate.processArchivable(Difference, elementNode)
示例#13
0
def processXMLElement(xmlElement):
	"""Process the xml element."""
	evaluate.processArchivable(Intersection, xmlElement)
示例#14
0
def processXMLElement(xmlElement, xmlProcessor):
    "Process the xml element."
    evaluate.processArchivable(Path, xmlElement, xmlProcessor)
示例#15
0
def processElementNode(elementNode):
    'Process the xml element.'
    evaluate.processArchivable(Dictionary, elementNode)
示例#16
0
def processXMLElement(xmlElement):
	'Process the xml element.'
	evaluate.processArchivable(Cylinder, xmlElement)
示例#17
0
def processElementNode(elementNode):
	'Process the xml element.'
	evaluate.processArchivable(TriangleMesh, elementNode)
示例#18
0
def processElementNode(elementNode):
	'Process the xml element.'
	evaluate.processArchivable( Dictionary, elementNode)
示例#19
0
def processXMLElement(xmlElement):
    'Process the xml element.'
    evaluate.processArchivable(TriangleMesh, xmlElement)
示例#20
0
def processElementNode(elementNode):
    "Process the xml element."
    evaluate.processArchivable(group.Group, elementNode)
示例#21
0
def processXMLElement(xmlElement):
    "Process the xml element."
    evaluate.processArchivable(_Comment, xmlElement)
示例#22
0
def processElementNode(elementNode):
	"Process the xml element."
	evaluate.processArchivable(Difference, elementNode)
示例#23
0
def processXMLElement(xmlElement):
	'Process the xml element.'
	evaluate.processArchivable(Sphere, xmlElement)
示例#24
0
def processXMLElement(xmlElement):
    'Process the xml element.'
    evaluate.processArchivable( Dictionary, xmlElement)
示例#25
0
def processElementNode(elementNode):
	"Process the xml element."
	evaluate.processArchivable(Intersection, elementNode)
示例#26
0
文件: cube.py 项目: Sciumo/SFACT
def processXMLElement(xmlElement):
	"""Process the xml element."""
	evaluate.processArchivable(Cube, xmlElement)
示例#27
0
def processXMLElement(xmlElement):
    "Process the xml element."
    evaluate.processArchivable(TriangleMesh, xmlElement)
示例#28
0
def processXMLElement(xmlElement, xmlProcessor):
    "Process the xml element."
    evaluate.processArchivable(Dictionary, xmlElement, xmlProcessor)
示例#29
0
def processXMLElement(xmlElement):
	"Process the xml element."
	evaluate.processArchivable( Dictionary, xmlElement)
示例#30
0
def processXMLElement(xmlElement):
    'Process the xml element.'
    evaluate.processArchivable(Path, xmlElement)
示例#31
0
def processXMLElement(xmlElement):
    "Process the xml element."
    evaluate.processArchivable(Intersection, xmlElement)
示例#32
0
文件: path.py 项目: Aeva/SFACT
def processElementNode(elementNode):
	'Process the xml element.'
	evaluate.processArchivable(Path, elementNode)
示例#33
0
def processXMLElement( xmlElement, xmlProcessor ):
	"Process the xml element."
	evaluate.processArchivable( _Comment, xmlElement, xmlProcessor )