From 1ee2f420c8e057cdff05f9f4434c7c6980a0d83f Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 18 Jun 2021 14:19:53 +1000 Subject: [PATCH] New feature to see derived global and local elevations --- .../bim/module/geometry/__init__.py | 1 + .../blenderbim/bim/module/geometry/ui.py | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/blenderbim/blenderbim/bim/module/geometry/__init__.py b/src/blenderbim/blenderbim/bim/module/geometry/__init__.py index e0b00b7e81..433e308052 100644 --- a/src/blenderbim/blenderbim/bim/module/geometry/__init__.py +++ b/src/blenderbim/blenderbim/bim/module/geometry/__init__.py @@ -10,6 +10,7 @@ classes = ( operator.UpdateParametricRepresentation, operator.GetRepresentationIfcParameters, prop.BIMGeometryProperties, + ui.BIM_PT_derived_placements, ui.BIM_PT_representations, ui.BIM_PT_mesh, ui.BIM_PT_workarounds, diff --git a/src/blenderbim/blenderbim/bim/module/geometry/ui.py b/src/blenderbim/blenderbim/bim/module/geometry/ui.py index 5378d33c62..784e2ff739 100644 --- a/src/blenderbim/blenderbim/bim/module/geometry/ui.py +++ b/src/blenderbim/blenderbim/bim/module/geometry/ui.py @@ -113,6 +113,36 @@ def BIM_PT_transform(self, context): row.operator("bim.edit_object_placement") +class BIM_PT_derived_placements(Panel): + bl_label = "IFC Derived Placements" + bl_idname = "BIM_PT_derived_placements" + bl_options = {"DEFAULT_CLOSED"} + bl_space_type = "PROPERTIES" + bl_region_type = "WINDOW" + bl_context = "object" + bl_parent_id = "OBJECT_PT_transform" + + def draw(self, context): + z = context.active_object.matrix_world.translation.z + z_values = [co[2] for co in context.active_object.bound_box] + row = self.layout.row(align=True) + row.label(text="Min Global Z") + row.label(text="{0:.3f}".format(min(z_values) + z)) + row = self.layout.row(align=True) + row.label(text="Max Global Z") + row.label(text="{0:.3f}".format(max(z_values) + z)) + + collection = bpy.data.objects.get(context.active_object.users_collection[0].name) + if collection: + collection_z = collection.matrix_world.translation.z + row = self.layout.row(align=True) + row.label(text="Min Local Z") + row.label(text="{0:.3f}".format(min(z_values) + z - collection_z)) + row = self.layout.row(align=True) + row.label(text="Max Local Z") + row.label(text="{0:.3f}".format(max(z_values) + z - collection_z)) + + class BIM_PT_workarounds(Panel): bl_label = "IFC Vendor Workarounds" bl_idname = "BIM_PT_workarounds"