2 Boolean geometry concatenation.
6 from __future__ import absolute_import
8 from fabmetheus_utilities.geometry.creation import lineation
9 from fabmetheus_utilities.geometry.geometry_tools import path
10 from fabmetheus_utilities.geometry.geometry_utilities import evaluate
11 from fabmetheus_utilities import euclidean
14 __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
15 __credits__ = 'Art of Illusion <http://www.artofillusion.org/>'
16 __date__ = '$Date: 2008/02/05 $'
17 __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
20 def getGeometryOutput(derivation, elementNode):
21 'Get triangle mesh from attribute dictionary.'
22 if derivation == None:
23 derivation = ConcatenateDerivation(elementNode)
24 concatenatedList = euclidean.getConcatenatedList(derivation.target)[:]
25 if len(concatenatedList) == 0:
26 print('Warning, in concatenate there are no paths.')
27 print(elementNode.attributes)
29 if 'closed' not in elementNode.attributes:
30 elementNode.attributes['closed'] = 'true'
31 return lineation.getGeometryOutputByLoop(elementNode, lineation.SideLoop(concatenatedList))
33 def getGeometryOutputByArguments(arguments, elementNode):
34 'Get triangle mesh from attribute dictionary by arguments.'
35 return getGeometryOutput(None, elementNode)
37 def getNewDerivation(elementNode):
39 return ConcatenateDerivation(elementNode)
41 def processElementNode(elementNode):
42 'Process the xml element.'
43 path.convertElementNode(elementNode, getGeometryOutput(None, elementNode))
46 class ConcatenateDerivation(object):
47 'Class to hold concatenate variables.'
48 def __init__(self, elementNode):
50 self.target = evaluate.getTransformedPathsByKey([], elementNode, 'target')