예제 #1
0
def processXMLElement(xmlElement, xmlProcessor):
    "Process the xml element."
    target = evaluate.getXMLElementByKey('target', xmlElement)
    if target == None:
        print('Warning, array could not get target for:')
        print(xmlElement)
        return
    vertices = getVerticesByKey('vertices', xmlElement)
    if len(vertices) == 0:
        print('Warning, array could not get vertices for:')
        print(xmlElement)
        return
    arrayDictionary = xmlElement.attributeDictionary.copy()
    targetMatrix4X4Copy = matrix4x4.Matrix4X4().getFromXMLElement(target)
    matrix4x4.setAttributeDictionaryToMatrix(target.attributeDictionary,
                                             targetMatrix4X4Copy)
    xmlElement.className = 'group'
    for vector3Index in xrange(len(vertices)):
        vector3 = vertices[vector3Index]
        vector3Matrix4X4 = matrix4x4.Matrix4X4(
            targetMatrix4X4Copy.matrixTetragrid)
        lastChild = target.getCopy(xmlElement.getIDSuffix(vector3Index),
                                   xmlElement)
        euclidean.overwriteDictionary(xmlElement.attributeDictionary, ['id'],
                                      ['visible'],
                                      lastChild.attributeDictionary)
        vertexElement = vertex.getUnboundVertexElement(vector3)
        matrix4x4.setXMLElementDictionaryToOtherElementDictionary(
            vertexElement, vector3Matrix4X4, lastChild)
    xmlProcessor.processXMLElement(xmlElement)
예제 #2
0
파일: _carve.py 프로젝트: hy19910/Cura
def getLinkedElementNode(idSuffix, parentNode, target):
    "Get elementNode with identifiers and parentNode."
    linkedElementNode = xml_simple_reader.ElementNode()
    euclidean.overwriteDictionary(target.attributes, ["id", "name", "quantity"], linkedElementNode.attributes)
    linkedElementNode.addSuffixToID(idSuffix)
    tagKeys = target.getTagKeys()
    tagKeys.append("carve")
    tagKeys.sort()
    tags = ", ".join(tagKeys)
    linkedElementNode.attributes["tags"] = tags
    linkedElementNode.setParentAddToChildNodes(parentNode)
    linkedElementNode.addToIdentifierDictionaries()
    return linkedElementNode
예제 #3
0
def getLinkedElementNode(idSuffix, parentNode, target):
	'Get elementNode with identifiers and parentNode.'
	linkedElementNode = xml_simple_reader.ElementNode()
	euclidean.overwriteDictionary(target.attributes, ['id', 'name', 'quantity'], linkedElementNode.attributes)
	linkedElementNode.addSuffixToID(idSuffix)
	tagKeys = target.getTagKeys()
	tagKeys.append('carve')
	tagKeys.sort()
	tags = ', '.join(tagKeys)
	linkedElementNode.attributes['tags'] = tags
	linkedElementNode.setParentAddToChildNodes(parentNode)
	linkedElementNode.addToIdentifierDictionaries()
	return linkedElementNode
예제 #4
0
def getLinkedXMLElement(idSuffix, parentNode, target):
	'Get xmlElement with identifiers, importName and parentNode.'
	linkedXMLElement = xml_simple_reader.XMLElement()
	linkedXMLElement.importName = parentNode.importName
	euclidean.overwriteDictionary(target.attributeDictionary, ['id', 'name', 'quantity'], linkedXMLElement.attributeDictionary)
	linkedXMLElement.addSuffixToID(idSuffix)
	tagKeys = target.getTagKeys()
	tagKeys.append('disjoin')
	tagKeys.sort()
	tags = ', '.join(tagKeys)
	linkedXMLElement.attributeDictionary['tags'] = tags
	linkedXMLElement.setParentAddToChildNodes(parentNode)
	linkedXMLElement.addToIdentifierDictionaryIFIdentifierExists()
	return linkedXMLElement
