From 5b327ab59e239faf3d79b546cb9ece131661da30 Mon Sep 17 00:00:00 2001 From: Gorgious Date: Fri, 11 Mar 2022 12:11:25 +0100 Subject: [PATCH 1/2] Compute wall net quantities --- .../blenderbim/bim/module/model/wall.py | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/model/wall.py b/src/blenderbim/blenderbim/bim/module/model/wall.py index 72a2c33c451..58d6ba028f2 100644 --- a/src/blenderbim/blenderbim/bim/module/model/wall.py +++ b/src/blenderbim/blenderbim/bim/module/model/wall.py @@ -875,16 +875,24 @@ def calculate_quantities(usecase_path, ifc_file, settings): gross_volume = 0 net_volume = 0 else: - bm = bmesh.new() - bm.from_mesh(obj.data) - bm.faces.ensure_lookup_table() - gross_footprint_area = sum([f.calc_area() for f in bm.faces if f.normal.z < -0.9]) - net_footprint_area = gross_footprint_area - gross_side_area = sum([f.calc_area() for f in bm.faces if f.normal.y > 0.9]) - net_side_area = gross_side_area - gross_volume = bm.calc_volume() - net_volume = gross_volume - bm.free() + bm_gross = bmesh.new() + bm_gross.from_mesh(obj.data) + bm_gross.faces.ensure_lookup_table() + + bm_net = bmesh.new() + depsgraph = bpy.context.evaluated_depsgraph_get() + evaluated_mesh = obj.evaluated_get(depsgraph).data + bm_net.from_mesh(evaluated_mesh) + bm_net.faces.ensure_lookup_table() + + gross_footprint_area = sum([f.calc_area() for f in bm_gross.faces if f.normal.z < -0.9]) + net_footprint_area = sum([f.calc_area() for f in bm_net.faces if f.normal.z < -0.9]) + gross_side_area = sum([f.calc_area() for f in bm_gross.faces if f.normal.y > 0.9]) + net_side_area = sum([f.calc_area() for f in bm_net.faces if f.normal.y > 0.9]) + gross_volume = bm_gross.calc_volume() + net_volume = bm_net.calc_volume() + bm_gross.free() + bm_net.free() ifcopenshell.api.run( "pset.edit_qto", From cbebd3804fe61aa1da6d59b5b936b5523e3b79f6 Mon Sep 17 00:00:00 2001 From: Gorgious Date: Fri, 11 Mar 2022 12:16:26 +0100 Subject: [PATCH 2/2] Remove opening check clause --- .../blenderbim/bim/module/model/wall.py | 45 ++++++++----------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/model/wall.py b/src/blenderbim/blenderbim/bim/module/model/wall.py index 58d6ba028f2..d41f8d5e11e 100644 --- a/src/blenderbim/blenderbim/bim/module/model/wall.py +++ b/src/blenderbim/blenderbim/bim/module/model/wall.py @@ -866,33 +866,24 @@ def calculate_quantities(usecase_path, ifc_file, settings): width = obj.dimensions[1] / unit_scale height = obj.dimensions[2] / unit_scale - if product.HasOpenings: - # TODO: calculate gross / net - gross_footprint_area = 0 - net_footprint_area = 0 - gross_side_area = 0 - net_side_area = 0 - gross_volume = 0 - net_volume = 0 - else: - bm_gross = bmesh.new() - bm_gross.from_mesh(obj.data) - bm_gross.faces.ensure_lookup_table() - - bm_net = bmesh.new() - depsgraph = bpy.context.evaluated_depsgraph_get() - evaluated_mesh = obj.evaluated_get(depsgraph).data - bm_net.from_mesh(evaluated_mesh) - bm_net.faces.ensure_lookup_table() - - gross_footprint_area = sum([f.calc_area() for f in bm_gross.faces if f.normal.z < -0.9]) - net_footprint_area = sum([f.calc_area() for f in bm_net.faces if f.normal.z < -0.9]) - gross_side_area = sum([f.calc_area() for f in bm_gross.faces if f.normal.y > 0.9]) - net_side_area = sum([f.calc_area() for f in bm_net.faces if f.normal.y > 0.9]) - gross_volume = bm_gross.calc_volume() - net_volume = bm_net.calc_volume() - bm_gross.free() - bm_net.free() + bm_gross = bmesh.new() + bm_gross.from_mesh(obj.data) + bm_gross.faces.ensure_lookup_table() + + bm_net = bmesh.new() + depsgraph = bpy.context.evaluated_depsgraph_get() + evaluated_mesh = obj.evaluated_get(depsgraph).data + bm_net.from_mesh(evaluated_mesh) + bm_net.faces.ensure_lookup_table() + + gross_footprint_area = sum([f.calc_area() for f in bm_gross.faces if f.normal.z < -0.9]) + net_footprint_area = sum([f.calc_area() for f in bm_net.faces if f.normal.z < -0.9]) + gross_side_area = sum([f.calc_area() for f in bm_gross.faces if f.normal.y > 0.9]) + net_side_area = sum([f.calc_area() for f in bm_net.faces if f.normal.y > 0.9]) + gross_volume = bm_gross.calc_volume() + net_volume = bm_net.calc_volume() + bm_gross.free() + bm_net.free() ifcopenshell.api.run( "pset.edit_qto",