@@ -38,7 +38,7 @@ class MaterialCreator:
3838 def __init__ (self , ifc_import_settings , ifc_importer ):
3939 self .mesh = None
4040 self .materials = {}
41- self .parsed_meshes = []
41+ self .parsed_meshes = set ()
4242 self .ifc_import_settings = ifc_import_settings
4343 self .ifc_importer = ifc_importer
4444
@@ -54,7 +54,7 @@ def create(self, element, obj, mesh):
5454 return
5555 if self .mesh .name in self .parsed_meshes :
5656 return
57- self .parsed_meshes .append (self .mesh .name )
57+ self .parsed_meshes .add (self .mesh .name )
5858 if self .parse_representations (element ):
5959 self .assign_material_slots_to_faces (obj )
6060
@@ -465,10 +465,10 @@ def execute(self):
465465 ):
466466 self .merge_materials_by_colour ()
467467 self .profile_code ("Merging by colour" )
468- self .add_project_to_scene ()
469- self .profile_code ("Add project to scene" )
470468 self .create_presentation_layers ()
471469 self .profile_code ("Create presentation layers" )
470+ self .add_project_to_scene ()
471+ self .profile_code ("Add project to scene" )
472472 if self .ifc_import_settings .should_clean_mesh and len (self .file .by_type ("IfcElement" )) < 10000 :
473473 self .clean_mesh ()
474474 self .profile_code ("Mesh cleaning" )
@@ -1333,19 +1333,15 @@ def create_presentation_layers(self):
13331333 for item in assignment .AssignedItems :
13341334 # TODO: This is a simplified implementation of assigning presentation layers that ignores assigned
13351335 # representation items, does not consider mapped representations, and assumes a Body context. See #1109.
1336- guids = []
13371336 if not hasattr (item , "OfProductRepresentation" ) or item .RepresentationIdentifier != "Body" :
13381337 continue
13391338 for product_representation in item .OfProductRepresentation :
13401339 for product in product_representation .ShapeOfProduct :
1341- guids .append (product .GlobalId )
1342- for obj in bpy .context .selectable_objects :
1343- global_id = obj .BIMObjectProperties .attributes .get ("GlobalId" )
1344- if global_id and global_id .string_value in guids :
1345- if not obj .data or not hasattr (obj .data , "BIMMeshProperties" ):
1346- continue
1347- obj .data .BIMMeshProperties .presentation_layer_index = layer_index
1348- obj .hide_set (not layer .layer_on )
1340+ try :
1341+ obj = self .added_data [product .GlobalId ]
1342+ obj .data .BIMMeshProperties .presentation_layer_index = layer_index
1343+ except :
1344+ pass # Occurs for example in opening elements or exclusions
13491345
13501346 def clean_mesh (self ):
13511347 obj = None
0 commit comments