From 63ac1fe62693a15c4a74ea81b31f39665d16ce6a Mon Sep 17 00:00:00 2001 From: Petru Conduraru Date: Tue, 21 Jul 2026 09:33:07 +0300 Subject: [PATCH] Bonsai: don't write IFC4.3-deprecated IfcStairFlight attributes buildingSMART's IFC4.3 ADD2 validation service flags NumberOfRisers, NumberOfTreads, RiserHeight and TreadLength on IfcStairFlight as deprecated (rule IFC102). The attributes still exist in the schema (they're optional, not removed), so writing them is schema-valid but trips that validation rule. The equivalent data already lives in Pset_StairFlightCommon, which the stair tool writes regardless of schema, so nothing is lost by leaving them unset for IFC4.3. IFC2X3 and IFC4 still get the direct attributes written as before, since they aren't deprecated there. This file was modified with the assistance of an AI coding tool. --- src/bonsai/bonsai/bim/module/model/stair.py | 22 +++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/model/stair.py b/src/bonsai/bonsai/bim/module/model/stair.py index 70295d6e72..7e71933261 100644 --- a/src/bonsai/bonsai/bim/module/model/stair.py +++ b/src/bonsai/bonsai/bim/module/model/stair.py @@ -98,8 +98,6 @@ def update_ifc_stair_props(obj: bpy.types.Object) -> None: if tool.Ifc.get_schema() != "IFC2X3" and element.is_a("IfcStairFlight"): element.PredefinedType = "STRAIGHT" number_of_risers = props.number_of_treads + 1 - # update IfcStairFlight properties (seems already deprecated but keep it for now) - # http://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/lexical/IfcStairFlight.htm si_conversion = ifcopenshell.util.unit.calculate_unit_scale(ifc_file) riser_height = props.height / number_of_risers / si_conversion @@ -107,14 +105,22 @@ def update_ifc_stair_props(obj: bpy.types.Object) -> None: nosing_length = props.nosing_length / si_conversion if element.is_a("IfcStairFlight"): - if tool.Ifc.get_schema() == "IFC2X3": - element.NumberOfRiser = number_of_risers + # NumberOfRisers/NumberOfTreads/RiserHeight/TreadLength are deprecated + # in IFC4.3 in favour of Pset_StairFlightCommon, which is set below. + if tool.Ifc.get_schema() == "IFC4X3": + element.NumberOfRisers = None + element.NumberOfTreads = None + element.RiserHeight = None + element.TreadLength = None else: - element.NumberOfRisers = number_of_risers + if tool.Ifc.get_schema() == "IFC2X3": + element.NumberOfRiser = number_of_risers + else: + element.NumberOfRisers = number_of_risers - element.NumberOfTreads = props.number_of_treads - element.RiserHeight = riser_height - element.TreadLength = tread_length + element.NumberOfTreads = props.number_of_treads + element.RiserHeight = riser_height + element.TreadLength = tread_length # update pset with ifc properties pset_common = tool.Pset.get_element_pset(element, "Pset_StairFlightCommon")