Beispiel #1
0
def convertXMLElement(geometryOutput, xmlElement):
	'Convert the xml element to a TriangleMesh xml element.'
	xmlElement.linkObject(TriangleMesh())
	matrix.getBranchMatrixSetXMLElement(xmlElement)
	vertex.addGeometryList(geometryOutput['vertex'], xmlElement)
	face.addGeometryList(geometryOutput['face'], xmlElement)
	xmlElement.getXMLProcessor().processChildNodes(xmlElement)
Beispiel #2
0
def convertXMLElement(geometryOutput, xmlElement):
    'Convert the xml element to a TriangleMesh xml element.'
    xmlElement.linkObject(TriangleMesh())
    matrix.getBranchMatrixSetXMLElement(xmlElement)
    vertex.addGeometryList(geometryOutput['vertex'], xmlElement)
    face.addGeometryList(geometryOutput['face'], xmlElement)
    xmlElement.getXMLProcessor().processChildNodes(xmlElement)
Beispiel #3
0
def convertXMLElement(geometryOutput, xmlElement):
    "Convert the xml element to a TriangleMesh xml element."
    xmlElement.linkObject(TriangleMesh())
    matrix.getBranchMatrixSetXMLElement(xmlElement)
    vertex.addGeometryList(geometryOutput["vertex"], xmlElement)
    face.addGeometryList(geometryOutput["face"], xmlElement)
    xmlElement.getXMLProcessor().processChildren(xmlElement)
Beispiel #4
0
def processArchiveRemoveSolid(geometryOutput, xmlElement):
	'Process the target by the manipulationFunction.'
	solidMatchingPlugins = getSolidMatchingPlugins(xmlElement)
	if len(solidMatchingPlugins) < 1:
		xmlElement.parent.xmlObject.archivableObjects.append(xmlElement.xmlObject)
		return
	processXMLElementByGeometry(getGeometryOutputByManipulation(geometryOutput, xmlElement), xmlElement)
	xmlElement.removeFromIDNameParent()
	matrix.getBranchMatrixSetXMLElement(xmlElement)
Beispiel #5
0
def processXMLElementByDerivation(derivation, xmlElement):
	'Process the xml element by derivation.'
	if derivation == None:
		derivation = DisjoinDerivation(xmlElement)
	targetXMLElement = derivation.targetXMLElement
	if targetXMLElement == None:
		print('Warning, disjoin could not get target for:')
		print(xmlElement)
		return
	xmlObject = targetXMLElement.xmlObject
	if xmlObject == None:
		print('Warning, processXMLElementByDerivation in disjoin could not get xmlObject for:')
		print(targetXMLElement)
		print(derivation.xmlElement)
		return
	transformedVertexes = xmlObject.getTransformedVertexes()
	if len(transformedVertexes) < 1:
		print('Warning, transformedVertexes is zero in processXMLElementByDerivation in disjoin for:')
		print(xmlObject)
		print(targetXMLElement)
		print(derivation.xmlElement)
		return
	xmlElement.localName = 'group'
	xmlElement.getXMLProcessor().processXMLElement(xmlElement)
	matrix.getBranchMatrixSetXMLElement(targetXMLElement)
	targetChainMatrix = matrix.Matrix(xmlObject.getMatrixChainTetragrid())
	minimumZ = boolean_geometry.getMinimumZ(xmlObject)
	z = minimumZ + 0.5 * derivation.sheetThickness
	zoneArrangement = triangle_mesh.ZoneArrangement(derivation.layerThickness, transformedVertexes)
	oldVisibleString = targetXMLElement.attributeDictionary['visible']
	targetXMLElement.attributeDictionary['visible'] = True
	loops = boolean_geometry.getEmptyZLoops([xmlObject], derivation.importRadius, False, z, zoneArrangement)
	targetXMLElement.attributeDictionary['visible'] = oldVisibleString
	vector3Loops = euclidean.getVector3Paths(loops, z)
	pathElement = getLinkedXMLElement('_sheet', xmlElement, targetXMLElement)
	path.convertXMLElement(vector3Loops, pathElement)
	targetOutput = xmlObject.getGeometryOutput()
	differenceElement = getLinkedXMLElement('_solid', xmlElement, targetXMLElement)
	targetElementCopy = targetXMLElement.getCopy('_positive', differenceElement)
	targetElementCopy.attributeDictionary['visible'] = True
	targetElementCopy.attributeDictionary.update(targetChainMatrix.getAttributeDictionary('matrix.'))
	complexMaximum = euclidean.getMaximumByVector3Path(transformedVertexes).dropAxis()
	complexMinimum = euclidean.getMinimumByVector3Path(transformedVertexes).dropAxis()
	centerComplex = 0.5 * (complexMaximum + complexMinimum)
	centerVector3 = Vector3(centerComplex.real, centerComplex.imag, minimumZ)
	slightlyMoreThanHalfExtent = 0.501 * (complexMaximum - complexMinimum)
	inradius = Vector3(slightlyMoreThanHalfExtent.real, slightlyMoreThanHalfExtent.imag, derivation.sheetThickness)
	cubeElement = xml_simple_reader.XMLElement()
	cubeElement.attributeDictionary['inradius'] = str(inradius)
	if not centerVector3.getIsDefault():
		cubeElement.attributeDictionary['translate.'] = str(centerVector3)
	cubeElement.localName = 'cube'
	cubeElement.importName = differenceElement.importName
	cubeElement.setParentAddToChildNodes(differenceElement)
	difference.processXMLElement(differenceElement)
