mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 10:23:41 +00:00
Minor fix to expose both net and gross variants of IfcOpenShell Qto calculator
This commit is contained in:
@@ -89,7 +89,7 @@ class IfcOpenShell:
|
|||||||
"""Calculates Model body context geometry using the default IfcOpenShell
|
"""Calculates Model body context geometry using the default IfcOpenShell
|
||||||
iterator on triangulation elements."""
|
iterator on triangulation elements."""
|
||||||
|
|
||||||
functions = {
|
raw_functions = {
|
||||||
# IfcLengthMeasure
|
# IfcLengthMeasure
|
||||||
"get_x": Function("IfcLengthMeasure", "X", "Calculates the length along the local X axis"),
|
"get_x": Function("IfcLengthMeasure", "X", "Calculates the length along the local X axis"),
|
||||||
"get_y": Function("IfcLengthMeasure", "Y", "Calculates the length along the local Y axis"),
|
"get_y": Function("IfcLengthMeasure", "Y", "Calculates the length along the local Y axis"),
|
||||||
@@ -129,6 +129,11 @@ class IfcOpenShell:
|
|||||||
"get_volume": Function("IfcVolumeMeasure", "Volume", "Calculates the volume of a manifold shape"),
|
"get_volume": Function("IfcVolumeMeasure", "Volume", "Calculates the volume of a manifold shape"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
functions = {}
|
||||||
|
for k, v in raw_functions.items():
|
||||||
|
functions[f"gross_{k}"] = Function(v.measure, f"Gross {v.name}", v.description)
|
||||||
|
functions[f"net_{k}"] = Function(v.measure, f"Net {v.name}", v.description)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def calculate(
|
def calculate(
|
||||||
ifc_file: ifcopenshell.file,
|
ifc_file: ifcopenshell.file,
|
||||||
@@ -182,7 +187,7 @@ class IfcOpenShell:
|
|||||||
results[element].setdefault(name, {})
|
results[element].setdefault(name, {})
|
||||||
for quantity, formula in quantities.items():
|
for quantity, formula in quantities.items():
|
||||||
results[element][name][quantity] = unit_converter.convert(
|
results[element][name][quantity] = unit_converter.convert(
|
||||||
formula_functions[formula](shape.geometry), IfcOpenShell.functions[formula].measure
|
formula_functions[formula](shape.geometry), IfcOpenShell.raw_functions[formula].measure
|
||||||
)
|
)
|
||||||
if not iterator.next():
|
if not iterator.next():
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user