[Bf-extensions-cvs] [63d378b] master: Use power instead of multiply

Campbell Barton noreply at git.blender.org
Sat Feb 13 10:05:49 CET 2016


Commit: 63d378be70bafe6820ee852f342aa77167f1a0b6
Author: Campbell Barton
Date:   Sat Feb 13 19:57:33 2016 +1100
Branches: master
https://developer.blender.org/rBA63d378be70bafe6820ee852f342aa77167f1a0b6

Use power instead of multiply

===================================================================

M	object_print3d_utils/operators.py

===================================================================

diff --git a/object_print3d_utils/operators.py b/object_print3d_utils/operators.py
index 484827a..bb2847d 100644
--- a/object_print3d_utils/operators.py
+++ b/object_print3d_utils/operators.py
@@ -72,10 +72,10 @@ class Print3DInfoVolume(Operator):
         info.append(("Volume: %s³" % clean_float("%.8f" % volume),
                     None))
         if unit.system == 'IMPERIAL':
-            info.append(("%s \"³" % clean_float("%.4f" % ((volume * (scale * scale * scale)) / (0.0254 * 0.0254 * 0.0254))),
+            info.append(("%s \"³" % clean_float("%.4f" % ((volume * (scale ** 3.0)) / (0.0254 ** 3.0))),
                         None))
         else:
-            info.append(("%s cm³" % clean_float("%.4f" % ((volume * (scale * scale * scale)) / (0.01 * 0.01 * 0.01))),
+            info.append(("%s cm³" % clean_float("%.4f" % ((volume * (scale ** 3.0)) / (0.01 ** 3.0))),
                         None))
 
         report.update(*info)
@@ -101,10 +101,10 @@ class Print3DInfoArea(Operator):
         info.append(("Area: %s²" % clean_float("%.8f" % area),
                     None))
         if unit.system == 'IMPERIAL':
-            info.append(("%s \"²" % clean_float("%.4f" % ((area * (scale * scale)) / (0.0254 * 0.0254))),
+            info.append(("%s \"²" % clean_float("%.4f" % ((area * (scale ** 2.0)) / (0.0254 ** 2.0))),
                         None))
         else:
-            info.append(("%s cm²" % clean_float("%.4f" % ((area * (scale * scale)) / (0.01 * 0.01))),
+            info.append(("%s cm²" % clean_float("%.4f" % ((area * (scale ** 2.0)) / (0.01 ** 2.0))),
                         None))
         report.update(*info)
         return {'FINISHED'}



More information about the Bf-extensions-cvs mailing list