2 Boolean geometry group of solids.
6 from __future__ import absolute_import
7 #Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
10 from fabmetheus_utilities.geometry.geometry_tools import dictionary
11 from fabmetheus_utilities.geometry.geometry_utilities import evaluate
12 from fabmetheus_utilities.geometry.geometry_utilities import matrix
13 from fabmetheus_utilities import euclidean
16 __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
17 __credits__ = 'Art of Illusion <http://www.artofillusion.org/>'
18 __date__ = '$Date: 2008/02/05 $'
19 __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
22 def convertContainerElementNode(elementNode, geometryOutput, xmlObject):
23 "Convert the xml element to a group xml element."
24 elementNode.linkObject(xmlObject)
25 matrix.getBranchMatrixSetElementNode(elementNode)
26 elementNode.getXMLProcessor().createChildNodes(geometryOutput['shapes'], elementNode)
28 def convertElementNode(elementNode, geometryOutput):
29 "Convert the xml element to a group xml element."
30 convertContainerElementNode(elementNode, geometryOutput, Group())
32 def getNewDerivation(elementNode):
34 return evaluate.EmptyObject(elementNode)
36 def processElementNode(elementNode):
37 "Process the xml element."
38 evaluate.processArchivable(Group, elementNode)
41 class Group(dictionary.Dictionary):
45 dictionary.Dictionary.__init__(self)
46 self.matrix4X4 = matrix.Matrix()
48 def addXMLInnerSection(self, depth, output):
49 "Add xml inner section for this object."
50 if self.matrix4X4 != None:
51 self.matrix4X4.addXML(depth, output)
52 self.addXMLSection(depth, output)
54 def addXMLSection(self, depth, output):
55 "Add the xml section for this object."
58 def getLoops(self, importRadius, z):
59 "Get loops sliced through shape."
60 visibleObjects = evaluate.getVisibleObjects(self.archivableObjects)
62 for visibleObject in visibleObjects:
63 loops += visibleObject.getLoops(importRadius, z)
66 def getMatrix4X4(self):
70 def getMatrixChainTetragrid(self):
71 "Get the matrix chain tetragrid."
72 return matrix.getTetragridTimesOther(self.elementNode.parentNode.xmlObject.getMatrixChainTetragrid(), self.matrix4X4.tetragrid)
76 return euclidean.getBooleanFromDictionary(True, self.getAttributes(), 'visible')
78 def setToElementNode(self, elementNode):
80 self.elementNode = elementNode
81 elementNode.parentNode.xmlObject.archivableObjects.append(self)
82 matrix.getBranchMatrixSetElementNode(elementNode)