Compute wall net quantities (#2086)

* Compute wall net quantities

* Remove opening check clause
This commit is contained in:
Gorgious56
2022-03-14 02:48:50 +01:00
committed by GitHub
parent 673f757a51
commit 3c26cb672b
@@ -866,25 +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 = 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",