Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Commit 1a48343

Browse files
committed
Optimise import and editing for files with lots of aggregations
1 parent b0bd027 commit 1a48343

2 files changed

Lines changed: 6 additions & 17 deletions

File tree

src/ifcblenderexport/blenderbim/bim/import_ifc.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,18 +1308,10 @@ def add_project_to_scene(self):
13081308
except:
13091309
# Occurs when reloading a project
13101310
pass
1311-
for collection in (
1312-
bpy.context.view_layer.layer_collection.children[self.project["blender"].name]
1313-
.children[self.aggregate_collection.name]
1314-
.children
1315-
):
1316-
collection.hide_viewport = True
1317-
bpy.context.view_layer.layer_collection.children[self.project["blender"].name].children[
1318-
self.opening_collection.name
1319-
].hide_viewport = True
1320-
bpy.context.view_layer.layer_collection.children[self.project["blender"].name].children[
1321-
self.type_collection.name
1322-
].hide_viewport = True
1311+
project_collection = bpy.context.view_layer.layer_collection.children[self.project["blender"].name]
1312+
project_collection.children[self.aggregate_collection.name].hide_viewport = True
1313+
project_collection.children[self.opening_collection.name].hide_viewport = True
1314+
project_collection.children[self.type_collection.name].hide_viewport = True
13231315

13241316
def create_presentation_layers(self):
13251317
for assignment in self.file.by_type("IfcPresentationLayerAssignment"):

src/ifcblenderexport/blenderbim/bim/operator.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2265,7 +2265,6 @@ def execute(self, context):
22652265
project.collection.children.link(aggregates)
22662266
for aggregate_collection in [c for c in project.children if "Aggregates" in c.name]:
22672267
aggregate_collection.collection.children.link(aggregate)
2268-
aggregate_collection.children[aggregate.name].hide_viewport = True
22692268
break
22702269
break
22712270
for obj in bpy.context.selected_objects:
@@ -2296,9 +2295,7 @@ def execute(self, context):
22962295
bpy.context.view_layer.objects[obj.name].hide_viewport = True
22972296
for project in [c for c in bpy.context.view_layer.layer_collection.children if "IfcProject" in c.name]:
22982297
for aggregate_collection in [c for c in project.children if "Aggregates" in c.name]:
2299-
for aggregate in [c for c in aggregate_collection.children if c.name == obj.instance_collection.name]:
2300-
aggregate.hide_viewport = False
2301-
break
2298+
aggregate_collection.hide_viewport = False
23022299
return {"FINISHED"}
23032300

23042301

@@ -2312,8 +2309,8 @@ def execute(self, context):
23122309
names = [c.name for c in obj.users_collection]
23132310
for project in [c for c in bpy.context.view_layer.layer_collection.children if "IfcProject" in c.name]:
23142311
for aggregate_collection in [c for c in project.children if "Aggregates" in c.name]:
2312+
aggregate_collection.hide_viewport = True
23152313
for collection in [c for c in aggregate_collection.children if c.name in names]:
2316-
collection.hide_viewport = True
23172314
aggregate = collection.collection
23182315
break
23192316
if not aggregate:

0 commit comments

Comments
 (0)