예제 #5
0
def processXMLElement(xmlElement):
	"Process the xml element."
	target = evaluate.getXMLElementByKey('target', xmlElement )
	if target == None:
		print('Warning, copy could not get target.')
		return
	translateDictionary = xmlElement.attributeDictionary.copy()
	targetMatrixCopy = matrix.getFromObjectOrXMLElement(target)
	xmlElement.attributeDictionary = target.attributeDictionary.copy()
	matrix.setAttributeDictionaryToMatrix( target.attributeDictionary, targetMatrixCopy )
	euclidean.overwriteDictionary( translateDictionary, [], ['visible'], xmlElement.attributeDictionary )
	xmlElement.className = target.className
	matrix.setXMLElementDictionaryToOtherElementDictionary( xmlElement, targetMatrixCopy, 'matrix.', xmlElement )
	target.copyXMLChildren( xmlElement.getIDSuffix(), xmlElement )
	xmlElement.getXMLProcessor().processXMLElement(xmlElement)
예제 #6
0
파일: disjoin.py 프로젝트: rkoeppl/SFACT
def getLinkedXMLElement(idSuffix, parent, target):
    """Get xmlElement with identifiers, importName and parent."""
    linkedXMLElement = xml_simple_reader.XMLElement()
    linkedXMLElement.importName = parent.importName
    euclidean.overwriteDictionary(
        target.attributeDictionary, ["id", "name", "quantity"], linkedXMLElement.attributeDictionary
    )
    linkedXMLElement.addSuffixToID(idSuffix)
    tagKeys = target.getTagKeys()
    tagKeys.append("disjoin")
    tagKeys.sort()
    tags = ", ".join(tagKeys)
    linkedXMLElement.attributeDictionary["tags"] = tags
    linkedXMLElement.setParentAddToChildren(parent)
    linkedXMLElement.addToIdentifierDictionaryIFIdentifierExists()
    return linkedXMLElement
예제 #7
0
파일: copy.py 프로젝트: folksjos/RepG
def processXMLElement(xmlElement):
    "Process the xml element."
    target = evaluate.getXMLElementByKey('target', xmlElement)
    if target == None:
        print('Warning, copy could not get target.')
        return
    translateDictionary = xmlElement.attributeDictionary.copy()
    targetMatrixCopy = matrix.getFromObjectOrXMLElement(target)
    xmlElement.attributeDictionary = target.attributeDictionary.copy()
    matrix.setAttributeDictionaryToMatrix(target.attributeDictionary,
                                          targetMatrixCopy)
    euclidean.overwriteDictionary(translateDictionary, [], ['visible'],
                                  xmlElement.attributeDictionary)
    xmlElement.className = target.className
    matrix.setXMLElementDictionaryToOtherElementDictionary(
        xmlElement, targetMatrixCopy, 'matrix.', xmlElement)
    target.copyXMLChildren(xmlElement.getIDSuffix(), xmlElement)
    xmlElement.getXMLProcessor().processXMLElement(xmlElement)
예제 #8
0
def processXMLElement(xmlElement):
	"Process the xml element."
	target = evaluate.getXMLElementByKey('target', xmlElement)
	if target == None:
		print('Warning, array could not get target for:')
		print(xmlElement)
		return
	vertexes = getVertexesByKey('vertexes', xmlElement)
	if len(vertexes) == 0:
		print('Warning, array could not get vertexes for:')
		print(xmlElement)
		return
	arrayDictionary = xmlElement.attributeDictionary.copy()
	targetMatrixCopy = matrix.getFromObjectOrXMLElement(target)
	matrix.setAttributeDictionaryToMatrix(target.attributeDictionary, targetMatrixCopy)
	xmlElement.className = 'group'
	for vector3Index in xrange(len(vertexes)):
		vector3 = vertexes[vector3Index]
		vector3Matrix = matrix.Matrix(targetMatrixCopy.tetragrid)
		lastChild = target.getCopy(xmlElement.getIDSuffix(vector3Index), xmlElement)
		euclidean.overwriteDictionary(xmlElement.attributeDictionary, ['id'], ['visible'], lastChild.attributeDictionary)
		vertexElement = vertex.getUnboundVertexElement(vector3)
		matrix.setXMLElementDictionaryToOtherElementDictionary(vertexElement, vector3Matrix, 'matrix.', lastChild)
	xmlElement.getXMLProcessor().processXMLElement(xmlElement)