Update Load bSDD domains

This commit is contained in:
c4rlosdias
2023-12-03 17:02:56 -03:00
parent caab8f8036
commit c71ff5fb10
3 changed files with 14 additions and 1 deletions
@@ -33,7 +33,13 @@ class LoadBSDDDomains(bpy.types.Operator):
props = context.scene.BIMBSDDProperties
props.domains.clear()
client = bsdd.Client()
for domain in sorted(client.Domain(), key=lambda x: x["name"]):
if props.load_activated_domains:
domains = [d for d in client.Domain() if d["status"] == "Active"]
else:
domains = client.Domain()
for domain in sorted(domains, key=lambda x: x["name"]):
new = props.domains.add()
new.name = domain["name"]
new.namespace_uri = domain["namespaceUri"]
@@ -63,4 +63,5 @@ class BIMBSDDProperties(PropertyGroup):
active_classification_index: IntProperty(name="Active Classification Index")
keyword: StringProperty(name="Keyword")
should_filter_ifc_class: BoolProperty(name="Filter Active IFC Class", default=True)
load_activated_domains: BoolProperty(name="Load Activated Domains Only", default=True)
classification_psets: CollectionProperty(name="Classification Psets", type=BSDDPset)
@@ -32,6 +32,9 @@ class BIM_PT_bsdd(Panel):
def draw(self, context):
props = context.scene.BIMBSDDProperties
row = self.layout.row()
row.prop(props, "load_activated_domains")
if props.active_domain:
row = self.layout.row()
row.label(text="Active: " + props.active_domain, icon="URL")
@@ -48,6 +51,8 @@ class BIM_PT_bsdd(Panel):
props,
"active_domain_index",
)
row = self.layout.row()
row.operator("bim.load_bsdd_domains", text="Reload bSDD Domains")
else:
row = self.layout.row()
row.operator("bim.load_bsdd_domains")
@@ -58,6 +63,7 @@ class BIM_UL_bsdd_domains(UIList):
if item:
row = layout.row(align=True)
row.label(text=f"{item.name} ({item.organization_name_owner})")
row.label(text=item.status)
op = row.operator("bim.set_active_bsdd_domain", text="", icon="RESTRICT_SELECT_OFF")
op.name = item.name
op.uri = item.namespace_uri