From a53017d9dcf6432ac9c2b905efaa92a31b4c890a Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 5 Sep 2025 17:40:35 +0500 Subject: [PATCH] Fix error editing IfcClassification without provided ReferenceTokens after e3ea12a #7091 Actually after 2ec2ac0 there's no need for json serialization as we support working with string subitems natively. For some reason previously it was using get_georeference_props to add attributes, I guess it a typo that happened awhile ago. --- .../bim/module/classification/operator.py | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/classification/operator.py b/src/bonsai/bonsai/bim/module/classification/operator.py index 8ab195ebd1..600b86a3d5 100644 --- a/src/bonsai/bonsai/bim/module/classification/operator.py +++ b/src/bonsai/bonsai/bim/module/classification/operator.py @@ -17,7 +17,6 @@ # along with Bonsai. If not, see . import bpy -import json import ifcopenshell import ifcopenshell.api import ifcopenshell.api.pset @@ -192,21 +191,11 @@ class EnableEditingClassification(bpy.types.Operator): classification: bpy.props.IntProperty() def execute(self, context): - def callback(name, prop, data): - if name == "ReferenceTokens": - geo_props = tool.Georeference.get_georeference_props() - new = geo_props.projected_crs.add() - new.name = name - new.data_type = "string" - new.is_null = data[name] is None - new.is_optional = True - new.string_value = "" if new.is_null else json.dumps(data[name]) - return True - props = tool.Classification.get_classification_props() props.classification_attributes.clear() bonsai.bim.helper.import_attributes( - tool.Ifc.get().by_id(self.classification), props.classification_attributes, callback + tool.Ifc.get().by_id(self.classification), + props.classification_attributes, ) props.active_classification_id = self.classification return {"FINISHED"} @@ -248,13 +237,7 @@ class EditClassification(bpy.types.Operator, tool.Ifc.Operator): def _execute(self, context): props = tool.Classification.get_classification_props() - - def callback(attributes, prop): - if prop.name == "ReferenceTokens": - attributes[prop.name] = json.loads(prop.string_value) - return True - - attributes = bonsai.bim.helper.export_attributes(props.classification_attributes, callback=callback) + attributes = bonsai.bim.helper.export_attributes(props.classification_attributes) ifc_file = tool.Ifc.get() ifcopenshell.api.classification.edit_classification( ifc_file,