2 Boolean geometry scale.
6 from __future__ import absolute_import
8 from fabmetheus_utilities.geometry.creation import solid
9 from fabmetheus_utilities.geometry.geometry_utilities import matrix
10 from fabmetheus_utilities.vector3 import Vector3
13 __author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
14 __credits__ = 'Art of Illusion <http://www.artofillusion.org/>'
15 __date__ = '$Date: 2008/02/05 $'
16 __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
19 globalExecutionOrder = 340
22 def getManipulatedGeometryOutput(elementNode, geometryOutput, prefix):
23 "Get equated geometryOutput."
24 scalePoints( elementNode, matrix.getVertexes(geometryOutput), prefix )
27 def getManipulatedPaths(close, elementNode, loop, prefix, sideLength):
29 scalePoints( elementNode, loop, prefix )
32 def getNewDerivation(elementNode, prefix, sideLength):
34 return ScaleDerivation(elementNode)
36 def manipulateElementNode(elementNode, target):
37 "Manipulate the xml element."
38 derivation = ScaleDerivation(elementNode)
39 if derivation.scaleTetragrid == None:
40 print('Warning, scaleTetragrid was None in scale so nothing will be done for:')
43 matrix.setAttributesToMultipliedTetragrid(target, derivation.scaleTetragrid)
45 def processElementNode(elementNode):
46 "Process the xml element."
47 solid.processElementNodeByFunction(elementNode, manipulateElementNode)
49 def scalePoints(elementNode, points, prefix):
51 scaleVector3Default = Vector3(1.0, 1.0, 1.0)
52 scaleVector3 = matrix.getCumulativeVector3Remove(scaleVector3Default.copy(), elementNode, prefix)
53 if scaleVector3 == scaleVector3Default:
56 point.x *= scaleVector3.x
57 point.y *= scaleVector3.y
58 point.z *= scaleVector3.z
61 class ScaleDerivation(object):
62 "Class to hold scale variables."
63 def __init__(self, elementNode):
65 self.scaleTetragrid = matrix.getScaleTetragrid(elementNode, '')