From 2f2611e0cb5f76be264a3d5de65f9951b63c2674 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 22 Jan 2021 21:04:30 +1100 Subject: [PATCH] WIP implement most of the document module apart from object references. See #1222. --- .../blenderbim/bim/__init__.py | 15 +- .../blenderbim/bim/import_ifc.py | 89 --------- .../bim/module/document/__init__.py | 27 +++ .../bim/module/document/add_information.py | 15 ++ .../bim/module/document/add_reference.py | 14 ++ .../blenderbim/bim/module/document/data.py | 59 ++++++ .../bim/module/document/edit_information.py | 13 ++ .../bim/module/document/edit_reference.py | 13 ++ .../bim/module/document/operator.py | 186 ++++++++++++++++++ .../blenderbim/bim/module/document/prop.py | 26 +++ .../bim/module/document/remove_document.py | 12 ++ .../blenderbim/bim/module/document/ui.py | 84 ++++++++ .../blenderbim/bim/operator.py | 105 ---------- src/ifcblenderexport/blenderbim/bim/prop.py | 57 ------ src/ifcblenderexport/blenderbim/bim/ui.py | 157 --------------- 15 files changed, 450 insertions(+), 422 deletions(-) create mode 100644 src/ifcblenderexport/blenderbim/bim/module/document/__init__.py create mode 100644 src/ifcblenderexport/blenderbim/bim/module/document/add_information.py create mode 100644 src/ifcblenderexport/blenderbim/bim/module/document/add_reference.py create mode 100644 src/ifcblenderexport/blenderbim/bim/module/document/data.py create mode 100644 src/ifcblenderexport/blenderbim/bim/module/document/edit_information.py create mode 100644 src/ifcblenderexport/blenderbim/bim/module/document/edit_reference.py create mode 100644 src/ifcblenderexport/blenderbim/bim/module/document/operator.py create mode 100644 src/ifcblenderexport/blenderbim/bim/module/document/prop.py create mode 100644 src/ifcblenderexport/blenderbim/bim/module/document/remove_document.py create mode 100644 src/ifcblenderexport/blenderbim/bim/module/document/ui.py diff --git a/src/ifcblenderexport/blenderbim/bim/__init__.py b/src/ifcblenderexport/blenderbim/bim/__init__.py index 897459da2c..6ae99b9efa 100644 --- a/src/ifcblenderexport/blenderbim/bim/__init__.py +++ b/src/ifcblenderexport/blenderbim/bim/__init__.py @@ -21,6 +21,7 @@ if bpy is not None: "diff": None, "bimtester": None, "debug": None, + "document": None, "geometry": None, "georeference": None, "material": None, @@ -74,14 +75,6 @@ if bpy is not None: operator.AssignConstraint, operator.UnassignConstraint, operator.RemoveObjectConstraint, - operator.AddDocumentInformation, - operator.RemoveDocumentInformation, - operator.AssignDocumentInformation, - operator.AddDocumentReference, - operator.RemoveDocumentReference, - operator.AssignDocumentReference, - operator.UnassignDocumentReference, - operator.RemoveObjectDocumentReference, operator.GenerateGlobalId, operator.AddMaterialAttribute, operator.RemoveMaterialAttribute, @@ -177,8 +170,6 @@ if bpy is not None: prop.Variable, prop.PropertySetTemplate, prop.PropertyTemplate, - prop.DocumentInformation, - prop.DocumentReference, prop.ClashSource, prop.ClashSet, prop.SmartClashGroup, @@ -208,7 +199,6 @@ if bpy is not None: ui.BIM_PT_schedules, ui.BIM_PT_sheets, ui.BIM_PT_psets, - ui.BIM_PT_document_information, ui.BIM_PT_constraints, ui.BIM_PT_search, ui.BIM_PT_ifcclash, @@ -217,7 +207,6 @@ if bpy is not None: ui.BIM_PT_patch, ui.BIM_PT_mvd, ui.BIM_PT_presentation_layer_data, - ui.BIM_PT_documents, ui.BIM_PT_constraint_relations, ui.BIM_PT_object_structural, ui.BIM_PT_camera, @@ -232,8 +221,6 @@ if bpy is not None: ui.BIM_UL_clash_sets, ui.BIM_UL_smart_groups, ui.BIM_UL_constraints, - ui.BIM_UL_document_information, - ui.BIM_UL_document_references, ui.BIM_UL_topics, ui.BIM_ADDON_preferences, ] diff --git a/src/ifcblenderexport/blenderbim/bim/import_ifc.py b/src/ifcblenderexport/blenderbim/bim/import_ifc.py index cfb0a7ef27..dc51a948b3 100644 --- a/src/ifcblenderexport/blenderbim/bim/import_ifc.py +++ b/src/ifcblenderexport/blenderbim/bim/import_ifc.py @@ -351,10 +351,6 @@ class IfcImporter: self.profile_code("Create project") self.create_constraints() self.profile_code("Create constraints") - self.create_document_information() - self.profile_code("Create doc info") - self.create_document_references() - self.profile_code("Create doc refs") self.create_spatial_hierarchy() self.profile_code("Create spatial hierarchy") self.create_type_products() @@ -691,7 +687,6 @@ class IfcImporter: obj = bpy.data.objects.new(self.get_name(element), mesh) obj.BIMObjectProperties.ifc_definition_id = element.id() self.material_creator.create(element, obj, mesh) - self.add_element_document_relations(element, obj) self.type_collection.objects.link(obj) self.type_products[element.GlobalId] = obj @@ -811,7 +806,6 @@ class IfcImporter: obj.matrix_world = self.apply_blender_offset_to_matrix(self.get_element_matrix(element)) self.add_element_representation_items(element, obj) - self.add_element_document_relations(element, obj) self.add_opening_relation(element, obj) self.added_data[element.GlobalId] = obj @@ -1266,73 +1260,6 @@ class IfcImporter: if hasattr(element, value) and getattr(element, value): setattr(constraint, key, getattr(element, value)) - def create_document_information(self): - for element in self.file.by_type("IfcDocumentInformation"): - info = bpy.context.scene.BIMProperties.document_information.add() - data_map = { - "name": "Identification", - "human_name": "Name", - "description": "Description", - "location": "Location", - "purpose": "Purpose", - "intended_use": "IntendedUse", - "scope": "Scope", - "revision": "Revision", - "creation_time": "CreationTime", - "last_revision_time": "LastRevisionTime", - "electronic_format": "ElectronicFormat", - "valid_from": "ValidFrom", - "valid_until": "ValidUntil", - "confidentiality": "Confidentiality", - "status": "Status", - } - if self.file.schema == "IFC2X3": - data_map["name"] = "DocumentId" - for key, value in data_map.items(): - if hasattr(element, value) and getattr(element, value): - element_value = getattr(element, value) - if self.file.schema == "IFC2X3" and isinstance(element_value, ifcopenshell.entity_instance): - if element_value.is_a("IfcDateAndTime"): - element_value = self.convert_ifc_date_and_time_to_string(element_value) - elif element_value.is_a("IfcDocumentElectronicFormat"): - element_value = self.convert_ifc_document_electronic_format(element_value) - setattr(info, key, element_value) - - # TODO Maybe a candidate for ifcopenshell.util? - def convert_ifc_date_and_time_to_string(self, element): - return datetime( - element.DateComponent.YearComponent, - element.DateComponent.MonthComponent, - element.DateComponent.DayComponent, - element.TimeComponent.HourComponent, - element.TimeComponent.MinuteComponent if element.TimeComponent.MinuteComponent else 0, - int(element.TimeComponent.SecondComponent) if element.TimeComponent.SecondComponent else 0, - ).isoformat() - - def convert_ifc_document_electronic_format(self, element): - if not element.MimeContentType or not element.MimeSubtype: - return "" - return "{}/{}".format(element.MimeContentType, element.MimeSubtype) - - def create_document_references(self): - for element in self.file.by_type("IfcDocumentReference"): - reference = bpy.context.scene.BIMProperties.document_references.add() - data_map = { - "name": "Identification", - "human_name": "Name", - "location": "Location", - "description": "Description", - } - for key, value in data_map.items(): - if hasattr(element, value) and getattr(element, value): - setattr(reference, key, getattr(element, value)) - if self.file.schema == "IFC2X3": - if element.ReferenceToDocument: - reference.referenced_document = element.ReferenceToDocument[0].DocumentId - else: - if element.ReferencedDocument: - reference.referenced_document = element.ReferencedDocument.Identification - def create_spatial_hierarchy(self): if self.project["ifc"].IsDecomposedBy: for rel_aggregate in self.project["ifc"].IsDecomposedBy: @@ -1388,7 +1315,6 @@ class IfcImporter: obj.users_collection[0].objects.unlink(obj) collection.objects.link(obj) - self.add_element_document_relations(element, obj) self.aggregates[element.GlobalId] = obj self.aggregate_collections[rel_aggregate.id()] = collection @@ -1411,21 +1337,6 @@ class IfcImporter: objects_to_purge.append(obj) bpy.ops.object.delete({"selected_objects": objects_to_purge}) - def add_element_document_relations(self, element, obj): - for association in element.HasAssociations: - if association.is_a("IfcRelAssociatesDocument"): - reference = obj.BIMObjectProperties.document_references.add() - data_map = { - "name": "Identification", - "human_name": "Name", - "description": "Description", - "location": "Location", - } - attributes = {} - for key, value in data_map.items(): - if hasattr(association.RelatingDocument, value) and getattr(association.RelatingDocument, value): - setattr(reference, key, getattr(association.RelatingDocument, value)) - def relate_openings(self): for global_id, opening in self.openings.items(): building_element_global_id = self.file.by_guid(global_id).VoidsElements[0].RelatingBuildingElement.GlobalId diff --git a/src/ifcblenderexport/blenderbim/bim/module/document/__init__.py b/src/ifcblenderexport/blenderbim/bim/module/document/__init__.py new file mode 100644 index 0000000000..c13ff1879a --- /dev/null +++ b/src/ifcblenderexport/blenderbim/bim/module/document/__init__.py @@ -0,0 +1,27 @@ +import bpy +from . import ui, prop, operator + +classes = ( + operator.LoadInformation, + operator.LoadDocumentReferences, + operator.DisableDocumentEditingUI, + operator.EnableEditingDocument, + operator.DisableEditingDocument, + operator.AddInformation, + operator.AddDocumentReference, + operator.EditInformation, + operator.EditDocumentReference, + operator.RemoveDocument, + prop.Document, + prop.BIMDocumentProperties, + ui.BIM_PT_documents, + ui.BIM_UL_documents, +) + + +def register(): + bpy.types.Scene.BIMDocumentProperties = bpy.props.PointerProperty(type=prop.BIMDocumentProperties) + + +def unregister(): + del bpy.types.Scene.BIMDocumentProperties diff --git a/src/ifcblenderexport/blenderbim/bim/module/document/add_information.py b/src/ifcblenderexport/blenderbim/bim/module/document/add_information.py new file mode 100644 index 0000000000..fc1b639695 --- /dev/null +++ b/src/ifcblenderexport/blenderbim/bim/module/document/add_information.py @@ -0,0 +1,15 @@ +import ifcopenshell + +class Usecase: + def __init__(self, file, settings={}): + self.file = file + self.settings = {} + for key, value in settings.items(): + self.settings[key] = value + + def execute(self): + id_attribute = "DocumentId" if self.file.schema == "IFC2X3" else "Identification" + return self.file.create_entity("IfcDocumentInformation", **{ + id_attribute: ifcopenshell.guid.new(), + "Name": "Unnamed" + }) diff --git a/src/ifcblenderexport/blenderbim/bim/module/document/add_reference.py b/src/ifcblenderexport/blenderbim/bim/module/document/add_reference.py new file mode 100644 index 0000000000..7030f4fc32 --- /dev/null +++ b/src/ifcblenderexport/blenderbim/bim/module/document/add_reference.py @@ -0,0 +1,14 @@ +import ifcopenshell + +class Usecase: + def __init__(self, file, settings={}): + self.file = file + self.settings = {} + for key, value in settings.items(): + self.settings[key] = value + + def execute(self): + id_attribute = "ItemReference" if self.file.schema == "IFC2X3" else "Identification" + return self.file.create_entity("IfcDocumentReference", **{ + id_attribute: ifcopenshell.guid.new() + }) diff --git a/src/ifcblenderexport/blenderbim/bim/module/document/data.py b/src/ifcblenderexport/blenderbim/bim/module/document/data.py new file mode 100644 index 0000000000..e618413f4a --- /dev/null +++ b/src/ifcblenderexport/blenderbim/bim/module/document/data.py @@ -0,0 +1,59 @@ +import ifcopenshell +import ifcopenshell.util.date +from blenderbim.bim.ifc import IfcStore +from datetime import datetime + + +class Data: + is_loaded = False + products = {} + references = {} + information = {} + + @classmethod + def load(cls, product_id=None): + cls._file = IfcStore.get_file() + if not cls._file: + return + if product_id: + return cls.load_product(product_id) + cls.load_references() + cls.load_information() + cls.is_loaded = True + + @classmethod + def load_product(cls, product_id): + product = cls._file.by_id(product_id) + cls.products[product_id] = [] + if not product.HasAssociations: + return + for association in product.HasAssociations: + if association.is_a("IfcRelAssociatesDocument"): + cls.products[product_id].append(association.RelatingDocument.id()) + + @classmethod + def load_information(cls): + cls.information = {} + for information in cls._file.by_type("IfcDocumentInformation"): + data = information.get_info() + if cls._file.schema == "IFC2X3": + for attribute in ["CreationTime", "LastRevisionTime", "ValidFrom", "ValidUntil"]: + if data[attribute]: + data[attribute] = ifcopenshell.util.date.ifc2datetime(data[attribute]).isoformat() + if data["ElectronicFormat"]: + data["ElectronicFormat"] = "{}/{}".format( + information.ElectronicFormat.MimeContentType, information.ElectronicFormat.MimeSubtype + ) + cls.information[information.id()] = data + + @classmethod + def load_references(cls): + cls.references = {} + for reference in cls._file.by_type("IfcDocumentReference"): + data = reference.get_info() + if cls._file.schema == "IFC2X3": + if reference.ReferenceToDocument: + data["ReferencedDocument"] = reference.ReferenceToDocument[0].id() + elif reference.ReferencedDocument: + data["ReferencedDocument"] = reference.ReferencedDocument.id() + cls.references[reference.id()] = data diff --git a/src/ifcblenderexport/blenderbim/bim/module/document/edit_information.py b/src/ifcblenderexport/blenderbim/bim/module/document/edit_information.py new file mode 100644 index 0000000000..6071bf5d95 --- /dev/null +++ b/src/ifcblenderexport/blenderbim/bim/module/document/edit_information.py @@ -0,0 +1,13 @@ +class Usecase: + def __init__(self, file, settings=None): + self.file = file + self.settings = { + "information": None, + "attributes": {} + } + for key, value in settings.items(): + self.settings[key] = value + + def execute(self): + for name, value in self.settings["attributes"].items(): + setattr(self.settings["information"], name, value) diff --git a/src/ifcblenderexport/blenderbim/bim/module/document/edit_reference.py b/src/ifcblenderexport/blenderbim/bim/module/document/edit_reference.py new file mode 100644 index 0000000000..b538bafb46 --- /dev/null +++ b/src/ifcblenderexport/blenderbim/bim/module/document/edit_reference.py @@ -0,0 +1,13 @@ +class Usecase: + def __init__(self, file, settings=None): + self.file = file + self.settings = { + "reference": None, + "attributes": {} + } + for key, value in settings.items(): + self.settings[key] = value + + def execute(self): + for name, value in self.settings["attributes"].items(): + setattr(self.settings["reference"], name, value) diff --git a/src/ifcblenderexport/blenderbim/bim/module/document/operator.py b/src/ifcblenderexport/blenderbim/bim/module/document/operator.py new file mode 100644 index 0000000000..1eaa68882b --- /dev/null +++ b/src/ifcblenderexport/blenderbim/bim/module/document/operator.py @@ -0,0 +1,186 @@ +import bpy +import json +import blenderbim.bim.module.document.add_information as add_information +import blenderbim.bim.module.document.add_reference as add_reference +import blenderbim.bim.module.document.edit_information as edit_information +import blenderbim.bim.module.document.edit_reference as edit_reference +import blenderbim.bim.module.document.remove_document as remove_document +from blenderbim.bim.ifc import IfcStore +from blenderbim.bim.module.document.data import Data + + +class LoadInformation(bpy.types.Operator): + bl_idname = "bim.load_information" + bl_label = "Load Information" + + def execute(self, context): + props = context.scene.BIMDocumentProperties + while len(props.documents) > 0: + props.documents.remove(0) + for information_id, information in Data.information.items(): + new = props.documents.add() + new.name = information["Name"] or "Unnamed" + new.identification = information["Identification"] or "*" + new.ifc_definition_id = information_id + props.is_editing = "information" + bpy.ops.bim.disable_editing_document() + return {"FINISHED"} + + +class LoadDocumentReferences(bpy.types.Operator): + bl_idname = "bim.load_document_references" + bl_label = "Load Document References" + + def execute(self, context): + props = context.scene.BIMDocumentProperties + while len(props.documents) > 0: + props.documents.remove(0) + for reference_id, reference in Data.references.items(): + new = props.documents.add() + new.name = reference["Name"] or "Unnamed" + new.identification = reference["Identification"] or "*" + new.ifc_definition_id = reference_id + props.is_editing = "reference" + bpy.ops.bim.disable_editing_document() + return {"FINISHED"} + + +class DisableDocumentEditingUI(bpy.types.Operator): + bl_idname = "bim.disable_document_editing_ui" + bl_label = "Disable Document Editing UI" + + def execute(self, context): + context.scene.BIMDocumentProperties.is_editing = "" + bpy.ops.bim.disable_editing_document() + return {"FINISHED"} + + +class EnableEditingDocument(bpy.types.Operator): + bl_idname = "bim.enable_editing_document" + bl_label = "Enable Editing Document" + document: bpy.props.IntProperty() + + def execute(self, context): + props = context.scene.BIMDocumentProperties + while len(props.document_attributes) > 0: + props.document_attributes.remove(0) + + if props.is_editing == "information": + data = Data.information[self.document] + ifc_class = "IfcDocumentInformation" + elif props.is_editing == "reference": + data = Data.references[self.document] + ifc_class = "IfcDocumentReference" + + for attribute in IfcStore.get_schema().declaration_by_name(ifc_class).all_attributes(): + data_type = str(attribute.type_of_attribute) + if "" in data_type: + new.string_value = "" if new.is_null else data[attribute.name()] + new.data_type = "string" + elif "= 0: - obj.BIMObjectProperties.document_references.remove(index) - return {"FINISHED"} - - -class RemoveObjectDocumentReference(bpy.types.Operator): - bl_idname = "bim.remove_object_document_reference" - bl_label = "Remove Object Document Reference" - index: bpy.props.IntProperty() - - def execute(self, context): - bpy.context.active_object.BIMObjectProperties.document_references.remove(self.index) - return {"FINISHED"} - - class GenerateGlobalId(bpy.types.Operator): bl_idname = "bim.generate_global_id" bl_label = "Regenerate GlobalId" diff --git a/src/ifcblenderexport/blenderbim/bim/prop.py b/src/ifcblenderexport/blenderbim/bim/prop.py index 58da0035d5..a024ef7ae5 100644 --- a/src/ifcblenderexport/blenderbim/bim/prop.py +++ b/src/ifcblenderexport/blenderbim/bim/prop.py @@ -557,57 +557,6 @@ class BIMTextProperties(PropertyGroup): variables: CollectionProperty(name="Variables", type=Variable) -class DocumentInformation(PropertyGroup): - name: StringProperty(name="Identification") - human_name: StringProperty(name="Name") - description: StringProperty(name="Description") - location: StringProperty(name="Location") - purpose: StringProperty(name="Purpose") - intended_use: StringProperty(name="Intended Use") - scope: StringProperty(name="Scope") - revision: StringProperty(name="Revision") - document_owner: StringProperty(name="Owner") - editors: StringProperty(name="Editors") - creation_time: StringProperty(name="Created On") - last_revision_time: StringProperty(name="Last Revised") - electronic_format: StringProperty(name="Format") - valid_from: StringProperty(name="Valid From") - valid_until: StringProperty(name="Valid Until") - confidentiality: EnumProperty( - items=[ - ("NOTDEFINED", "NOTDEFINED", "Not defined."), - ("PUBLIC", "PUBLIC", "Document is publicly available."), - ("RESTRICTED", "RESTRICTED", "Document availability is restricted."), - ( - "CONFIDENTIAL", - "CONFIDENTIAL", - "Document is confidential and its contents should not be revealed without permission.", - ), - ("PERSONAL", "PERSONAL", "Document is personal to the author."), - ("USERDEFINED", "USERDEFINED", "Describe confidentiality elsewhere."), - ], - name="Confidentiality", - ) - status: EnumProperty( - items=[ - ("NOTDEFINED", "NOTDEFINED", "Not defined"), - ("DRAFT", "DRAFT", "Document is a draft."), - ("FINALDRAFT", "FINALDRAFT", "Document is a final draft."), - ("FINAL", "FINAL", "Document is final."), - ("REVISION", "REVISION", "Document has undergone revision."), - ], - name="Status", - ) - - -class DocumentReference(PropertyGroup): - location: StringProperty(name="Location") - name: StringProperty(name="Identification") - human_name: StringProperty(name="Name") - description: StringProperty(name="Description") - referenced_document: StringProperty(name="Referenced Document") - - class ClashSource(PropertyGroup): name: StringProperty(name="File") selector: StringProperty(name="Selector") @@ -975,10 +924,6 @@ class BIMProperties(PropertyGroup): name="Import Filter", ) ifc_selector: StringProperty(default="", name="IFC Selector") - document_information: CollectionProperty(name="Document Information", type=DocumentInformation) - active_document_information_index: IntProperty(name="Active Document Information Index") - document_references: CollectionProperty(name="Document References", type=DocumentReference) - active_document_reference_index: IntProperty(name="Active Document Reference Index") blender_clash_set_a: CollectionProperty(name="Blender Clash Set A", type=StrProperty) blender_clash_set_b: CollectionProperty(name="Blender Clash Set B", type=StrProperty) clash_sets: CollectionProperty(name="Clash Sets", type=ClashSet) @@ -1094,8 +1039,6 @@ class BIMObjectProperties(PropertyGroup): relating_structure: PointerProperty(name="Spatial Container", type=bpy.types.Object) psets: CollectionProperty(name="Psets", type=PsetQto) qtos: CollectionProperty(name="Qtos", type=PsetQto) - document_references: CollectionProperty(name="Document References", type=DocumentReference) - active_document_reference_index: IntProperty(name="Active Document Reference Index") constraints: CollectionProperty(name="Constraints", type=Constraint) active_constraint_index: IntProperty(name="Active Constraint Index") has_boundary_condition: BoolProperty(name="Has Boundary Condition") diff --git a/src/ifcblenderexport/blenderbim/bim/ui.py b/src/ifcblenderexport/blenderbim/bim/ui.py index 8874ed681d..2e94e6b07d 100644 --- a/src/ifcblenderexport/blenderbim/bim/ui.py +++ b/src/ifcblenderexport/blenderbim/bim/ui.py @@ -37,100 +37,6 @@ class BIM_PT_object_structural(Panel): row.prop(props, "structural_member_connection") -class BIM_PT_document_information(Panel): - bl_label = "IFC Documents" - bl_idname = "BIM_PT_document_information" - 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 - props = context.scene.BIMProperties - - row = layout.row() - row.operator("bim.add_document_information") - - if props.document_information: - layout.template_list( - "BIM_UL_document_information", - "", - props, - "document_information", - props, - "active_document_information_index", - ) - - if props.active_document_information_index < len(props.document_information): - information = props.document_information[props.active_document_information_index] - row = layout.row(align=True) - row.prop(information, "name") - row.operator( - "bim.remove_document_information", icon="X", text="" - ).index = props.active_document_information_index - row = layout.row() - row.prop(information, "human_name") - row = layout.row() - row.prop(information, "description") - row = layout.row() - row.prop(information, "location") - row = layout.row() - row.prop(information, "purpose") - row = layout.row() - row.prop(information, "intended_use") - row = layout.row() - row.prop(information, "scope") - row = layout.row() - row.prop(information, "revision") - row = layout.row() - row.prop(information, "creation_time") - row = layout.row() - row.prop(information, "last_revision_time") - row = layout.row() - row.prop(information, "electronic_format") - row = layout.row() - row.prop(information, "valid_from") - row = layout.row() - row.prop(information, "valid_until") - row = layout.row() - row.prop(information, "confidentiality") - row = layout.row() - row.prop(information, "status") - - row = layout.row() - row.operator("bim.add_document_reference") - - if props.document_references: - layout.template_list( - "BIM_UL_document_references", "", props, "document_references", props, "active_document_reference_index" - ) - - if props.active_document_reference_index < len(props.document_references): - reference = props.document_references[props.active_document_reference_index] - row = layout.row(align=True) - row.prop(reference, "name") - row.operator( - "bim.remove_document_reference", icon="X", text="" - ).index = props.active_document_reference_index - row = layout.row() - row.prop(reference, "human_name") - row = layout.row() - row.prop(reference, "location") - row = layout.row() - row.prop(reference, "description") - row = layout.row(align=True) - row.prop(reference, "referenced_document") - row.operator( - "bim.assign_document_information", icon="LINKED", text="" - ).index = props.active_document_reference_index - - row = layout.row(align=True) - row.operator("bim.assign_document_reference", text="Assign Reference") - row.operator("bim.unassign_document_reference", text="Unassign Reference") - - class BIM_PT_constraints(Panel): bl_label = "IFC Constraints" bl_idname = "BIM_PT_constraints" @@ -175,51 +81,6 @@ class BIM_PT_constraints(Panel): row.operator("bim.unassign_constraint", text="Unassign Constraint") -class BIM_PT_documents(Panel): - bl_label = "IFC Documents" - bl_idname = "BIM_PT_documents" - bl_options = {"DEFAULT_CLOSED"} - bl_space_type = "PROPERTIES" - bl_region_type = "WINDOW" - bl_context = "object" - - def draw(self, context): - layout = self.layout - layout.use_property_split = True - props = context.active_object.BIMObjectProperties - - if not props.document_references: - layout.label(text="No documents found") - - row = layout.row() - row.operator("bim.fetch_object_passport") - - if props.document_references: - layout.template_list( - "BIM_UL_document_references", "", props, "document_references", props, "active_document_reference_index" - ) - - if props.active_document_reference_index < len(props.document_references): - reference = props.document_references[props.active_document_reference_index] - row = layout.row(align=True) - row.prop(reference, "name") - if reference.name in bpy.context.scene.BIMProperties.document_references: - reference = bpy.context.scene.BIMProperties.document_references[reference.name] - row.operator( - "bim.remove_object_document_reference", icon="X", text="" - ).index = props.active_document_reference_index - row = layout.row() - row.prop(reference, "human_name") - row = layout.row() - row.prop(reference, "location") - row = layout.row() - row.prop(reference, "description") - row = layout.row() - row.prop(reference, "referenced_document") - else: - layout.label(text="Reference is invalid") - - class BIM_PT_constraint_relations(Panel): bl_label = "IFC Constraints" bl_idname = "BIM_PT_constraint_relations" @@ -911,24 +772,6 @@ class BIM_UL_constraints(bpy.types.UIList): layout.label(text="", translate=False) -class BIM_UL_document_information(bpy.types.UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname): - ob = data - if item: - layout.prop(item, "name", text="", emboss=False) - else: - layout.label(text="", translate=False) - - -class BIM_UL_document_references(bpy.types.UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname): - ob = data - if item: - layout.prop(item, "name", text="", emboss=False) - else: - layout.label(text="", translate=False) - - class BIM_ADDON_preferences(bpy.types.AddonPreferences): bl_idname = "blenderbim" svg2pdf_command: StringProperty(name="SVG to PDF Command", description="E.g. [['inkscape', svg, '-o', pdf]]")