2 Boolean geometry concatenation.
6 from __future__ import absolute_import
7 #Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
10 from fabmetheus_utilities.geometry.creation import lineation
11 from fabmetheus_utilities.geometry.geometry_tools import path
12 from fabmetheus_utilities.geometry.geometry_utilities import evaluate
13 from fabmetheus_utilities.vector3 import Vector3
14 from fabmetheus_utilities import euclidean
18 __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
19 __credits__ = 'Art of Illusion <http://www.artofillusion.org/>'
20 __date__ = '$Date: 2008/02/05 $'
21 __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
24 def getGeometryOutput(derivation, elementNode):
25 'Get triangle mesh from attribute dictionary.'
26 if derivation == None:
27 derivation = ConcatenateDerivation(elementNode)
28 concatenatedList = euclidean.getConcatenatedList(derivation.target)[:]
29 if len(concatenatedList) == 0:
30 print('Warning, in concatenate there are no paths.')
31 print(elementNode.attributes)
33 if 'closed' not in elementNode.attributes:
34 elementNode.attributes['closed'] = 'true'
35 return lineation.getGeometryOutputByLoop(elementNode, lineation.SideLoop(concatenatedList))
37 def getGeometryOutputByArguments(arguments, elementNode):
38 'Get triangle mesh from attribute dictionary by arguments.'
39 return getGeometryOutput(None, elementNode)
41 def getNewDerivation(elementNode):
43 return ConcatenateDerivation(elementNode)
45 def processElementNode(elementNode):
46 'Process the xml element.'
47 path.convertElementNode(elementNode, getGeometryOutput(None, elementNode))
50 class ConcatenateDerivation:
51 'Class to hold concatenate variables.'
52 def __init__(self, elementNode):
54 self.target = evaluate.getTransformedPathsByKey([], elementNode, 'target')