Beispiel #6
0
def processXMLElementByDerivation(derivation, xmlElement):
    'Process the xml element by derivation.'
    if derivation == None:
        derivation = ArrayDerivation(xmlElement)
    if derivation.target == None:
        print('Warning, array could not get target for:')
        print(xmlElement)
        return
    if len(derivation.paths) < 1:
        print('Warning, array could not get paths for:')
        print(xmlElement)
        return
    groupDictionaryCopy = xmlElement.attributeDictionary.copy()
    euclidean.removeElementsFromDictionary(
        groupDictionaryCopy,
        ['closed', 'paths', 'target', 'track', 'vertexes'])
    evaluate.removeIdentifiersFromDictionary(groupDictionaryCopy)
    targetMatrix = matrix.getBranchMatrixSetXMLElement(derivation.target)
    xmlElement.className = 'group'
    totalIndex = 0
    for path in derivation.paths:
        addPathToGroup(derivation, groupDictionaryCopy, path, targetMatrix,
                       totalIndex)
    xmlElement.getXMLProcessor().processXMLElement(xmlElement)
    return
Beispiel #7
0
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
	"""Get flipped paths."""
	if len(loop) < 1:
		return [[]]
	derivation = BottomDerivation(prefix, xmlElement)
	targetMatrix = matrix.getBranchMatrixSetXMLElement(xmlElement)
	transformedLoop = matrix.getTransformedVector3s(matrix.getIdentityTetragrid(targetMatrix.tetragrid), loop)
	lift = derivation.altitude + derivation.getAdditionalPathLift() - euclidean.getBottomByPath(transformedLoop)
	for point in loop:
		point.z += lift
	return [loop]
Beispiel #8
0
 def getCopy(self, idSuffix, parentNode):
     'Copy the xml element, set its dictionary and add it to the parentNode.'
     matrix4X4 = matrix.getBranchMatrixSetXMLElement(self)
     attributeDictionaryCopy = self.attributeDictionary.copy()
     attributeDictionaryCopy.update(matrix4X4.getAttributeDictionary('matrix.'))
     copy = self.getCopyShallow(attributeDictionaryCopy)
     copy.setParentAddToChildNodes(parentNode)
     copy.addSuffixToID(idSuffix)
     copy.text = self.text
     copy.addToIdentifierDictionaryIFIdentifierExists()
     self.copyXMLChildNodes(idSuffix, copy)
     return copy
Beispiel #9
0
	def getCopy(self, idSuffix, parentNode):
		'Copy the xml element, set its dictionary and add it to the parentNode.'
		matrix4X4 = matrix.getBranchMatrixSetXMLElement(self)
		attributeDictionaryCopy = self.attributeDictionary.copy()
		attributeDictionaryCopy.update(matrix4X4.getAttributeDictionary('matrix.'))
		copy = self.getCopyShallow(attributeDictionaryCopy)
		copy.setParentAddToChildNodes(parentNode)
		copy.addSuffixToID(idSuffix)
		copy.text = self.text
		copy.addToIdentifierDictionaryIFIdentifierExists()
		self.copyXMLChildNodes(idSuffix, copy)
		return copy
