2 Boolean geometry scale.
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 solid
11 from fabmetheus_utilities.geometry.geometry_utilities import matrix
12 from fabmetheus_utilities.vector3 import Vector3
13 from fabmetheus_utilities import euclidean
16 __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
17 __credits__ = 'Art of Illusion <http://www.artofillusion.org/>'
18 __date__ = '$Date: 2008/02/05 $'
19 __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
22 globalExecutionOrder = 340
25 def getManipulatedGeometryOutput(elementNode, geometryOutput, prefix):
26 "Get equated geometryOutput."
27 scalePoints( elementNode, matrix.getVertexes(geometryOutput), prefix )
30 def getManipulatedPaths(close, elementNode, loop, prefix, sideLength):
32 scalePoints( elementNode, loop, prefix )
35 def getNewDerivation(elementNode, prefix, sideLength):
37 return ScaleDerivation(elementNode)
39 def manipulateElementNode(elementNode, target):
40 "Manipulate the xml element."
41 derivation = ScaleDerivation(elementNode)
42 if derivation.scaleTetragrid == None:
43 print('Warning, scaleTetragrid was None in scale so nothing will be done for:')
46 matrix.setAttributesToMultipliedTetragrid(target, derivation.scaleTetragrid)
48 def processElementNode(elementNode):
49 "Process the xml element."
50 solid.processElementNodeByFunction(elementNode, manipulateElementNode)
52 def scalePoints(elementNode, points, prefix):
54 scaleVector3Default = Vector3(1.0, 1.0, 1.0)
55 scaleVector3 = matrix.getCumulativeVector3Remove(scaleVector3Default.copy(), elementNode, prefix)
56 if scaleVector3 == scaleVector3Default:
59 point.x *= scaleVector3.x
60 point.y *= scaleVector3.y
61 point.z *= scaleVector3.z
64 class ScaleDerivation:
65 "Class to hold scale variables."
66 def __init__(self, elementNode):
68 self.scaleTetragrid = matrix.getScaleTetragrid(elementNode, '')