mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
calculate quantities based on either object mode or edit mode
This commit is contained in:
@@ -25,11 +25,18 @@ def calculate_height(obj):
|
|||||||
|
|
||||||
|
|
||||||
def calculate_edges_lengths(objs, context):
|
def calculate_edges_lengths(objs, context):
|
||||||
return calculate_mesh_quantity(objs, context, lambda bm: sum((e.calc_length() for e in bm.edges)))
|
if bpy.context.mode == 'OBJECT':
|
||||||
|
return calculate_mesh_quantity(objs, context, lambda bm: sum((e.calc_length() for e in bm.edges)))
|
||||||
|
elif bpy.context.mode == 'EDIT_MESH':
|
||||||
|
return calculate_mesh_quantity(objs, context, lambda bm: sum((e.calc_length() for e in bm.edges if e.select)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def calculate_faces_areas(objs, context):
|
def calculate_faces_areas(objs, context):
|
||||||
return calculate_mesh_quantity(objs, context, lambda bm: sum((f.calc_area() for f in bm.faces)))
|
if bpy.context.mode == 'OBJECT':
|
||||||
|
return calculate_mesh_quantity(objs, context, lambda bm: sum((f.calc_area() for f in bm.faces)))
|
||||||
|
elif bpy.context.mode == 'EDIT_MESH':
|
||||||
|
return calculate_mesh_quantity(objs, context, lambda bm: sum((f.calc_area() for f in bm.faces if f.select)))
|
||||||
|
|
||||||
|
|
||||||
def calculate_volumes(objs, context):
|
def calculate_volumes(objs, context):
|
||||||
|
|||||||
Reference in New Issue
Block a user