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_utilities.evaluate_elements import setting
12 from fabmetheus_utilities.geometry.geometry_utilities import evaluate
13 from fabmetheus_utilities.vector3 import Vector3
14 from fabmetheus_utilities import euclidean
15 from fabmetheus_utilities import intercircle
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 globalExecutionOrder = 80
27 def getManipulatedPaths(close, elementNode, loop, prefix, sideLength):
28 "Get path with outline."
31 derivation = OutlineDerivation(elementNode, prefix, sideLength)
32 loopComplex = euclidean.getComplexPath(loop)
33 if derivation.isClosed:
34 loopComplexes = intercircle.getAroundsFromLoop(loopComplex, derivation.radius)
36 loopComplexes = intercircle.getAroundsFromPath(loopComplex, derivation.radius)
37 return euclidean.getVector3Paths(loopComplexes, loop[0].z)
39 def getNewDerivation(elementNode, prefix, sideLength):
41 return OutlineDerivation(elementNode, prefix, sideLength)
43 def processElementNode(elementNode):
44 "Process the xml element."
45 lineation.processElementNodeByFunction(elementNode, getManipulatedPaths)
48 class OutlineDerivation:
49 "Class to hold outline variables."
50 def __init__(self, elementNode, prefix, sideLength):
52 self.isClosed = evaluate.getEvaluatedBoolean(False, elementNode, prefix + 'closed')
53 self.radius = evaluate.getEvaluatedFloat(setting.getEdgeWidth(elementNode), elementNode, prefix + 'radius')