From 0bc86631a523b677a959fd390bd51dff112ed8a7 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Thu, 25 Mar 2021 20:19:48 +1100 Subject: [PATCH] Minor fixes after the refactor mess --- src/ifcblenderexport/Makefile | 1 + .../blenderbim/bim/module/structural/operator.py | 4 +++- src/ifcblenderexport/blenderbim/bim/module/structural/ui.py | 2 +- src/ifcopenshell-python/ifcopenshell/util/attribute.py | 6 +++--- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ifcblenderexport/Makefile b/src/ifcblenderexport/Makefile index 857b535525..a23ade34a4 100644 --- a/src/ifcblenderexport/Makefile +++ b/src/ifcblenderexport/Makefile @@ -142,6 +142,7 @@ endif cd dist/working && unzip v0.6.0.zip # IfcOpenBot sometimes lags behind, so we hotfix the Python utilities cp -r dist/working/IfcOpenShell-0.6.0/src/ifcopenshell-python/ifcopenshell/util/* dist/blenderbim/libs/site/packages/ifcopenshell/util/ + cp -r dist/working/IfcOpenShell-0.6.0/src/ifcopenshell-python/ifcopenshell/api dist/blenderbim/libs/site/packages/ifcopenshell/api # Provides bcf functionality cp -r dist/working/IfcOpenShell-0.6.0/src/bcf/bcf dist/blenderbim/libs/site/packages/ # Provides IFCClash functionality diff --git a/src/ifcblenderexport/blenderbim/bim/module/structural/operator.py b/src/ifcblenderexport/blenderbim/bim/module/structural/operator.py index f4e2cc3457..baf68da2e6 100644 --- a/src/ifcblenderexport/blenderbim/bim/module/structural/operator.py +++ b/src/ifcblenderexport/blenderbim/bim/module/structural/operator.py @@ -1,5 +1,6 @@ import bpy import json +import ifcopenshell import ifcopenshell.api.structural.add_structural_boundary_condition as add_structural_boundary_condition import ifcopenshell.api.structural.edit_structural_boundary_condition as edit_structural_boundary_condition import ifcopenshell.api.structural.remove_structural_boundary_condition as remove_structural_boundary_condition @@ -59,7 +60,7 @@ class EnableEditingStructuralBoundaryCondition(bpy.types.Operator): new.is_null = value is None new.is_optional = attribute.optional() if data_type == "select": - enum_items = [s.name() for s in ifcopenshell.get_select_items(attribute)] + enum_items = [s.name() for s in ifcopenshell.util.attribute.get_select_items(attribute)] new.enum_items = json.dumps(enum_items) if isinstance(value, bool): new.bool_value = False if new.is_null else data[attribute.name()] @@ -71,6 +72,7 @@ class EnableEditingStructuralBoundaryCondition(bpy.types.Operator): new.enum_value = [i for i in enum_items if i != "IfcBoolean"][0] elif data_type == "string": new.string_value = "" if new.is_null else data[attribute.name()] + new.data_type = "string" props.is_editing_boundary_condition = True return {"FINISHED"} diff --git a/src/ifcblenderexport/blenderbim/bim/module/structural/ui.py b/src/ifcblenderexport/blenderbim/bim/module/structural/ui.py index 9c4430ee66..006f0ff168 100644 --- a/src/ifcblenderexport/blenderbim/bim/module/structural/ui.py +++ b/src/ifcblenderexport/blenderbim/bim/module/structural/ui.py @@ -49,7 +49,7 @@ class BIM_PT_structural_boundary_conditions(Panel): self.draw_read_only_ui(context) def draw_editable_ui(self, context): - for attribute in self.props.connection_attributes: + for attribute in self.props.boundary_condition_attributes: if attribute.data_type == "string": row = self.layout.row() row.prop(attribute, "string_value", text=attribute["name"]) diff --git a/src/ifcopenshell-python/ifcopenshell/util/attribute.py b/src/ifcopenshell-python/ifcopenshell/util/attribute.py index 35d61c7b0a..5e56c62f2f 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/attribute.py +++ b/src/ifcopenshell-python/ifcopenshell/util/attribute.py @@ -3,7 +3,9 @@ def get_primitive_type(attribute_or_data_type): data_type = str(attribute_or_data_type.type_of_attribute()) else: data_type = str(attribute_or_data_type) - if "