4 There is also the print attribute in geometry_utilities/evaluate_fundamentals/print.py
6 The model is xml_models/geometry_utilities/evaluate_fundamentals/print.xml
10 from __future__ import absolute_import
12 from fabmetheus_utilities.geometry.geometry_utilities import evaluate
15 __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
16 __credits__ = 'Art of Illusion <http://www.artofillusion.org/>'
17 __date__ = '$Date: 2008/02/05 $'
18 __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
21 def getLocalDictionary( attributesKey, elementNode):
22 "Get the local dictionary."
23 xmlProcessor = elementNode.getXMLProcessor()
24 if len( xmlProcessor.functions ) < 1:
26 return xmlProcessor.functions[-1].localDictionary
28 def printAttributesKey( attributesKey, elementNode):
29 "Print the attributesKey."
30 if attributesKey.lower() == '_localdictionary':
31 localDictionary = getLocalDictionary( attributesKey, elementNode)
32 if localDictionary != None:
33 localDictionaryKeys = localDictionary.keys()
34 attributeValue = elementNode.attributes[attributesKey]
35 if attributeValue != '':
36 attributeValue = ' - ' + attributeValue
37 print('Local Dictionary Variables' + attributeValue )
38 localDictionaryKeys.sort()
39 for localDictionaryKey in localDictionaryKeys:
40 print('%s: %s' % ( localDictionaryKey, localDictionary[ localDictionaryKey ] ) )
42 value = elementNode.attributes[attributesKey]
45 evaluatedValue = evaluate.getEvaluatedExpressionValue(elementNode, attributesKey)
47 evaluatedValue = evaluate.getEvaluatedExpressionValue(elementNode, value)
48 print('%s: %s' % ( attributesKey, evaluatedValue ) )
50 def processElementNode(elementNode):
51 "Process the xml element."
52 if len(elementNode.getTextContent()) > 1:
53 print(elementNode.getTextContent())
55 attributesKeys = elementNode.attributes.keys()
56 if len( attributesKeys ) < 1:
60 for attributesKey in attributesKeys:
61 printAttributesKey( attributesKey, elementNode)