From 99dc4795c71bd7795a61c4014c083394e43d0500 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Thu, 24 Oct 2024 17:38:51 +0500 Subject: [PATCH] Reset not applied objects scales during project save We try to apply scales using bim.update_representation and if didn't worked (presumably because object has openings) we reset the scales. It was confusing for users that they scaled an object, saved IFC and they would know that scaling didn't worked only after they reopen the IFC project. --- src/bonsai/bonsai/bim/export_ifc.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bonsai/bonsai/bim/export_ifc.py b/src/bonsai/bonsai/bim/export_ifc.py index f38a04c3f8..ce1bb125f3 100644 --- a/src/bonsai/bonsai/bim/export_ifc.py +++ b/src/bonsai/bonsai/bim/export_ifc.py @@ -146,6 +146,11 @@ class IfcExporter: return if tool.Geometry.is_scaled(obj): bpy.ops.bim.update_representation(obj=obj.name) + # update_representation might not apply scale if the object has openings + # reset it, so let user know that the scale wasn't saved. + if tool.Geometry.is_scaled(obj): + print(f"WARNING. Object '{obj.name}' scales ({obj.scale[:]}) are reset during project save.") + obj.scale = (1.0, 1.0, 1.0) return element if element.is_a("IfcGridAxis"): return self.sync_grid_axis_object_placement(obj, element)