From 258c32a95672b532bd383fc6ca464127381ae651 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 Nov 2013 04:59:05 +1100 Subject: Fix T37555: Update 3D toolbox for changes to the BMesh API. --- object_print3d_utils/operators.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'object_print3d_utils/operators.py') diff --git a/object_print3d_utils/operators.py b/object_print3d_utils/operators.py index 7548d165..7ebf5956 100644 --- a/object_print3d_utils/operators.py +++ b/object_print3d_utils/operators.py @@ -543,6 +543,10 @@ class Print3DScaleToVolume(Operator): volume = sum(calc_volume(obj) for obj in context.selected_editable_objects if obj.type == 'MESH') + if volume == 0.0: + self.report({'WARNING'}, "Object has zero volume") + return {'CANCELLED'} + self.volume_init = self.volume = abs(volume) wm = context.window_manager @@ -582,12 +586,17 @@ class Print3DScaleToBounds(Operator): if context.mode == 'EDIT_MESH': length, axis = calc_length([Vector(v) * obj.matrix_world - for v in context.edit_object.bound_box]) + for obj in [context.edit_object] + for v in obj.bound_box]) else: length, axis = calc_length([Vector(v) * obj.matrix_world for obj in context.selected_editable_objects if obj.type == 'MESH' for v in obj.bound_box]) + if length == 0.0: + self.report({'WARNING'}, "Object has zero bounds") + return {'CANCELLED'} + self.length_init = self.length = length self.axis_init = axis -- cgit v1.2.3