Package fabmetheus_utilities :: Package geometry :: Package solids :: Module group
[hide private]
[frames] | no frames]

Source Code for Module fabmetheus_utilities.geometry.solids.group

 1  """ 
 2  Boolean geometry group of solids. 
 3   
 4  """ 
 5   
 6  from fabmetheus_utilities.geometry.geometry_tools import dictionary 
 7  from fabmetheus_utilities.geometry.geometry_utilities import evaluate 
 8  from fabmetheus_utilities.geometry.geometry_utilities import matrix 
 9  from fabmetheus_utilities import euclidean 
10   
11   
12  __author__ = 'Enrique Perez (perez_enrique@yahoo.com)' 
13  __credits__ = 'Art of Illusion <http://www.artofillusion.org/>' 
14  __date__ = '$Date: 2008/02/05 $' 
15  __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' 
16   
17   
18 -def convertXMLElement(geometryOutput, xmlElement):
19 "Convert the xml element to a group xml element." 20 convertContainerXMLElement(geometryOutput, xmlElement, Group())
21
22 -def convertContainerXMLElement(geometryOutput, xmlElement, xmlObject):
23 "Convert the xml element to a group xml element." 24 xmlElement.linkObject(xmlObject) 25 matrix.getBranchMatrixSetXMLElement(xmlElement) 26 xmlElement.getXMLProcessor().createChildNodes(geometryOutput['shapes'], xmlElement)
27
28 -def processXMLElement(xmlElement):
29 "Process the xml element." 30 evaluate.processArchivable(Group, xmlElement)
31 32
33 -class Group(dictionary.Dictionary):
34 "A group."
35 - def __init__(self):
36 "Add empty lists." 37 dictionary.Dictionary.__init__(self) 38 self.matrix4X4 = matrix.Matrix()
39
40 - def addXMLInnerSection(self, depth, output):
41 "Add xml inner section for this object." 42 if self.matrix4X4 != None: 43 self.matrix4X4.addXML(depth, output) 44 self.addXMLSection(depth, output)
45
46 - def addXMLSection(self, depth, output):
47 "Add the xml section for this object." 48 pass
49
50 - def getLoops(self, importRadius, z):
51 "Get loops sliced through shape." 52 visibleObjects = evaluate.getVisibleObjects(self.archivableObjects) 53 loops = [] 54 for visibleObject in visibleObjects: 55 loops += visibleObject.getLoops(importRadius, z) 56 return loops
57
58 - def getMatrix4X4(self):
59 "Get the matrix4X4." 60 return self.matrix4X4
61
62 - def getMatrixChainTetragrid(self):
63 "Get the matrix chain tetragrid." 64 return matrix.getTetragridTimesOther(self.xmlElement.parentNode.xmlObject.getMatrixChainTetragrid(), self.matrix4X4.tetragrid)
65
66 - def getVisible(self):
67 "Get visible." 68 return euclidean.getBooleanFromDictionary(True, self.getAttributeDictionary(), 'visible')
69
70 - def setToXMLElement(self, xmlElement):
71 'Set to xmlElement.' 72 self.xmlElement = xmlElement 73 xmlElement.parentNode.xmlObject.archivableObjects.append(self) 74 matrix.getBranchMatrixSetXMLElement(xmlElement)
75