1 """
2 Boolean geometry dictionary object.
3
4 """
5
6 from fabmetheus_utilities.geometry.geometry_utilities import evaluate
7 from fabmetheus_utilities.geometry.geometry_utilities import matrix
8 from fabmetheus_utilities import euclidean
9 from fabmetheus_utilities import xml_simple_writer
10 import StringIO
11
12
13 __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
14 __credits__ = 'Nophead <http://hydraraptor.blogspot.com/>\nArt of Illusion <http://www.artofillusion.org/>'
15 __date__ = '$Date: 2008/21/04 $'
16 __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
17
18
20 'Get all paths.'
21 for archivableObject in xmlObject.archivableObjects:
22 paths += archivableObject.getPaths()
23 return paths
24
30
36
38 'Get all vertexes.'
39 for archivableObject in xmlObject.archivableObjects:
40 vertexes += archivableObject.getVertexes()
41 return vertexes
42
46
47
49 'A dictionary object.'
51 'Add empty lists.'
52 self.archivableObjects = []
53 self.xmlElement = None
54
60
61 - def addXML(self, depth, output):
62 'Add xml for this object.'
63 attributeCopy = {}
64 if self.xmlElement != None:
65 attributeCopy = evaluate.getEvaluatedDictionaryByCopyKeys(['paths', 'target', 'vertexes'], self.xmlElement)
66 euclidean.removeElementsFromDictionary(attributeCopy, matrix.getKeysM())
67 euclidean.removeTrueFromDictionary(attributeCopy, 'visible')
68 innerOutput = StringIO.StringIO()
69 self.addXMLInnerSection(depth + 1, innerOutput)
70 self.addXMLArchivableObjects(depth + 1, innerOutput)
71 xml_simple_writer.addBeginEndInnerXMLTag(attributeCopy, depth, innerOutput.getvalue(), self.getXMLLocalName(), output)
72
76
78 'Add xml section for this object.'
79 pass
80
82 'Create the shape.'
83 pass
84
86 'Get attribute table.'
87 if self.xmlElement == None:
88 return {}
89 return self.xmlElement.attributeDictionary
90
97
99 'Get fabrication extension.'
100 return 'xml'
101
102 - def getFabricationText(self, addLayerTemplate):
103 'Get fabrication text.'
104 return self.__repr__()
105
107 'Get geometry output dictionary.'
108 visibleObjects = evaluate.getVisibleObjects(self.archivableObjects)
109 shapeOutput = []
110 for visibleObject in visibleObjects:
111 visibleObjectOutput = visibleObject.getGeometryOutput()
112 if visibleObjectOutput != None:
113 shapeOutput.append(visibleObjectOutput)
114 if len(shapeOutput) < 1:
115 return None
116 return {self.getXMLLocalName() : {'shapes' : shapeOutput}}
117
119 "Get the matrix4X4."
120 return None
121
125
127 'Get the minimum z.'
128 return None
129
133
137
141
143 'Get all triangleMeshes.'
144 triangleMeshes = []
145 for archivableObject in self.archivableObjects:
146 triangleMeshes += archivableObject.getTriangleMeshes()
147 return triangleMeshes
148
150 'Get type.'
151 return self.__class__.__name__
152
156
158 'Get visible.'
159 return False
160
162 'Get xml local name.'
163 return self.__class__.__name__.lower()
164
166 'Set the shape of this carvable object info.'
167 self.xmlElement = xmlElement
168 xmlElement.parentNode.xmlObject.archivableObjects.append(self)
169