mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 18:56:23 +00:00
New feature to calculate area of selected faces
This commit is contained in:
@@ -170,6 +170,7 @@ if bpy is not None:
|
||||
operator.SelectIfcPatchOutput,
|
||||
operator.ExecuteIfcPatch,
|
||||
operator.CalculateEdgeLengths,
|
||||
operator.CalculateFaceAreas,
|
||||
prop.StrProperty,
|
||||
prop.Variable,
|
||||
prop.Role,
|
||||
|
||||
@@ -3363,3 +3363,19 @@ class CalculateEdgeLengths(bpy.types.Operator):
|
||||
obj.data.vertices[edge.vertices[0]].co).length
|
||||
bpy.context.scene.BIMProperties.qto_result = str(result)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class CalculateFaceAreas(bpy.types.Operator):
|
||||
bl_idname = 'bim.calculate_face_areas'
|
||||
bl_label = 'Calculate Face Areas'
|
||||
|
||||
def execute(self, context):
|
||||
result = 0
|
||||
for obj in bpy.context.selected_objects:
|
||||
if not obj.data or not obj.data.polygons:
|
||||
continue
|
||||
for polygon in obj.data.polygons:
|
||||
if polygon.select:
|
||||
result += polygon.area
|
||||
bpy.context.scene.BIMProperties.qto_result = str(result)
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -525,6 +525,8 @@ class BIM_PT_qto(Panel):
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator("bim.calculate_edge_lengths")
|
||||
row = layout.row(align=True)
|
||||
row.operator("bim.calculate_face_areas")
|
||||
|
||||
|
||||
class BIM_PT_classifications(Panel):
|
||||
|
||||
Reference in New Issue
Block a user