2021-08-17 08:55:29 +10:00
|
|
|
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
|
|
|
|
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
|
|
|
|
|
#
|
|
|
|
|
# This file is part of BlenderBIM Add-on.
|
|
|
|
|
#
|
|
|
|
|
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
2021-01-20 16:53:34 +11:00
|
|
|
import os
|
2023-07-10 17:16:20 +10:00
|
|
|
import blenderbim.bim
|
2022-07-06 12:09:37 +02:00
|
|
|
from blenderbim.bim.helper import prop_with_search
|
2023-07-08 14:39:39 +10:00
|
|
|
from bpy.types import Panel, Menu, UIList
|
2021-01-05 21:15:52 +11:00
|
|
|
from blenderbim.bim.ifc import IfcStore
|
2022-01-10 10:45:46 +11:00
|
|
|
from blenderbim.bim.module.project.data import ProjectData
|
2021-01-05 21:15:52 +11:00
|
|
|
|
|
|
|
|
|
2023-07-08 14:39:39 +10:00
|
|
|
class BIM_MT_project(Menu):
|
|
|
|
|
bl_idname = "BIM_MT_project"
|
|
|
|
|
bl_label = "New IFC Project"
|
|
|
|
|
|
|
|
|
|
def draw(self, context):
|
2023-07-10 17:16:20 +10:00
|
|
|
self.layout.operator("bim.new_project", text="New Metric (m) Project").preset = "metric_m"
|
|
|
|
|
self.layout.operator("bim.new_project", text="New Metric (mm) Project").preset = "metric_mm"
|
|
|
|
|
self.layout.operator("bim.new_project", text="New Imperial (ft) Project").preset = "imperial_ft"
|
|
|
|
|
self.layout.operator("bim.new_project", text="New Demo Project").preset = "demo"
|
|
|
|
|
self.layout.operator("bim.new_project", text="New Project Wizard").preset = "wizard"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BIM_MT_new_project(Menu):
|
|
|
|
|
bl_idname = "BIM_MT_new_project"
|
|
|
|
|
bl_label = "New Project"
|
|
|
|
|
|
|
|
|
|
def draw(self, context):
|
2023-07-14 13:40:09 +10:00
|
|
|
self.layout.operator_context = "INVOKE_DEFAULT"
|
|
|
|
|
op = self.layout.operator("bim.load_project", text="Open IFC Project", icon="FILEBROWSER")
|
|
|
|
|
op.should_start_fresh_session = True
|
|
|
|
|
# Do we need to set it back to exec default?
|
|
|
|
|
# self.layout.operator_context = "EXEC_DEFAULT"
|
|
|
|
|
self.layout.separator()
|
2023-07-10 17:16:20 +10:00
|
|
|
self.layout.label(text="New IFC Project", icon_value=blenderbim.bim.icons["IFC"].icon_id)
|
|
|
|
|
self.layout.operator("bim.new_project", text="Metric (m) Project").preset = "metric_m"
|
|
|
|
|
self.layout.operator("bim.new_project", text="Metric (mm) Project").preset = "metric_mm"
|
|
|
|
|
self.layout.operator("bim.new_project", text="Imperial (ft) Project").preset = "imperial_ft"
|
|
|
|
|
self.layout.operator("bim.new_project", text="Demo Project").preset = "demo"
|
|
|
|
|
self.layout.operator("bim.new_project", text="Project Wizard").preset = "wizard"
|
|
|
|
|
self.layout.separator()
|
|
|
|
|
self.layout.label(text="New Blender Project", icon="BLENDER")
|
|
|
|
|
# In theory we can dynamically grab the list from list(bpy.utils.app_template_paths())
|
|
|
|
|
self.layout.operator("wm.read_homefile", text="General Project").app_template = ""
|
|
|
|
|
self.layout.operator("wm.read_homefile", text="2D Animation Project").app_template = "2D_Animation"
|
|
|
|
|
self.layout.operator("wm.read_homefile", text="Sculpting Project").app_template = "Sculpting"
|
|
|
|
|
self.layout.operator("wm.read_homefile", text="VFX Project").app_template = "VFX"
|
|
|
|
|
self.layout.operator("wm.read_homefile", text="Video Editing Project").app_template = "Video_Editing"
|
2023-07-08 14:39:39 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def file_menu(self, context):
|
|
|
|
|
self.layout.menu("BIM_MT_project", icon="COLLECTION_NEW")
|
|
|
|
|
op = self.layout.operator("bim.load_project", text="Open IFC Project", icon="FILEBROWSER")
|
|
|
|
|
op.should_start_fresh_session = True
|
|
|
|
|
self.layout.separator()
|
|
|
|
|
op = self.layout.operator("export_ifc.bim", icon="FILE_TICK", text="Save IFC Project")
|
|
|
|
|
op.should_save_as = False
|
|
|
|
|
op = self.layout.operator("export_ifc.bim", text="Save IFC Project As...")
|
|
|
|
|
op.should_save_as = True
|
|
|
|
|
self.layout.separator()
|
|
|
|
|
|
|
|
|
|
|
2021-01-05 21:15:52 +11:00
|
|
|
class BIM_PT_project(Panel):
|
2023-07-15 21:02:30 +10:00
|
|
|
bl_label = "Current Project"
|
2021-01-05 21:15:52 +11:00
|
|
|
bl_idname = "BIM_PT_project"
|
|
|
|
|
bl_space_type = "PROPERTIES"
|
|
|
|
|
bl_region_type = "WINDOW"
|
|
|
|
|
bl_context = "scene"
|
2023-07-22 23:09:48 +10:00
|
|
|
bl_options = {"HIDE_HEADER"}
|
2022-01-28 10:48:22 +11:00
|
|
|
bl_parent_id = "BIM_PT_project_info"
|
2021-01-05 21:15:52 +11:00
|
|
|
|
|
|
|
|
def draw(self, context):
|
2022-01-10 10:45:46 +11:00
|
|
|
if not ProjectData.is_loaded:
|
|
|
|
|
ProjectData.load()
|
|
|
|
|
|
2021-01-05 21:15:52 +11:00
|
|
|
self.layout.use_property_decorate = False
|
|
|
|
|
self.layout.use_property_split = True
|
2021-02-03 19:15:25 +11:00
|
|
|
props = context.scene.BIMProperties
|
2021-09-11 20:29:14 +10:00
|
|
|
pprops = context.scene.BIMProjectProperties
|
2021-01-05 21:15:52 +11:00
|
|
|
self.file = IfcStore.get_file()
|
2021-09-11 20:29:14 +10:00
|
|
|
if pprops.is_loading:
|
|
|
|
|
self.draw_load_ui(context)
|
|
|
|
|
elif self.file or props.ifc_file:
|
2021-01-20 16:53:34 +11:00
|
|
|
self.draw_project_ui(context)
|
2021-01-05 21:15:52 +11:00
|
|
|
else:
|
2021-01-20 16:53:34 +11:00
|
|
|
self.draw_create_project_ui(context)
|
|
|
|
|
|
2021-09-11 20:29:14 +10:00
|
|
|
def draw_load_ui(self, context):
|
|
|
|
|
pprops = context.scene.BIMProjectProperties
|
2022-07-03 22:37:41 +02:00
|
|
|
prop_with_search(self.layout, pprops, "collection_mode")
|
|
|
|
|
prop_with_search(self.layout, pprops, "filter_mode")
|
2022-06-08 11:32:00 +10:00
|
|
|
if pprops.filter_mode in ["DECOMPOSITION", "IFC_CLASS", "IFC_TYPE"]:
|
2022-06-08 09:09:35 +10:00
|
|
|
row = self.layout.row(align=True)
|
2022-06-08 11:53:58 +10:00
|
|
|
row.label(text=f"Total: {pprops.total_elements}")
|
2022-06-08 09:09:35 +10:00
|
|
|
row.operator("bim.toggle_filter_categories", text="", icon="CHECKBOX_HLT").should_select = True
|
|
|
|
|
row.operator("bim.toggle_filter_categories", text="", icon="CHECKBOX_DEHLT").should_select = False
|
2021-09-12 15:25:03 +10:00
|
|
|
self.layout.template_list(
|
|
|
|
|
"BIM_UL_filter_categories",
|
|
|
|
|
"",
|
|
|
|
|
pprops,
|
|
|
|
|
"filter_categories",
|
|
|
|
|
pprops,
|
|
|
|
|
"active_filter_category_index",
|
|
|
|
|
)
|
2021-09-12 19:19:53 +10:00
|
|
|
elif pprops.filter_mode in ["WHITELIST", "BLACKLIST"]:
|
|
|
|
|
row = self.layout.row()
|
|
|
|
|
row.prop(pprops, "filter_query")
|
2021-10-15 13:16:26 +11:00
|
|
|
if pprops.filter_mode != "NONE":
|
|
|
|
|
row = self.layout.row()
|
|
|
|
|
row.prop(pprops, "should_filter_spatial_elements")
|
2021-09-12 19:19:53 +10:00
|
|
|
row = self.layout.row()
|
|
|
|
|
row.prop(pprops, "should_use_cpu_multiprocessing")
|
|
|
|
|
row = self.layout.row()
|
2022-06-08 12:09:19 +10:00
|
|
|
row.prop(pprops, "should_clean_mesh")
|
2021-09-12 19:19:53 +10:00
|
|
|
row = self.layout.row()
|
2022-06-08 11:56:22 +10:00
|
|
|
row.prop(pprops, "should_cache")
|
2021-09-12 19:19:53 +10:00
|
|
|
row = self.layout.row()
|
2023-06-26 17:13:34 +10:00
|
|
|
row.prop(pprops, "should_load_geometry")
|
|
|
|
|
row = self.layout.row()
|
2022-06-08 10:19:55 +10:00
|
|
|
row.prop(pprops, "should_use_native_meshes")
|
2022-06-08 12:09:19 +10:00
|
|
|
row = self.layout.row()
|
2021-09-12 19:19:53 +10:00
|
|
|
row.prop(pprops, "should_merge_materials_by_colour")
|
|
|
|
|
row = self.layout.row()
|
2022-06-08 12:06:59 +10:00
|
|
|
row.prop(pprops, "is_coordinating")
|
2022-06-08 12:09:19 +10:00
|
|
|
if pprops.is_coordinating:
|
2022-07-03 22:37:41 +02:00
|
|
|
prop_with_search(self.layout, pprops, "merge_mode")
|
2021-09-12 19:19:53 +10:00
|
|
|
row = self.layout.row()
|
|
|
|
|
row.prop(pprops, "deflection_tolerance")
|
|
|
|
|
row = self.layout.row()
|
|
|
|
|
row.prop(pprops, "angular_tolerance")
|
|
|
|
|
row = self.layout.row()
|
2022-06-01 14:25:30 +10:00
|
|
|
row.prop(pprops, "distance_limit")
|
2021-09-12 19:19:53 +10:00
|
|
|
row = self.layout.row()
|
2022-06-01 14:25:30 +10:00
|
|
|
row.prop(pprops, "false_origin")
|
2021-09-12 19:19:53 +10:00
|
|
|
|
2022-06-08 11:53:58 +10:00
|
|
|
row = self.layout.row()
|
|
|
|
|
row.label(text="Element Range")
|
|
|
|
|
row = self.layout.row(align=True)
|
|
|
|
|
row.prop(pprops, "element_offset", text="")
|
|
|
|
|
row.prop(pprops, "element_limit", text="")
|
|
|
|
|
|
2021-09-12 15:42:59 +10:00
|
|
|
row = self.layout.row(align=True)
|
2021-09-12 15:25:03 +10:00
|
|
|
row.operator("bim.load_project_elements")
|
2021-09-12 15:42:59 +10:00
|
|
|
row.operator("bim.unload_project", text="", icon="CANCEL")
|
2021-09-11 20:29:14 +10:00
|
|
|
|
2021-01-20 16:53:34 +11:00
|
|
|
def draw_project_ui(self, context):
|
|
|
|
|
props = context.scene.BIMProperties
|
2021-03-14 20:38:13 +11:00
|
|
|
pprops = context.scene.BIMProjectProperties
|
2021-01-20 16:53:34 +11:00
|
|
|
row = self.layout.row(align=True)
|
2022-02-03 21:29:44 +11:00
|
|
|
row.label(text=os.path.basename(props.ifc_file) or "No File Found", icon="FILE")
|
2021-01-20 16:53:34 +11:00
|
|
|
|
2021-02-03 19:15:25 +11:00
|
|
|
if IfcStore.get_file():
|
2021-05-28 09:50:55 +10:00
|
|
|
if pprops.is_editing:
|
|
|
|
|
row.operator("bim.edit_header", icon="CHECKMARK", text="")
|
|
|
|
|
row.operator("bim.disable_editing_header", icon="CANCEL", text="")
|
|
|
|
|
else:
|
|
|
|
|
row.operator("bim.enable_editing_header", icon="GREASEPENCIL", text="")
|
|
|
|
|
|
2021-02-03 19:15:25 +11:00
|
|
|
row = self.layout.row(align=True)
|
|
|
|
|
row.label(text="IFC Schema", icon="FILE_CACHE")
|
|
|
|
|
row.label(text=IfcStore.get_file().schema)
|
2021-05-28 09:50:55 +10:00
|
|
|
|
|
|
|
|
if pprops.is_editing:
|
|
|
|
|
row = self.layout.row(align=True)
|
|
|
|
|
row.prop(pprops, "mvd")
|
|
|
|
|
|
|
|
|
|
row = self.layout.row(align=True)
|
|
|
|
|
row.prop(pprops, "author_name")
|
|
|
|
|
row = self.layout.row(align=True)
|
|
|
|
|
row.prop(pprops, "author_email")
|
|
|
|
|
|
|
|
|
|
row = self.layout.row(align=True)
|
|
|
|
|
row.prop(pprops, "organisation_name")
|
|
|
|
|
row = self.layout.row(align=True)
|
|
|
|
|
row.prop(pprops, "organisation_email")
|
|
|
|
|
|
|
|
|
|
row = self.layout.row(align=True)
|
|
|
|
|
row.prop(pprops, "authorisation")
|
|
|
|
|
else:
|
|
|
|
|
row = self.layout.row(align=True)
|
|
|
|
|
row.label(text="IFC MVD", icon="FILE_HIDDEN")
|
|
|
|
|
mvd = "".join(IfcStore.get_file().wrapped_data.header.file_description.description)
|
|
|
|
|
if "[" in mvd:
|
|
|
|
|
mvd = mvd.split("[")[1][0:-1]
|
|
|
|
|
row.label(text=mvd)
|
2021-02-03 19:15:25 +11:00
|
|
|
else:
|
|
|
|
|
row = self.layout.row(align=True)
|
|
|
|
|
row.label(text="File Not Loaded", icon="ERROR")
|
2021-01-20 16:53:34 +11:00
|
|
|
|
2022-02-03 21:29:44 +11:00
|
|
|
if props.ifc_file:
|
|
|
|
|
row = self.layout.row(align=True)
|
|
|
|
|
row.label(text="Saved", icon="EXPORT")
|
|
|
|
|
row.label(text=ProjectData.data["last_saved"])
|
|
|
|
|
|
|
|
|
|
row = self.layout.row(align=True)
|
|
|
|
|
row.prop(props, "ifc_file", text="")
|
|
|
|
|
row.operator("bim.reload_ifc_file", icon="FILE_REFRESH", text="")
|
|
|
|
|
row.operator("bim.select_ifc_file", icon="FILE_FOLDER", text="")
|
2023-07-11 23:07:51 +10:00
|
|
|
row.operator("bim.unload_project", text="", icon="CANCEL")
|
|
|
|
|
else:
|
|
|
|
|
row = self.layout.row()
|
|
|
|
|
row.label(text="File Not Saved", icon="ERROR")
|
2022-02-03 21:29:44 +11:00
|
|
|
|
2021-01-20 16:53:34 +11:00
|
|
|
def draw_create_project_ui(self, context):
|
|
|
|
|
props = context.scene.BIMProperties
|
2022-01-10 10:45:46 +11:00
|
|
|
pprops = context.scene.BIMProjectProperties
|
2022-07-03 22:37:41 +02:00
|
|
|
prop_with_search(self.layout, pprops, "export_schema")
|
2021-01-20 16:53:34 +11:00
|
|
|
row = self.layout.row()
|
|
|
|
|
row.prop(context.scene.unit_settings, "system")
|
|
|
|
|
row = self.layout.row()
|
|
|
|
|
row.prop(context.scene.unit_settings, "length_unit")
|
|
|
|
|
row = self.layout.row()
|
|
|
|
|
row.prop(props, "area_unit", text="Area Unit")
|
|
|
|
|
row = self.layout.row()
|
|
|
|
|
row.prop(props, "volume_unit", text="Volume Unit")
|
2022-07-03 22:37:41 +02:00
|
|
|
prop_with_search(self.layout, pprops, "template_file", text="Template")
|
2022-02-03 18:25:03 +11:00
|
|
|
|
2021-09-11 20:29:14 +10:00
|
|
|
row = self.layout.row(align=True)
|
2021-01-20 16:53:34 +11:00
|
|
|
row.operator("bim.create_project")
|
2023-07-13 22:33:52 +10:00
|
|
|
row.operator("bim.load_project").should_start_fresh_session = False
|
2021-04-20 12:45:20 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class BIM_PT_project_library(Panel):
|
2023-07-15 21:02:30 +10:00
|
|
|
bl_label = "Project Library"
|
2021-04-20 12:45:20 +10:00
|
|
|
bl_idname = "BIM_PT_project_library"
|
2021-04-21 16:45:11 +10:00
|
|
|
bl_options = {"DEFAULT_CLOSED"}
|
2021-04-20 12:45:20 +10:00
|
|
|
bl_space_type = "PROPERTIES"
|
|
|
|
|
bl_region_type = "WINDOW"
|
|
|
|
|
bl_context = "scene"
|
2022-01-14 00:09:51 +01:00
|
|
|
bl_parent_id = "BIM_PT_project_setup"
|
2021-04-20 12:45:20 +10:00
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
self.layout.use_property_decorate = False
|
|
|
|
|
self.layout.use_property_split = True
|
|
|
|
|
self.props = context.scene.BIMProjectProperties
|
|
|
|
|
row = self.layout.row(align=True)
|
|
|
|
|
row.label(text=IfcStore.library_path or "No Library Loaded", icon="ASSET_MANAGER")
|
2021-04-20 13:51:41 +10:00
|
|
|
if IfcStore.library_file:
|
|
|
|
|
row.label(text=IfcStore.library_file.schema)
|
2023-07-29 22:43:50 +10:00
|
|
|
row.operator("bim.append_library_element_by_query", text="", icon="APPEND_BLEND")
|
2021-04-20 13:51:41 +10:00
|
|
|
row.operator("bim.save_library_file", text="", icon="EXPORT")
|
2021-04-20 12:45:20 +10:00
|
|
|
row.operator("bim.select_library_file", icon="FILE_FOLDER", text="")
|
|
|
|
|
if IfcStore.library_file:
|
|
|
|
|
self.draw_library_ul()
|
|
|
|
|
|
|
|
|
|
def draw_library_ul(self):
|
|
|
|
|
if not self.props.library_elements:
|
|
|
|
|
row = self.layout.row()
|
|
|
|
|
row.label(text="No Assets Found", icon="ERROR")
|
|
|
|
|
return
|
|
|
|
|
row = self.layout.row(align=True)
|
|
|
|
|
row.label(text=self.props.active_library_element or "Top Level Assets")
|
|
|
|
|
if self.props.active_library_element:
|
|
|
|
|
row.operator("bim.rewind_library", icon="FRAME_PREV", text="")
|
|
|
|
|
row.operator("bim.refresh_library", icon="FILE_REFRESH", text="")
|
|
|
|
|
self.layout.template_list(
|
|
|
|
|
"BIM_UL_library",
|
|
|
|
|
"",
|
|
|
|
|
self.props,
|
|
|
|
|
"library_elements",
|
|
|
|
|
self.props,
|
|
|
|
|
"active_library_element_index",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2021-09-13 10:00:54 +10:00
|
|
|
class BIM_PT_links(Panel):
|
2023-07-15 21:02:30 +10:00
|
|
|
bl_label = "Links"
|
2021-09-13 10:00:54 +10:00
|
|
|
bl_idname = "BIM_PT_links"
|
|
|
|
|
bl_options = {"DEFAULT_CLOSED"}
|
|
|
|
|
bl_space_type = "PROPERTIES"
|
|
|
|
|
bl_region_type = "WINDOW"
|
|
|
|
|
bl_context = "scene"
|
2022-01-14 00:09:51 +01:00
|
|
|
bl_parent_id = "BIM_PT_project_setup"
|
2021-09-13 10:00:54 +10:00
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
self.props = context.scene.BIMProjectProperties
|
|
|
|
|
row = self.layout.row(align=True)
|
|
|
|
|
row.operator("bim.link_ifc")
|
|
|
|
|
if self.props.links:
|
|
|
|
|
self.layout.template_list(
|
|
|
|
|
"BIM_UL_links",
|
|
|
|
|
"",
|
|
|
|
|
self.props,
|
|
|
|
|
"links",
|
|
|
|
|
self.props,
|
|
|
|
|
"active_link_index",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2021-04-20 12:45:20 +10:00
|
|
|
class BIM_UL_library(UIList):
|
|
|
|
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
|
|
|
|
if item:
|
|
|
|
|
row = layout.row(align=True)
|
|
|
|
|
if not item.ifc_definition_id:
|
|
|
|
|
op = row.operator("bim.change_library_element", text="", icon="DISCLOSURE_TRI_RIGHT", emboss=False)
|
|
|
|
|
op.element_name = item.name
|
|
|
|
|
row.label(text=item.name)
|
2021-04-20 13:51:41 +10:00
|
|
|
if (
|
2021-04-21 16:45:11 +10:00
|
|
|
item.ifc_definition_id
|
|
|
|
|
and IfcStore.library_file.schema != "IFC2X3"
|
|
|
|
|
and IfcStore.library_file.by_type("IfcProjectLibrary")
|
2021-04-20 13:51:41 +10:00
|
|
|
):
|
2021-04-21 16:45:11 +10:00
|
|
|
if item.is_declared:
|
|
|
|
|
op = row.operator("bim.unassign_library_declaration", text="", icon="KEYFRAME_HLT", emboss=False)
|
|
|
|
|
op.definition = item.ifc_definition_id
|
|
|
|
|
else:
|
|
|
|
|
op = row.operator("bim.assign_library_declaration", text="", icon="KEYFRAME", emboss=False)
|
|
|
|
|
op.definition = item.ifc_definition_id
|
|
|
|
|
if item.ifc_definition_id:
|
2021-09-01 00:01:44 +02:00
|
|
|
if item.is_appended:
|
|
|
|
|
row.label(text="", icon="CHECKMARK")
|
|
|
|
|
else:
|
|
|
|
|
op = row.operator("bim.append_library_element", text="", icon="APPEND_BLEND")
|
|
|
|
|
op.definition = item.ifc_definition_id
|
|
|
|
|
op.prop_index = data.get_library_element_index(item)
|
2021-09-12 15:25:03 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class BIM_UL_filter_categories(UIList):
|
|
|
|
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
|
|
|
|
if item:
|
|
|
|
|
row = layout.row(align=True)
|
|
|
|
|
row.label(text=f"{item.name} ({item.total_elements})")
|
|
|
|
|
row.prop(
|
|
|
|
|
item,
|
|
|
|
|
"is_selected",
|
|
|
|
|
icon="CHECKBOX_HLT" if item.is_selected else "CHECKBOX_DEHLT",
|
|
|
|
|
text="",
|
|
|
|
|
emboss=False,
|
|
|
|
|
)
|
2021-09-13 10:00:54 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class BIM_UL_links(UIList):
|
|
|
|
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
|
|
|
|
if item:
|
|
|
|
|
row = layout.row(align=True)
|
2021-09-13 10:48:38 +10:00
|
|
|
if item.is_loaded:
|
2022-03-16 10:46:29 +11:00
|
|
|
row.label(text=item.name)
|
2022-06-09 21:47:35 +10:00
|
|
|
op = row.operator(
|
2023-08-13 15:49:23 +10:00
|
|
|
"bim.toggle_link_selectability",
|
|
|
|
|
text="",
|
|
|
|
|
icon="RESTRICT_SELECT_OFF" if item.is_selectable else "RESTRICT_SELECT_ON",
|
|
|
|
|
emboss=False,
|
|
|
|
|
)
|
|
|
|
|
op.link = item.name
|
|
|
|
|
op = row.operator(
|
2022-06-09 21:47:35 +10:00
|
|
|
"bim.toggle_link_visibility",
|
|
|
|
|
text="",
|
|
|
|
|
icon="CUBE" if item.is_wireframe else "MESH_CUBE",
|
|
|
|
|
emboss=False,
|
|
|
|
|
)
|
|
|
|
|
op.link = item.name
|
|
|
|
|
op.mode = "WIREFRAME"
|
|
|
|
|
op = row.operator(
|
|
|
|
|
"bim.toggle_link_visibility",
|
|
|
|
|
text="",
|
|
|
|
|
icon="HIDE_ON" if item.is_hidden else "HIDE_OFF",
|
|
|
|
|
emboss=False,
|
|
|
|
|
)
|
|
|
|
|
op.link = item.name
|
|
|
|
|
op.mode = "VISIBLE"
|
2021-09-13 10:48:38 +10:00
|
|
|
op = row.operator("bim.unload_link", text="", icon="UNLINKED")
|
2021-09-20 17:06:02 +10:00
|
|
|
op.filepath = item.name
|
2023-08-27 18:21:19 +01:00
|
|
|
op = row.operator("bim.reload_link", text="", icon="FILE_REFRESH")
|
|
|
|
|
op.filepath = item.name
|
2021-09-13 10:48:38 +10:00
|
|
|
else:
|
2022-03-16 10:46:29 +11:00
|
|
|
row.prop(item, "name", text="")
|
2021-09-13 10:48:38 +10:00
|
|
|
op = row.operator("bim.load_link", text="", icon="LINKED")
|
2021-09-20 17:06:02 +10:00
|
|
|
op.filepath = item.name
|
2021-09-13 10:48:38 +10:00
|
|
|
op = row.operator("bim.unlink_ifc", text="", icon="X")
|
2021-09-20 17:06:02 +10:00
|
|
|
op.filepath = item.name
|
2023-08-17 16:26:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class BIM_PT_purge(Panel):
|
|
|
|
|
bl_label = "Purge Data"
|
|
|
|
|
bl_options = {"DEFAULT_CLOSED"}
|
|
|
|
|
bl_space_type = "PROPERTIES"
|
|
|
|
|
bl_region_type = "WINDOW"
|
|
|
|
|
bl_context = "scene"
|
|
|
|
|
bl_parent_id = "BIM_PT_tab_quality_control"
|
|
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
2023-08-18 16:04:08 +02:00
|
|
|
layout.operator("bim.purge_unused_profiles")
|
|
|
|
|
layout.operator("bim.purge_unused_types")
|
2023-08-18 16:20:41 +02:00
|
|
|
layout.operator("bim.purge_unused_representations")
|
2023-09-27 15:41:51 +05:00
|
|
|
layout.separator()
|
|
|
|
|
|
|
|
|
|
layout.label(text="Purge unused elements by class:")
|
|
|
|
|
row = layout.row(align=True)
|
|
|
|
|
row.prop(context.scene.BIMDebugProperties, "ifc_class_purge", text="")
|
|
|
|
|
row.operator("bim.purge_unused_elements_by_class", text="", icon="TRASH")
|
|
|
|
|
row.operator("bim.print_unused_elements_stats", text="", icon="INFO")
|