mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
@@ -2364,6 +2364,7 @@ class EnableEditingRepresentationItems(bpy.types.Operator, tool.Ifc.Operator):
|
||||
new.surface_style_id = style.id()
|
||||
elif inverse.is_a("IfcPresentationLayerAssignment"):
|
||||
new.layer = inverse.Name or "Unnamed"
|
||||
new.layer_id = inverse.id()
|
||||
elif inverse.is_a("IfcShapeRepresentation"):
|
||||
if inverse.OfShapeAspect:
|
||||
shape_aspect = inverse.OfShapeAspect[0]
|
||||
|
||||
@@ -131,6 +131,7 @@ class RepresentationItem(PropertyGroup):
|
||||
surface_style: StringProperty(name="Surface Style")
|
||||
surface_style_id: IntProperty(name="Surface Style ID")
|
||||
layer: StringProperty(name="Layer")
|
||||
layer_id: IntProperty(name="Layer ID")
|
||||
ifc_definition_id: IntProperty(name="IFC Definition ID")
|
||||
shape_aspect: StringProperty(name="Shape Aspect")
|
||||
shape_aspect_id: IntProperty(name="Shape Aspect IFC ID")
|
||||
@@ -141,6 +142,7 @@ class RepresentationItem(PropertyGroup):
|
||||
surface_style: str
|
||||
surface_style_id: int
|
||||
layer: str
|
||||
layer_id: int
|
||||
ifc_definition_id: int
|
||||
shape_aspect: str
|
||||
shape_aspect_id: int
|
||||
|
||||
@@ -236,6 +236,9 @@ class BIM_PT_representation_items(Panel):
|
||||
row.prop(props, "is_editing_item_layer", icon="CANCEL", text="")
|
||||
else:
|
||||
row.label(text=layer or "No Presentation Layer", icon="STICKY_UVS_LOC")
|
||||
if layer:
|
||||
op = row.operator("bim.layer_ui_select", icon="ZOOM_SELECTED", text="")
|
||||
op.layer_id = active_item.layer_id
|
||||
row.prop(props, "is_editing_item_layer", icon="GREASEPENCIL", text="")
|
||||
if layer:
|
||||
row.operator("bim.unassign_representation_item_layer", icon="X", text="")
|
||||
|
||||
@@ -27,6 +27,7 @@ classes = (
|
||||
operator.EditPresentationLayer,
|
||||
operator.EnableEditingLayer,
|
||||
operator.LoadLayers,
|
||||
operator.SelectLayerInLayerUI,
|
||||
operator.RemovePresentationLayer,
|
||||
operator.SelectLayerProducts,
|
||||
operator.UnassignPresentationLayer,
|
||||
|
||||
@@ -190,3 +190,22 @@ class SelectLayerProducts(bpy.types.Operator):
|
||||
if element and element in elements:
|
||||
obj.select_set(True)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class SelectLayerInLayerUI(bpy.types.Operator):
|
||||
bl_idname = "bim.layer_ui_select"
|
||||
bl_label = "Select Layer In Layers UI"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
layer_id: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
props = tool.Layer.get_layer_props()
|
||||
ifc_file = tool.Ifc.get()
|
||||
layer = ifc_file.by_id(self.layer_id)
|
||||
bpy.ops.bim.load_layers()
|
||||
props.active_layer_index = next((i for i, m in enumerate(props.layers) if m.ifc_definition_id == self.layer_id))
|
||||
self.report(
|
||||
{"INFO"},
|
||||
f"Layer '{layer.Name or 'Unnamed'}' is selected in Layers UI.",
|
||||
)
|
||||
return {"FINISHED"}
|
||||
|
||||
Reference in New Issue
Block a user