mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 17:57:02 +00:00
Add classification system to the Object Information, Clasifiction References Subpanel
This commit is contained in:
@@ -104,6 +104,17 @@ class ReferencesData:
|
|||||||
if element:
|
if element:
|
||||||
for reference in ifcopenshell.util.classification.get_references(element):
|
for reference in ifcopenshell.util.classification.get_references(element):
|
||||||
data = reference.get_info()
|
data = reference.get_info()
|
||||||
|
|
||||||
|
if reference.ReferencedSource:
|
||||||
|
if reference.ReferencedSource.is_a("IfcClassification"):
|
||||||
|
data["ClassificationSystemName"] = reference.ReferencedSource.Name
|
||||||
|
elif reference.ReferencedSource.is_a("IfcClassificationReference"):
|
||||||
|
current = reference.ReferencedSource
|
||||||
|
while current.ReferencedSource and current.ReferencedSource.is_a("IfcClassificationReference"):
|
||||||
|
current = current.ReferencedSource
|
||||||
|
if current.ReferencedSource and current.ReferencedSource.is_a("IfcClassification"):
|
||||||
|
data["ClassificationSystemName"] = current.ReferencedSource.Name
|
||||||
|
|
||||||
del data["ReferencedSource"]
|
del data["ReferencedSource"]
|
||||||
results.append(data)
|
results.append(data)
|
||||||
return results
|
return results
|
||||||
|
|||||||
@@ -252,18 +252,34 @@ class ReferenceUI:
|
|||||||
|
|
||||||
def draw_reference_ui(self, reference: dict[str, Any]) -> None:
|
def draw_reference_ui(self, reference: dict[str, Any]) -> None:
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
|
|
||||||
|
split = row.split(factor=0.3)
|
||||||
|
col1 = split.column()
|
||||||
|
split = split.split(factor=0.3)
|
||||||
|
col2 = split.column()
|
||||||
|
split = split.split(factor=0.7)
|
||||||
|
col3 = split.column()
|
||||||
|
col4 = split.column()
|
||||||
|
|
||||||
|
if reference.get("ClassificationSystemName"):
|
||||||
|
col1.label(text=reference["ClassificationSystemName"], icon="OUTLINER_COLLECTION")
|
||||||
|
else:
|
||||||
|
col1.label(text="")
|
||||||
|
|
||||||
if self.file.schema == "IFC2X3":
|
if self.file.schema == "IFC2X3":
|
||||||
name = reference["ItemReference"] or "No Identification"
|
name = reference["ItemReference"] or "No Identification"
|
||||||
else:
|
else:
|
||||||
name = reference["Identification"] or "No Identification"
|
name = reference["Identification"] or "No Identification"
|
||||||
row.label(text=name, icon="ASSET_MANAGER")
|
col2.label(text=name, icon="ASSET_MANAGER")
|
||||||
row.label(text=reference["Name"] or "")
|
col3.label(text=reference["Name"] or "")
|
||||||
|
|
||||||
|
button_row = col4.row(align=True)
|
||||||
if reference["Location"]:
|
if reference["Location"]:
|
||||||
row.operator("bim.open_uri", icon="URL", text="").uri = reference["Location"]
|
button_row.operator("bim.open_uri", icon="URL", text="").uri = reference["Location"]
|
||||||
if not self.props.active_reference_id:
|
if not self.props.active_reference_id:
|
||||||
op = row.operator("bim.enable_editing_classification_reference", text="", icon="GREASEPENCIL")
|
op = button_row.operator("bim.enable_editing_classification_reference", text="", icon="GREASEPENCIL")
|
||||||
op.reference = reference["id"]
|
op.reference = reference["id"]
|
||||||
op = row.operator("bim.remove_classification_reference", text="", icon="X")
|
op = button_row.operator("bim.remove_classification_reference", text="", icon="X")
|
||||||
op.reference = reference["id"]
|
op.reference = reference["id"]
|
||||||
op.obj = self.obj
|
op.obj = self.obj
|
||||||
op.obj_type = self.data.obj_type
|
op.obj_type = self.data.obj_type
|
||||||
|
|||||||
Reference in New Issue
Block a user