示例#1
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)
    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)
示例#2
0
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)
示例#3
0
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)
示例#4
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)
示例#5
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)
示例#6
0
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 )
示例#7
0
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)
示例#8
0
def processXMLElement(xmlElement):
	"Process the xml element."
	group.processShape( Union, xmlElement)
示例#9
0
文件: sphere.py 项目: folksjos/RepG
def processXMLElement(xmlElement):
    "Process the xml element."
    group.processShape(Sphere, xmlElement)
示例#10
0
def processXMLElement(xmlElement):
    "Process the xml element."
    group.processShape(Difference, xmlElement)
示例#11
0
def processXMLElement(xmlElement):
	"Process the xml element."
	group.processShape(Difference, xmlElement)
示例#12
0
def processXMLElement( xmlElement, xmlProcessor ):
	"Process the xml element."
	group.processShape( TriangleMesh, xmlElement, xmlProcessor )
示例#13
0
def processXMLElement(xmlElement):
	'Process the xml element.'
	group.processShape( Cylinder, xmlElement)
示例#14
0
def processXMLElement(xmlElement):
	'Process the xml element.'
	group.processShape( TriangleMesh, xmlElement)
示例#15
0
def processXMLElement( xmlElement, xmlProcessor ):
	"Process the xml element."
	group.processShape( Sphere, xmlElement, xmlProcessor )
示例#16
0
def processXMLElement(xmlElement, xmlProcessor):
    "Process the xml element."
    group.processShape(TriangleMesh, xmlElement, xmlProcessor)
示例#17
0
def processXMLElement(xmlElement, xmlProcessor):
    "Process the xml element."
    group.processShape(Cube, xmlElement, xmlProcessor)
示例#18
0
def processXMLElement(xmlElement):
	"Process the xml element."
	group.processShape( Cylinder, xmlElement)
示例#19
0
def processXMLElement(xmlElement):
	'Process the xml element.'
	group.processShape(Sphere, xmlElement)
示例#20
0
def processXMLElement(xmlElement):
    "Process the xml element."
    group.processShape(Intersection, xmlElement)
示例#21
0
def processXMLElement(xmlElement):
	"Process the xml element."
	group.processShape( Intersection, xmlElement)
示例#22
0
def processXMLElement(xmlElement, xmlProcessor):
    "Process the xml element."
    group.processShape(Cylinder, xmlElement, xmlProcessor)