Preventing edge case (vertical slabs & horizontal walls)

This commit is contained in:
carlos
2022-06-29 17:37:42 +02:00
parent 3461a1e96f
commit 662cd6232c
2 changed files with 36 additions and 2 deletions
@@ -166,7 +166,7 @@ def calculate_quantities(usecase_path, ifc_file, settings):
obj = settings["blender_object"]
product = ifc_file.by_id(obj.BIMObjectProperties.ifc_definition_id)
parametric = ifcopenshell.util.element.get_psets(product).get("EPset_Parametric")
if not parametric or parametric["Engine"] != "BlenderBIM.DumbLayer3":
if not parametric or "Engine" not in parametric or parametric["Engine"] != "BlenderBIM.DumbLayer3":
return
qto = ifcopenshell.api.run(
"pset.add_qto", ifc_file, should_run_listeners=False, product=product, name="Qto_SlabBaseQuantities"
@@ -342,6 +342,23 @@ class DumbSlabPlaner:
return
new_thickness = sum([l.LayerThickness for l in new_material.MaterialLayers])
material = ifcopenshell.util.element.get_material(settings["related_object"])
relating_type = settings["relating_type"]
if hasattr(relating_type, "HasPropertySets"):
psets = relating_type.HasPropertySets
if psets is not None:
for pset in psets:
if hasattr(pset, "HasProperties"):
pset_props = pset.HasProperties
if pset_props is not None:
for prop in pset_props:
if prop.Name == "LayerSetDirection":
if hasattr(prop, "NominalValue"):
nominal_value = prop.NominalValue
if hasattr(nominal_value, "wrappedValue"):
if nominal_value.wrappedValue == "AXIS2":
return
if material and material.is_a("IfcMaterialLayerSetUsage") and material.LayerSetDirection == "AXIS3":
self.change_thickness(settings["related_object"], new_thickness)
@@ -861,7 +861,7 @@ def calculate_quantities(usecase_path, ifc_file, settings):
obj = settings["blender_object"]
product = ifc_file.by_id(obj.BIMObjectProperties.ifc_definition_id)
parametric = ifcopenshell.util.element.get_psets(product).get("EPset_Parametric")
if not parametric or parametric["Engine"] != "BlenderBIM.DumbLayer2":
if not parametric or "Engine" not in parametric or parametric["Engine"] != "BlenderBIM.DumbLayer2":
return
qto = ifcopenshell.api.run(
"pset.add_qto", ifc_file, should_run_listeners=False, product=product, name="Qto_WallBaseQuantities"
@@ -941,6 +941,23 @@ class DumbWallPlaner:
return
new_thickness = sum([l.LayerThickness for l in new_material.MaterialLayers])
material = ifcopenshell.util.element.get_material(settings["related_object"])
relating_type = settings["relating_type"]
if hasattr(relating_type, "HasPropertySets"):
psets = relating_type.HasPropertySets
if psets is not None:
for pset in psets:
if hasattr(pset, "HasProperties"):
pset_props = pset.HasProperties
if pset_props is not None:
for prop in pset_props:
if prop.Name == "LayerSetDirection":
if hasattr(prop, "NominalValue"):
nominal_value = prop.NominalValue
if hasattr(nominal_value, "wrappedValue"):
if nominal_value.wrappedValue == "AXIS3":
return
if material and material.is_a("IfcMaterialLayerSetUsage") and material.LayerSetDirection == "AXIS2":
self.change_thickness(settings["related_object"], new_thickness)