diff --git a/src/ifcblenderexport/blenderbim/bim/__init__.py b/src/ifcblenderexport/blenderbim/bim/__init__.py index 7c01f4716c..70ac59e636 100644 --- a/src/ifcblenderexport/blenderbim/bim/__init__.py +++ b/src/ifcblenderexport/blenderbim/bim/__init__.py @@ -253,7 +253,6 @@ if bpy is not None: ui.BIM_PT_search, ui.BIM_PT_ifccsv, ui.BIM_PT_ifcclash, - ui.BIM_PT_owner, ui.BIM_PT_qa, ui.BIM_PT_library, ui.BIM_PT_gis, diff --git a/src/ifcblenderexport/blenderbim/bim/module/owner/__init__.py b/src/ifcblenderexport/blenderbim/bim/module/owner/__init__.py index 1d34ad95ef..a83187dbf1 100644 --- a/src/ifcblenderexport/blenderbim/bim/module/owner/__init__.py +++ b/src/ifcblenderexport/blenderbim/bim/module/owner/__init__.py @@ -24,6 +24,7 @@ classes = ( operator.RemoveAddress, ui.BIM_PT_people, ui.BIM_PT_organisations, + ui.BIM_PT_owner, ) diff --git a/src/ifcblenderexport/blenderbim/bim/module/owner/add_organisation.py b/src/ifcblenderexport/blenderbim/bim/module/owner/add_organisation.py index ebb0405d85..d9c8cd2a65 100644 --- a/src/ifcblenderexport/blenderbim/bim/module/owner/add_organisation.py +++ b/src/ifcblenderexport/blenderbim/bim/module/owner/add_organisation.py @@ -3,4 +3,4 @@ class Usecase: self.file = file def execute(self): - self.file.createIfcOrganization("APTR", "Apeture Science") + self.file.createIfcOrganization("APTR", "Aperture Science") diff --git a/src/ifcblenderexport/blenderbim/bim/module/owner/ui.py b/src/ifcblenderexport/blenderbim/bim/module/owner/ui.py index 8ce7a93d0f..c192326223 100644 --- a/src/ifcblenderexport/blenderbim/bim/module/owner/ui.py +++ b/src/ifcblenderexport/blenderbim/bim/module/owner/ui.py @@ -197,3 +197,35 @@ class BIM_PT_organisations(Panel): row.operator("bim.enable_editing_organisation", icon="GREASEPENCIL", text="").organisation_id = organisation_id if not organisation["is_engaged"]: row.operator("bim.remove_organisation", icon="X", text="").organisation_id = organisation_id + + +class BIM_PT_owner(Panel): + bl_label = "IFC Owner History" + bl_idname = "BIM_PT_owner" + bl_options = {"DEFAULT_CLOSED"} + bl_space_type = "PROPERTIES" + bl_region_type = "WINDOW" + bl_context = "scene" + + @classmethod + def poll(cls, context): + return IfcStore.get_file() + + def draw(self, context): + if not Data.is_loaded: + Data.load() + + self.layout.use_property_split = True + props = context.scene.BIMProperties + + if not Data.people: + self.layout.label(text="No people found.") + else: + row = self.layout.row() + row.prop(props, "user_person") + + if not Data.organisations: + self.layout.label(text="No organisations found.") + else: + row = self.layout.row() + row.prop(props, "user_organisation") diff --git a/src/ifcblenderexport/blenderbim/bim/prop.py b/src/ifcblenderexport/blenderbim/bim/prop.py index b5f9f2ca93..8f8806a1f2 100644 --- a/src/ifcblenderexport/blenderbim/bim/prop.py +++ b/src/ifcblenderexport/blenderbim/bim/prop.py @@ -47,8 +47,6 @@ materialtypes_enum = [] contexts_enum = [] subcontexts_enum = [] target_views_enum = [] -persons_enum = [] -organisations_enum = [] sheets_enum = [] vector_styles_enum = [] @@ -298,17 +296,27 @@ def getProfileDef(self, context): def getPersons(self, context): - global persons_enum - persons_enum.clear() - persons_enum.extend([(p.name, p.name, "") for p in bpy.context.scene.BIMProperties.people]) - return persons_enum + from blenderbim.bim.module.owner.data import Data + if not Data.is_loaded: + Data.load() + results = [] + for ifc_id, person in Data.people.items(): + if "Id" in person: + identifier = person["Id"] or "" + else: + identifier = person["Identifier"] or "" + results.append((str(ifc_id), identifier, "")) + return results def getOrganisations(self, context): - global organisations_enum - organisations_enum.clear() - organisations_enum.extend([(o.name, o.name, "") for o in bpy.context.scene.BIMProperties.organisations]) - return organisations_enum + from blenderbim.bim.module.owner.data import Data + if not Data.is_loaded: + Data.load() + results = [] + for ifc_id, organisation in Data.organisations.items(): + results.append((str(ifc_id), organisation["Name"], "")) + return results def getIfcPatchRecipes(self, context): @@ -1282,8 +1290,6 @@ class BIMProperties(PropertyGroup): import_should_offset_model: BoolProperty(name="Import and Offset Model", default=False) import_model_offset_coordinates: StringProperty(name="Model Offset Coordinates", default="0,0,0") qa_reject_element_reason: StringProperty(name="Element Rejection Reason") - people: CollectionProperty(name="People", type=Person) - organisations: CollectionProperty(name="Organisations", type=Organisation) person: PointerProperty(type=Person) active_person_id: IntProperty(name="Active Person Id") @@ -1293,6 +1299,8 @@ class BIMProperties(PropertyGroup): active_role_id: IntProperty(name="Active Role Id") address: PointerProperty(type=Address) active_address_id: IntProperty(name="Active Address Id") + user_person: EnumProperty(items=getPersons, name="Person") + user_organisation: EnumProperty(items=getOrganisations, name="Organisation") has_georeferencing: BoolProperty(name="Has Georeferencing", default=False) has_library: BoolProperty(name="Has Project Library", default=False) diff --git a/src/ifcblenderexport/blenderbim/bim/ui.py b/src/ifcblenderexport/blenderbim/bim/ui.py index 0452ccf108..9cc4157c53 100644 --- a/src/ifcblenderexport/blenderbim/bim/ui.py +++ b/src/ifcblenderexport/blenderbim/bim/ui.py @@ -1030,34 +1030,6 @@ class BIM_PT_text(Panel): row.prop(variable, "prop_key") -class BIM_PT_owner(Panel): - bl_label = "IFC Owner History" - bl_idname = "BIM_PT_owner" - bl_options = {"DEFAULT_CLOSED"} - bl_space_type = "PROPERTIES" - bl_region_type = "WINDOW" - bl_context = "scene" - - def draw(self, context): - layout = self.layout - layout.use_property_split = True - - scene = context.scene - props = scene.BIMProperties - - if not props.person: - layout.label(text="No people found.") - else: - row = layout.row() - row.prop(props, "person") - - if not props.organisation: - layout.label(text="No organisations found.") - else: - row = layout.row() - row.prop(props, "organisation") - - class BIM_PT_bim(Panel): bl_label = "Building Information Modeling" bl_idname = "BIM_PT_bim"