From 20f4737ffd641c43bc9acaff092cf5d232a71b55 Mon Sep 17 00:00:00 2001 From: Massimo Fabbro Date: Thu, 10 Nov 2022 23:27:14 +0100 Subject: [PATCH] Fix some errors and update notes --- .../module/pset/calc_quantity_function_mapper.py | 6 +++--- .../notes_about_mapped_calculated_quantities.txt | 9 ++++++--- .../blenderbim/bim/module/pset/qto_calculator.py | 15 +++++++++------ 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/pset/calc_quantity_function_mapper.py b/src/blenderbim/blenderbim/bim/module/pset/calc_quantity_function_mapper.py index ed1093da0d..64a0f48066 100644 --- a/src/blenderbim/blenderbim/bim/module/pset/calc_quantity_function_mapper.py +++ b/src/blenderbim/blenderbim/bim/module/pset/calc_quantity_function_mapper.py @@ -378,13 +378,13 @@ mapper = { 'Length' : None, }, 'Qto_WallBaseQuantities' : { - 'Length' : "get_length", + 'Length' : { "function_name" : "get_length", "args" : ", main_axis = 'x'"}, 'Width' : "get_width", 'Height' : "get_height", 'GrossFootprintArea' : "get_gross_footprint_area", 'NetFootprintArea' : "get_net_footprint_area", - 'GrossSideArea' : { "function_name" : "get_half_lateral_area", "args" : ", exclude_end_areas = True, subtract_openings = False" }, - 'NetSideArea' : { "function_name" : "get_half_lateral_area", "args" : ", exclude_end_areas = True" }, + 'GrossSideArea' : { "function_name" : "get_half_lateral_area", "args" : ", exclude_end_areas = True, subtract_openings = False, main_axis = 'x'" }, + 'NetSideArea' : { "function_name" : "get_half_lateral_area", "args" : ", exclude_end_areas = True, main_axis = 'x'" }, 'GrossVolume' : "get_gross_volume", 'NetVolume' : "get_net_volume", 'GrossWeight' : None, diff --git a/src/blenderbim/blenderbim/bim/module/pset/notes_about_mapped_calculated_quantities.txt b/src/blenderbim/blenderbim/bim/module/pset/notes_about_mapped_calculated_quantities.txt index ce82fd3e01..d6a7e89ada 100644 --- a/src/blenderbim/blenderbim/bim/module/pset/notes_about_mapped_calculated_quantities.txt +++ b/src/blenderbim/blenderbim/bim/module/pset/notes_about_mapped_calculated_quantities.txt @@ -6,14 +6,17 @@ without the related IFC opening. So, if an object is created lets say with a hole but without defining the opening, the hole is counted into net volume (so get volume and net volume are the same). This is in order to follow the native IFC approach. -WALLS AND BEAM LENGTH, HEIGHT, WIDTH AND LATERAL AREA -These dimensions are calculated with the convention that the object can have main axis along x or z. -The same with lateral area. +WALLS +Walls quantities are calculated with the convention that the object main axis is the 'x'. SLAB THICKNESS The slab thickness is defined as Width, following the IFC definition Also, note that these dimensions are calculated only if the slab is prismatic. +LATERAL AREA +All lateral areas are counted, so for example also the inside surfaces. +It shouldn't be like that so we should find a method to only external lateral area. + diff --git a/src/blenderbim/blenderbim/bim/module/pset/qto_calculator.py b/src/blenderbim/blenderbim/bim/module/pset/qto_calculator.py index 5c8fa13188..c601e68337 100644 --- a/src/blenderbim/blenderbim/bim/module/pset/qto_calculator.py +++ b/src/blenderbim/blenderbim/bim/module/pset/qto_calculator.py @@ -95,12 +95,12 @@ class QtoCalculator: z = (Vector(o.bound_box[1]) - Vector(o.bound_box[0])).length return max(x, y, z) - def get_length(self, o, vg_index=None): + def get_length(self, o, vg_index=None, main_axis: str = ""): if vg_index is None: x = (Vector(o.bound_box[4]) - Vector(o.bound_box[0])).length y = (Vector(o.bound_box[3]) - Vector(o.bound_box[0])).length z = (Vector(o.bound_box[1]) - Vector(o.bound_box[0])).length - if self.get_object_main_axis(o) == "x": + if self.get_object_main_axis(o) == "x" or main_axis=="x": return max(x, y) if self.get_object_main_axis(o) == "z": return max(z, x) @@ -423,6 +423,7 @@ class QtoCalculator: exclude_side_areas: bool = False, angle_z1: int = 45, angle_z2: int = 135, + main_axis: str = "", ): """_summary_ @@ -439,15 +440,15 @@ class QtoCalculator: y_axis = [0, 1, 0] z_axis = [0, 0, 1] - if self.get_object_main_axis(obj) == "x": + if self.get_object_main_axis(obj) == "x" or main_axis == "x": main_axis = x_axis side_axis = y_axis top_axis = z_axis - if self.get_object_main_axis(obj) == "z": + elif self.get_object_main_axis(obj) == "z": main_axis = z_axis side_axis = x_axis top_axis = y_axis - if self.get_object_main_axis(obj) == "y": + elif self.get_object_main_axis(obj) == "y": main_axis = y_axis side_axis = z_axis top_axis = x_axis @@ -481,6 +482,7 @@ class QtoCalculator: exclude_side_areas: bool = False, angle_z1: int = 45, angle_z2: int = 135, + main_axis: str = "", ): """_summary_ @@ -499,7 +501,7 @@ class QtoCalculator: gross_obj = bpy.data.objects.new("MyObject", gross_mesh) - gross_lateral_area = self.get_lateral_area(gross_obj, subtract_openings, exclude_end_areas, exclude_side_areas, angle_z1, angle_z2 ) + gross_lateral_area = self.get_lateral_area(gross_obj, subtract_openings, exclude_end_areas, exclude_side_areas, angle_z1, angle_z2, main_axis ) self.delete_obj(gross_obj) self.delete_mesh(gross_mesh) @@ -515,6 +517,7 @@ class QtoCalculator: exclude_side_areas: bool = False, angle_z1: int = 45, angle_z2: int = 135, + main_axis: str = "", ): """_summary_: :param blender-object obj: blender object, bpy.types.Object