chiark / gitweb /
Add back the ultimaker platform, and made the platform mesh simpler.
[cura.git] / Cura / slice / cura_sf / fabmetheus_utilities / geometry / statements / statement.py
1 """
2 Polygon path.
3
4 """
5
6 from __future__ import absolute_import
7
8 from fabmetheus_utilities.geometry.geometry_utilities import evaluate
9
10
11 __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
12 __credits__ = 'Art of Illusion <http://www.artofillusion.org/>'
13 __date__ = '$Date: 2008/02/05 $'
14 __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
15
16
17 def processElementNode(elementNode):
18         "Process the xml element."
19         functions = elementNode.getXMLProcessor().functions
20         if len(functions) < 1:
21                 print('Warning, there are no functions in processElementNode in statement for:')
22                 print(elementNode)
23                 return
24         function = functions[-1]
25         evaluate.setLocalAttribute(elementNode)
26         if elementNode.xmlObject.value == None:
27                 print('Warning, elementNode.xmlObject.value is None in processElementNode in statement for:')
28                 print(elementNode)
29                 return
30         localValue = evaluate.getEvaluatedExpressionValueBySplitLine(elementNode, elementNode.xmlObject.value)
31         keywords = elementNode.xmlObject.key.split('.')
32         if len(keywords) == 0:
33                 print('Warning, there are no keywords in processElementNode in statement for:')
34                 print(elementNode)
35                 return
36         firstWord = keywords[0]
37         if len(keywords) == 1:
38                 function.localDictionary[firstWord] = localValue
39                 return
40         attributeName = keywords[-1]
41         object = None
42         if firstWord == 'self':
43                 object = function.classObject
44         else:
45                 object = function.localDictionary[firstWord]
46         for keywordIndex in xrange(1, len(keywords) - 1):
47                 object = object._getAccessibleAttribute(keywords[keywordIndex])
48         object._setAccessibleAttribute(attributeName, localValue)