mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Quantity take offs in SI units
This commit is contained in:
@@ -25,11 +25,11 @@ def calculate_height(obj):
|
||||
|
||||
|
||||
def calculate_edges_lengths(objs, context):
|
||||
return calculate_mesh_quantity(objs, context, lambda bm: sum((e.calc_length() for e in bm.edges if e.select)))
|
||||
return calculate_mesh_quantity(objs, context, lambda bm: sum((e.calc_length() for e in bm.edges)))
|
||||
|
||||
|
||||
def calculate_faces_areas(objs, context):
|
||||
return calculate_mesh_quantity(objs, context, lambda bm: sum((f.calc_area() for f in bm.faces if f.select)))
|
||||
return calculate_mesh_quantity(objs, context, lambda bm: sum((f.calc_area() for f in bm.faces)))
|
||||
|
||||
|
||||
def calculate_volumes(objs, context):
|
||||
|
||||
@@ -21,11 +21,13 @@ import ifcopenshell
|
||||
import ifcopenshell.api
|
||||
import blenderbim.tool as tool
|
||||
import blenderbim.core.qto as core
|
||||
import ifcopenshell.util.unit
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.module.qto import helper
|
||||
from blenderbim.bim.module.pset.qto_calculator import QtoCalculator
|
||||
|
||||
|
||||
|
||||
class CalculateCircleRadius(bpy.types.Operator):
|
||||
bl_idname = "bim.calculate_circle_radius"
|
||||
bl_label = "Calculate Circle Radius"
|
||||
@@ -36,7 +38,9 @@ class CalculateCircleRadius(bpy.types.Operator):
|
||||
return context.active_object
|
||||
|
||||
def execute(self, context):
|
||||
core.calculate_circle_radius(tool.Qto, obj=context.active_object)
|
||||
si_conversion = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||
result = core.calculate_circle_radius(tool.Qto, obj=context.active_object)
|
||||
context.scene.BIMQtoProperties.qto_result = str(round(result/si_conversion, 3))
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -50,8 +54,9 @@ class CalculateEdgeLengths(bpy.types.Operator):
|
||||
return context.selected_objects and context.active_object
|
||||
|
||||
def execute(self, context):
|
||||
si_conversion = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||
result = helper.calculate_edges_lengths([o for o in context.selected_objects if o.type == "MESH"], context)
|
||||
context.scene.BIMQtoProperties.qto_result = str(round(result, 3))
|
||||
context.scene.BIMQtoProperties.qto_result = str(round(result/si_conversion, 3))
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -65,8 +70,9 @@ class CalculateFaceAreas(bpy.types.Operator):
|
||||
return context.selected_objects and context.active_object
|
||||
|
||||
def execute(self, context):
|
||||
si_conversion = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||
result = helper.calculate_faces_areas([o for o in context.selected_objects if o.type == "MESH"], context)
|
||||
context.scene.BIMQtoProperties.qto_result = str(round(result, 3))
|
||||
context.scene.BIMQtoProperties.qto_result = str(round(result/si_conversion/si_conversion, 3))
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -80,8 +86,9 @@ class CalculateObjectVolumes(bpy.types.Operator):
|
||||
return context.selected_objects and context.active_object
|
||||
|
||||
def execute(self, context):
|
||||
si_conversion = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||
result = helper.calculate_volumes([o for o in context.selected_objects if o.type == "MESH"], context)
|
||||
context.scene.BIMQtoProperties.qto_result = str(round(result, 3))
|
||||
context.scene.BIMQtoProperties.qto_result = str(round(result/si_conversion/si_conversion/si_conversion, 3))
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import blenderbim.bim.schema
|
||||
class Qto(blenderbim.core.tool.Qto):
|
||||
@classmethod
|
||||
def get_radius_of_selected_vertices(cls, obj):
|
||||
selected_verts = [v.co for v in obj.data.vertices if v.select]
|
||||
selected_verts = [v.co for v in obj.data.vertices]
|
||||
total = Vector()
|
||||
for v in selected_verts:
|
||||
total += v
|
||||
|
||||
Reference in New Issue
Block a user