mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 06:21:40 +00:00
Change active layer collection when setting a new default container
This commit is contained in:
@@ -815,6 +815,16 @@ class Spatial(blenderbim.core.tool.Spatial):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def set_default_container(cls, container):
|
def set_default_container(cls, container):
|
||||||
bpy.context.scene.BIMSpatialDecompositionProperties.default_container = container.id()
|
bpy.context.scene.BIMSpatialDecompositionProperties.default_container = container.id()
|
||||||
|
project = tool.Ifc.get_object(tool.Ifc.get().by_type("IfcProject")[0])
|
||||||
|
project_collection = project.BIMObjectProperties.collection
|
||||||
|
obj = tool.Ifc.get_object(container)
|
||||||
|
if obj and (collection := obj.BIMObjectProperties.collection):
|
||||||
|
for layer_collection in bpy.context.view_layer.layer_collection.children:
|
||||||
|
if layer_collection.collection == project_collection:
|
||||||
|
for layer_collection2 in layer_collection.children:
|
||||||
|
if layer_collection2.collection == collection:
|
||||||
|
bpy.context.view_layer.active_layer_collection = layer_collection2
|
||||||
|
break
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def guess_default_container(cls) -> Optional[ifcopenshell.entity_instance]:
|
def guess_default_container(cls) -> Optional[ifcopenshell.entity_instance]:
|
||||||
|
|||||||
Reference in New Issue
Block a user