mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Compute wall net quantities (#2086)
* Compute wall net quantities * Remove opening check clause
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user