Beispiel #10
0
def processXMLElementByDerivation(derivation, xmlElement):
	"""Process the xml element by derivation."""
	if derivation is None:
		derivation = CopyDerivation(xmlElement)
	if derivation.target is None:
		print('Warning, copy could not get target for:')
		print(xmlElement)
		return
	del xmlElement.attributeDictionary['target']
	copyMatrix = matrix.getBranchMatrixSetXMLElement(xmlElement)
	targetMatrix = matrix.getBranchMatrixSetXMLElement(derivation.target)
	targetDictionaryCopy = derivation.target.attributeDictionary.copy()
	evaluate.removeIdentifiersFromDictionary(targetDictionaryCopy)
	targetDictionaryCopy.update(xmlElement.attributeDictionary)
	xmlElement.attributeDictionary = targetDictionaryCopy
	euclidean.removeTrueFromDictionary(xmlElement.attributeDictionary, 'visible')
	xmlElement.className = derivation.target.className
	derivation.target.copyXMLChildren(xmlElement.getIDSuffix(), xmlElement)
	xmlElement.getXMLProcessor().processXMLElement(xmlElement)
	if copyMatrix is not None and targetMatrix is not None:
		xmlElement.xmlObject.matrix4X4 = copyMatrix.getSelfTimesOther(targetMatrix.tetragrid)
Beispiel #11
0
def processXMLElementByDerivation(derivation, xmlElement):
	'Process the xml element by derivation.'
	if derivation == None:
		derivation = CopyDerivation(xmlElement)
	if derivation.target == None:
		print('Warning, copy could not get target for:')
		print(xmlElement)
		return
	del xmlElement.attributeDictionary['target']
	copyMatrix = matrix.getBranchMatrixSetXMLElement(xmlElement)
	targetMatrix = matrix.getBranchMatrixSetXMLElement(derivation.target)
	targetDictionaryCopy = derivation.target.attributeDictionary.copy()
	evaluate.removeIdentifiersFromDictionary(targetDictionaryCopy)
	targetDictionaryCopy.update(xmlElement.attributeDictionary)
	xmlElement.attributeDictionary = targetDictionaryCopy
	euclidean.removeTrueFromDictionary(xmlElement.attributeDictionary, 'visible')
	xmlElement.localName = derivation.target.localName
	derivation.target.copyXMLChildNodes(xmlElement.getIDSuffix(), xmlElement)
	xmlElement.getXMLProcessor().processXMLElement(xmlElement)
	if copyMatrix != None and targetMatrix != None:
		xmlElement.xmlObject.matrix4X4 = copyMatrix.getSelfTimesOther(targetMatrix.tetragrid)
Beispiel #12
0
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
    'Get flipped paths.'
    if len(loop) < 1:
        return [[]]
    derivation = BottomDerivation(prefix, xmlElement)
    targetMatrix = matrix.getBranchMatrixSetXMLElement(xmlElement)
    transformedLoop = matrix.getTransformedVector3s(
        matrix.getIdentityTetragrid(targetMatrix.tetragrid), loop)
    lift = derivation.altitude + derivation.getAdditionalPathLift(
    ) - euclidean.getBottomByPath(transformedLoop)
    for point in loop:
        point.z += lift
    return [loop]
Beispiel #13
0
def getManipulatedGeometryOutput(geometryOutput, prefix, xmlElement):
	"""Get bottomed geometryOutput."""
	derivation = BottomDerivation(prefix, xmlElement)
	copyShallow = xmlElement.getCopyShallow()
	solid.processXMLElementByGeometry(geometryOutput, copyShallow)
	targetMatrix = matrix.getBranchMatrixSetXMLElement(xmlElement)
	matrix.setXMLElementDictionaryMatrix(targetMatrix, copyShallow)
	minimumZ = boolean_geometry.getMinimumZ(copyShallow.xmlObject)
	copyShallow.parent.xmlObject.archivableObjects.remove(copyShallow.xmlObject)
	lift = derivation.altitude - minimumZ
	vertexes = matrix.getVertexes(geometryOutput)
	for vertex in vertexes:
		vertex.z += lift
	return geometryOutput
Beispiel #14
0
def getManipulatedGeometryOutput(geometryOutput, prefix, xmlElement):
    'Get bottomed geometryOutput.'
    derivation = BottomDerivation(prefix, xmlElement)
    copyShallow = xmlElement.getCopyShallow()
    solid.processXMLElementByGeometry(geometryOutput, copyShallow)
    targetMatrix = matrix.getBranchMatrixSetXMLElement(xmlElement)
    matrix.setXMLElementDictionaryMatrix(targetMatrix, copyShallow)
    minimumZ = boolean_geometry.getMinimumZ(copyShallow.xmlObject)
    copyShallow.parent.xmlObject.archivableObjects.remove(
        copyShallow.xmlObject)
    lift = derivation.altitude - minimumZ
    vertexes = matrix.getVertexes(geometryOutput)
    for vertex in vertexes:
        vertex.z += lift
    return geometryOutput
