This commit is contained in:
Andrej730
2024-09-11 18:34:56 +05:00
parent 2168b3b7bd
commit aa97ff7f16
6 changed files with 10 additions and 8 deletions
@@ -18,6 +18,7 @@
import bpy
import ifcopenshell.api
import ifcopenshell.util.element
import bonsai.bim.helper
import bonsai.tool as tool
import bonsai.bim.module.model.profile as model_profile
@@ -34,6 +34,7 @@ import bonsai.tool as tool
import bonsai.core.geometry
import ifcopenshell
import ifcopenshell.util.element
import ifcopenshell.util.unit
def get_subelement_class(self, context):
+1 -1
View File
@@ -803,7 +803,7 @@ class Blender(bonsai.core.tool.Blender):
return collections_mapping
@classmethod
def is_editable(cls, obj):
def is_editable(cls, obj: bpy.types.Object) -> bool:
if obj.type not in cls.OBJECT_TYPES_THAT_SUPPORT_EDIT_MODE:
return False
if not (element := tool.Ifc.get_entity(obj)):
-1
View File
@@ -327,4 +327,3 @@ class Pset(bonsai.core.tool.Pset):
return value
except:
return value
return value
@@ -102,9 +102,10 @@ def calculate_cost_item_resource_value(file: ifcopenshell.file, cost_item: ifcop
for resource in resources:
cost, unit = ifcopenshell.util.resource.get_cost(resource)
if not cost:
cost, unit = ifcopenshell.util.resource.get_parent_cost(
resource
) # Concept to standardise - Not defined in schema, but this makes manual scheduling of resources 10x faster and less duplicate data.
# Concept to standardise - Not defined in schema, but this makes manual scheduling of resources 10x faster and less duplicate data.
parent_cost = ifcopenshell.util.resource.get_parent_cost(resource)
assert parent_cost
cost, unit = parent_cost
quantity = ifcopenshell.util.resource.get_quantity(resource)
if not cost or not quantity:
continue
@@ -166,9 +166,9 @@ def get_quantity(resource: ifcopenshell.entity_instance) -> float:
return duration.total_seconds() / 3600
def get_parent_cost(resource: ifcopenshell.entity_instance) -> Union[None, tuple[float, Union[str, None]]]:
if not resource.Nests:
def get_parent_cost(resource: ifcopenshell.entity_instance) -> Union[tuple[float, Union[str, None]], None]:
if not (nests := resource.Nests):
return
else:
cost = get_cost(resource.Nests[0].RelatingObject)
cost = get_cost(nests[0].RelatingObject)
return cost