mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 13:46:54 +00:00
Representation items panel now shows styles and layers
This commit is contained in:
@@ -99,7 +99,11 @@ class RepresentationItemsData:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls):
|
def load(cls):
|
||||||
cls.data = {"total_items": cls.total_items()}
|
cls.data = {
|
||||||
|
"total_items": cls.total_items(),
|
||||||
|
"active_surface_style": cls.active_surface_style(),
|
||||||
|
"active_layer": cls.active_layer(),
|
||||||
|
}
|
||||||
cls.is_loaded = True
|
cls.is_loaded = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -120,6 +124,18 @@ class RepresentationItemsData:
|
|||||||
result += 1
|
result += 1
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def active_surface_style(cls):
|
||||||
|
props = bpy.context.active_object.BIMGeometryProperties
|
||||||
|
if props.active_item_index < len(props.items):
|
||||||
|
return props.items[props.active_item_index].surface_style
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def active_layer(cls):
|
||||||
|
props = bpy.context.active_object.BIMGeometryProperties
|
||||||
|
if props.active_item_index < len(props.items):
|
||||||
|
return props.items[props.active_item_index].layer
|
||||||
|
|
||||||
|
|
||||||
class ConnectionsData:
|
class ConnectionsData:
|
||||||
data = {}
|
data = {}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ def get_contexts(self, context):
|
|||||||
class RepresentationItem(PropertyGroup):
|
class RepresentationItem(PropertyGroup):
|
||||||
name: StringProperty(name="Name")
|
name: StringProperty(name="Name")
|
||||||
surface_style: StringProperty(name="Surface Style")
|
surface_style: StringProperty(name="Surface Style")
|
||||||
|
layer: StringProperty(name="Layer")
|
||||||
ifc_definition_id: IntProperty(name="IFC Definition ID")
|
ifc_definition_id: IntProperty(name="IFC Definition ID")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -164,6 +164,18 @@ class BIM_PT_representation_items(Panel):
|
|||||||
|
|
||||||
self.layout.template_list("BIM_UL_representation_items", "", props, "items", props, "active_item_index")
|
self.layout.template_list("BIM_UL_representation_items", "", props, "items", props, "active_item_index")
|
||||||
|
|
||||||
|
row = self.layout.row()
|
||||||
|
if RepresentationItemsData.data["active_surface_style"]:
|
||||||
|
row.label(text=RepresentationItemsData.data["active_surface_style"], icon="MATERIAL")
|
||||||
|
else:
|
||||||
|
row.label(text="No Surface Style", icon="MESH_UVSPHERE")
|
||||||
|
|
||||||
|
row = self.layout.row()
|
||||||
|
if RepresentationItemsData.data["active_layer"]:
|
||||||
|
row.label(text=RepresentationItemsData.data["active_layer"], icon="STICKY_UVS_LOC")
|
||||||
|
else:
|
||||||
|
row.label(text="No Presentation Layer", icon="STICKY_UVS_LOC")
|
||||||
|
|
||||||
|
|
||||||
class BIM_PT_connections(Panel):
|
class BIM_PT_connections(Panel):
|
||||||
bl_label = "Connections"
|
bl_label = "Connections"
|
||||||
@@ -423,5 +435,5 @@ class BIM_UL_representation_items(UIList):
|
|||||||
icon = "MATERIAL" if item.surface_style else "MESH_UVSPHERE"
|
icon = "MATERIAL" if item.surface_style else "MESH_UVSPHERE"
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.label(text=item.name, icon=icon)
|
row.label(text=item.name, icon=icon)
|
||||||
if item.surface_style:
|
if item.layer:
|
||||||
row.label(text=item.surface_style)
|
row.label(text="", icon="STICKY_UVS_LOC")
|
||||||
|
|||||||
@@ -577,7 +577,7 @@ def get_elements_by_layer(ifc_file, layer):
|
|||||||
:rtype: list[ifcopenshell.entity_instance.entity_instance]
|
:rtype: list[ifcopenshell.entity_instance.entity_instance]
|
||||||
"""
|
"""
|
||||||
results = set()
|
results = set()
|
||||||
for item in layer.AssignedItems:
|
for item in layer.AssignedItems or []:
|
||||||
if item.is_a("IfcShapeRepresentation"):
|
if item.is_a("IfcShapeRepresentation"):
|
||||||
results.update(get_elements_by_representation(ifc_file, item))
|
results.update(get_elements_by_representation(ifc_file, item))
|
||||||
elif item.is_a("IfcRepresentationItem"):
|
elif item.is_a("IfcRepresentationItem"):
|
||||||
|
|||||||
Reference in New Issue
Block a user