Beispiel #15
0
def bottomXMLElement(derivation, target):
	"""Bottom target."""
	xmlObject = target.xmlObject
	if xmlObject is None:
		print('Warning, bottomTarget in bottom could not get xmlObject for:')
		print(target)
		print(derivation.xmlElement)
		return
	targetMatrix = matrix.getBranchMatrixSetXMLElement(target)
	lift = derivation.altitude
	transformedPaths = xmlObject.getTransformedPaths()
	if len(transformedPaths) > 0:
		lift += derivation.getAdditionalPathLift() - euclidean.getBottomByPaths(transformedPaths)
	else:
		lift -= boolean_geometry.getMinimumZ(xmlObject)
	targetMatrix.tetragrid = matrix.getIdentityTetragrid(targetMatrix.tetragrid)
	targetMatrix.tetragrid[2][3] += lift
	matrix.setXMLElementDictionaryMatrix(targetMatrix, target)
Beispiel #16
0
def bottomXMLElement(derivation, target):
    "Bottom target."
    xmlObject = target.xmlObject
    if xmlObject == None:
        print('Warning, bottomTarget in bottom could not get xmlObject for:')
        print(target)
        print(derivation.xmlElement)
        return
    targetMatrix = matrix.getBranchMatrixSetXMLElement(target)
    lift = derivation.altitude
    transformedPaths = xmlObject.getTransformedPaths()
    if len(transformedPaths) > 0:
        lift += derivation.getAdditionalPathLift(
        ) - euclidean.getBottomByPaths(transformedPaths)
    else:
        lift -= boolean_geometry.getMinimumZ(xmlObject)
    targetMatrix.tetragrid = matrix.getIdentityTetragrid(
        targetMatrix.tetragrid)
    targetMatrix.tetragrid[2][3] += lift
    matrix.setXMLElementDictionaryMatrix(targetMatrix, target)
Beispiel #17
0
def processXMLElementByDerivation(derivation, xmlElement):
	"""Process the xml element by derivation."""
	if derivation is None:
		derivation = ArrayDerivation(xmlElement)
	if derivation.target is None:
		print('Warning, array could not get target for:')
		print(xmlElement)
		return
	if len(derivation.paths) < 1:
		print('Warning, array could not get paths for:')
		print(xmlElement)
		return
	groupDictionaryCopy = xmlElement.attributeDictionary.copy()
	euclidean.removeElementsFromDictionary(groupDictionaryCopy, ['closed', 'paths', 'target', 'track', 'vertexes'])
	evaluate.removeIdentifiersFromDictionary(groupDictionaryCopy)
	targetMatrix = matrix.getBranchMatrixSetXMLElement(derivation.target)
	xmlElement.className = 'group'
	totalIndex = 0
	for path in derivation.paths:
		addPathToGroup(derivation, groupDictionaryCopy, path, targetMatrix, totalIndex)
	xmlElement.getXMLProcessor().processXMLElement(xmlElement)
	return
Beispiel #18
0
def convertContainerXMLElement(geometryOutput, xmlElement, xmlObject):
	"Convert the xml element to a group xml element."
	xmlElement.linkObject(xmlObject)
	matrix.getBranchMatrixSetXMLElement(xmlElement)
	xmlElement.getXMLProcessor().createChildren(geometryOutput['shapes'], xmlElement)
Beispiel #19
0
def convertContainerXMLElement(geometryOutput, xmlElement, xmlObject):
	"""Convert the xml element to a group xml element."""
	xmlElement.linkObject(xmlObject)
	matrix.getBranchMatrixSetXMLElement(xmlElement)
	xmlElement.getXMLProcessor().createChildren(geometryOutput['shapes'], xmlElement)
Beispiel #20
0
	def setToXMLElement(self, xmlElement):
		"""Set to xmlElement."""
		self.xmlElement = xmlElement
		xmlElement.parent.xmlObject.archivableObjects.append(self)
		matrix.getBranchMatrixSetXMLElement(xmlElement)
Beispiel #21
0
	def setToXMLElement(self, xmlElement):
		'Set to xmlElement.'
		self.xmlElement = xmlElement
		xmlElement.parent.xmlObject.archivableObjects.append(self)
		matrix.getBranchMatrixSetXMLElement(xmlElement)