mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
New feature to calculate side formwork, such as for columns.
This commit is contained in:
@@ -62,7 +62,7 @@ def calculate_formwork_area(objs, context):
|
|||||||
"""
|
"""
|
||||||
Formwork is defined as the surface area required to cover all exposed
|
Formwork is defined as the surface area required to cover all exposed
|
||||||
surfaces of one or more objects, excluding top surfaces (i.e. that have a
|
surfaces of one or more objects, excluding top surfaces (i.e. that have a
|
||||||
face normal with a significant Z component).
|
face normal with a significant +Z component).
|
||||||
"""
|
"""
|
||||||
copied_objs = []
|
copied_objs = []
|
||||||
result = 0
|
result = 0
|
||||||
@@ -105,3 +105,19 @@ def calculate_formwork_area(objs, context):
|
|||||||
continue
|
continue
|
||||||
result += polygon.area
|
result += polygon.area
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def calculate_side_formwork_area(objs, context):
|
||||||
|
"""
|
||||||
|
Side formwork is defined as the surface area required to cover all exposed
|
||||||
|
surfaces of one or more objects, excluding top and bottom surfaces (i.e.
|
||||||
|
that have a face normal with a significant Z component).
|
||||||
|
"""
|
||||||
|
result = 0
|
||||||
|
for obj in objs:
|
||||||
|
mesh = obj.evaluated_get(context.evaluated_depsgraph_get()).to_mesh()
|
||||||
|
for polygon in mesh.polygons:
|
||||||
|
if abs(polygon.normal.z) > 0.8:
|
||||||
|
continue
|
||||||
|
result += polygon.area
|
||||||
|
return result
|
||||||
|
|||||||
@@ -105,6 +105,8 @@ class ExecuteQtoMethod(bpy.types.Operator):
|
|||||||
result = helper.calculate_volumes(selected_mesh_objects, context)
|
result = helper.calculate_volumes(selected_mesh_objects, context)
|
||||||
elif props.qto_methods == "FORMWORK":
|
elif props.qto_methods == "FORMWORK":
|
||||||
result = helper.calculate_formwork_area(selected_mesh_objects, context)
|
result = helper.calculate_formwork_area(selected_mesh_objects, context)
|
||||||
|
elif props.qto_methods == "SIDE_FORMWORK":
|
||||||
|
result = helper.calculate_side_formwork_area(selected_mesh_objects, context)
|
||||||
props.qto_result = str(round(result, 3))
|
props.qto_result = str(round(result, 3))
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
@@ -134,6 +136,8 @@ class QuantifyObjects(bpy.types.Operator):
|
|||||||
result = helper.calculate_volumes([obj], context)
|
result = helper.calculate_volumes([obj], context)
|
||||||
elif props.qto_methods == "FORMWORK":
|
elif props.qto_methods == "FORMWORK":
|
||||||
result = helper.calculate_formwork_area([obj], context)
|
result = helper.calculate_formwork_area([obj], context)
|
||||||
|
elif props.qto_methods == "SIDE_FORMWORK":
|
||||||
|
result = helper.calculate_side_formwork_area([obj], context)
|
||||||
if not result:
|
if not result:
|
||||||
continue
|
continue
|
||||||
result = round(result, 3)
|
result = round(result, 3)
|
||||||
|
|||||||
@@ -37,7 +37,16 @@ class BIMQtoProperties(PropertyGroup):
|
|||||||
items=[
|
items=[
|
||||||
("HEIGHT", "Height", "Calculate the Z height of an object"),
|
("HEIGHT", "Height", "Calculate the Z height of an object"),
|
||||||
("VOLUME", "Volume", "Calculate the volume of an object"),
|
("VOLUME", "Volume", "Calculate the volume of an object"),
|
||||||
("FORMWORK", "Formwork", "Calculate the exposed formwork for all bottoms and sides of one or more objects"),
|
(
|
||||||
|
"FORMWORK",
|
||||||
|
"Formwork",
|
||||||
|
"Calculate the exposed formwork for all bottoms and sides (e.g. for beams and slabs) of one or more objects",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"SIDE_FORMWORK",
|
||||||
|
"Side Formwork",
|
||||||
|
"Calculate the exposed formwork for all sides only (e.g. for columns) of one or more objects",
|
||||||
|
),
|
||||||
],
|
],
|
||||||
name="Qto Methods",
|
name="Qto Methods",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ Scenario: Calculate object volumes
|
|||||||
When I press "bim.calculate_object_volumes"
|
When I press "bim.calculate_object_volumes"
|
||||||
Then "scene.BIMQtoProperties.qto_result" is "8.0"
|
Then "scene.BIMQtoProperties.qto_result" is "8.0"
|
||||||
|
|
||||||
Scenario: Calculate formwork areas
|
Scenario: Execute qto method - formwork areas
|
||||||
Given an empty Blender session
|
Given an empty Blender session
|
||||||
And I add a cube
|
And I add a cube
|
||||||
And I add a cube of size "1" at "1,0,0"
|
And I add a cube of size "1" at "1,0,0"
|
||||||
@@ -38,3 +38,11 @@ Scenario: Calculate formwork areas
|
|||||||
When I set "scene.BIMQtoProperties.qto_methods" to "FORMWORK"
|
When I set "scene.BIMQtoProperties.qto_methods" to "FORMWORK"
|
||||||
And I press "bim.execute_qto_method"
|
And I press "bim.execute_qto_method"
|
||||||
Then "scene.BIMQtoProperties.qto_result" is "21.5"
|
Then "scene.BIMQtoProperties.qto_result" is "21.5"
|
||||||
|
|
||||||
|
Scenario: Execute qto method - side formwork areas
|
||||||
|
Given an empty Blender session
|
||||||
|
And I add a cube
|
||||||
|
And the object "Cube" is selected
|
||||||
|
When I set "scene.BIMQtoProperties.qto_methods" to "SIDE_FORMWORK"
|
||||||
|
And I press "bim.execute_qto_method"
|
||||||
|
Then "scene.BIMQtoProperties.qto_result" is "16.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user