Skip to content

Commit 3c26cb6

Browse files
authored
Compute wall net quantities (IfcOpenShell#2086)
* Compute wall net quantities * Remove opening check clause
1 parent 673f757 commit 3c26cb6

File tree

1 file changed

+18
-19
lines changed
  • src/blenderbim/blenderbim/bim/module/model

1 file changed

+18
-19
lines changed

src/blenderbim/blenderbim/bim/module/model/wall.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -866,25 +866,24 @@ def calculate_quantities(usecase_path, ifc_file, settings):
866866
width = obj.dimensions[1] / unit_scale
867867
height = obj.dimensions[2] / unit_scale
868868

869-
if product.HasOpenings:
870-
# TODO: calculate gross / net
871-
gross_footprint_area = 0
872-
net_footprint_area = 0
873-
gross_side_area = 0
874-
net_side_area = 0
875-
gross_volume = 0
876-
net_volume = 0
877-
else:
878-
bm = bmesh.new()
879-
bm.from_mesh(obj.data)
880-
bm.faces.ensure_lookup_table()
881-
gross_footprint_area = sum([f.calc_area() for f in bm.faces if f.normal.z < -0.9])
882-
net_footprint_area = gross_footprint_area
883-
gross_side_area = sum([f.calc_area() for f in bm.faces if f.normal.y > 0.9])
884-
net_side_area = gross_side_area
885-
gross_volume = bm.calc_volume()
886-
net_volume = gross_volume
887-
bm.free()
869+
bm_gross = bmesh.new()
870+
bm_gross.from_mesh(obj.data)
871+
bm_gross.faces.ensure_lookup_table()
872+
873+
bm_net = bmesh.new()
874+
depsgraph = bpy.context.evaluated_depsgraph_get()
875+
evaluated_mesh = obj.evaluated_get(depsgraph).data
876+
bm_net.from_mesh(evaluated_mesh)
877+
bm_net.faces.ensure_lookup_table()
878+
879+
gross_footprint_area = sum([f.calc_area() for f in bm_gross.faces if f.normal.z < -0.9])
880+
net_footprint_area = sum([f.calc_area() for f in bm_net.faces if f.normal.z < -0.9])
881+
gross_side_area = sum([f.calc_area() for f in bm_gross.faces if f.normal.y > 0.9])
882+
net_side_area = sum([f.calc_area() for f in bm_net.faces if f.normal.y > 0.9])
883+
gross_volume = bm_gross.calc_volume()
884+
net_volume = bm_net.calc_volume()
885+
bm_gross.free()
886+
bm_net.free()
888887

889888
ifcopenshell.api.run(
890889
"pset.edit_qto",

0 commit comments

Comments
 (0)