7 from __future__ import absolute_import
8 #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.
11 from fabmetheus_utilities.geometry.creation import lineation
12 from fabmetheus_utilities.geometry.geometry_tools import path
13 from fabmetheus_utilities import euclidean
14 from fabmetheus_utilities import svg_reader
17 __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
18 __credits__ = 'Nophead <http://hydraraptor.blogspot.com/>\nArt of Illusion <http://www.artofillusion.org/>'
19 __date__ = '$Date: 2008/21/04 $'
20 __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
23 def getGeometryOutput(derivation, elementNode):
24 "Get vector3 vertexes from attribute dictionary."
25 if derivation == None:
26 derivation = SVGDerivation(elementNode)
27 return getGeometryOutputBySVGReader(elementNode, derivation.svgReader)
29 def getGeometryOutputByArguments(arguments, elementNode):
30 "Get vector3 vertexes from attribute dictionary by arguments."
31 derivation = SVGDerivation()
32 derivation.svgReader.parseSVG('', arguments[0])
33 return getGeometryOutput(derivation, elementNode)
35 def getGeometryOutputBySVGReader(elementNode, svgReader):
36 "Get vector3 vertexes from svgReader."
38 for loopLayer in svgReader.loopLayers:
39 for loop in loopLayer.loops:
40 vector3Path = euclidean.getVector3Path(loop, loopLayer.z)
41 sideLoop = lineation.SideLoop(vector3Path)
42 sideLoop.rotate(elementNode)
43 geometryOutput += lineation.getGeometryOutputByManipulation(elementNode, sideLoop)
46 def getNewDerivation(elementNode):
48 return SVGDerivation(elementNode)
50 def processElementNode(elementNode):
51 "Process the xml element."
52 path.convertElementNode(elementNode, getGeometryOutput(None, elementNode))
56 "Class to hold svg variables."
57 def __init__(self, elementNode):
59 self.svgReader = svg_reader.SVGReader()
60 self.svgReader.parseSVGByElementNode(elementNode)