1) core.remove_material_set were removing material set and calling material_tool.get_active_material_type()
2) material_tool.get_active_material_type() called MaterialsData which failed with the traceback below since props.materias[current_index] had ifc id that were just removed
Traceback (most recent call last):
File "\prop.py", line 96, in get_material_types
MaterialsData.load()
File "\data.py", line 43, in load
"active_styles": cls.active_styles(),
^^^^^^^^^^^^^^^^^^^
File "\data.py", line 119, in active_styles
material = tool.Ifc.get().by_id(material)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File \blenderbim\libs\site\packages\ifcopenshell\file.py", line 411, in by_id
return self[id]
~~~~^^^^
File \blenderbim\libs\site\packages\ifcopenshell\file.py", line 396, in __getitem__
return entity_instance(self.wrapped_data.by_id(key), self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File \blenderbim\libs\site\packages\ifcopenshell\ifcopenshell_wrapper.py", line 4619, in by_id
return _ifcopenshell_wrapper.file_by_id(self, id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Instance # 66 not found
File "\prop.py", line 94, in get_material_types
WARN (bpy.rna): C:\Users\blender\git\blender-v410\blender.git\source\blender\python\intern\bpy_rna.cc:1366 pyrna_enum_to_py: current value '2' matches no enum in 'BIMMaterialProperties', '', 'material_type'
Error was:
```
Traceback (most recent call last):
File "\blenderbim\bim\module\material\ui.py", line 43, in draw
MaterialsData.load()
File "\blenderbim\bim\module\material\data.py", line 43, in load
"active_styles": cls.active_styles(),
^^^^^^^^^^^^^^^^^^^
File "\blenderbim\bim\module\material\data.py", line 117, in active_styles
return results
File "\blenderbim\libs\site\packages\ifcopenshell\entity_instance.py", line 194, in __getattr__
raise AttributeError(
AttributeError: entity instance of type 'IFC4.IfcMaterialLayerSet' has no attribute 'HasRepresentation'
```
Previously it was failing with
File "\ifcopenshell\geom\main.py", line 119, in __init__
self.this = initializer(
File "\ifcopenshell\ifcopenshell_wrapper.py", line 2467, in construct_iterator_with_include_exclude
return _ifcopenshell_wrapper.construct_iterator_with_include_exclude(settings, file, elems, include, num_threads)
TypeError: Attribute of type AGGREGATE OF STRING needs a python sequence of strs
1) avoid selecting elements of the same type multiple times
2) iterate over occurrences of the type rather than visible objects, as it's usually smaller amount of objects
it couldn't find linked collections and scenes since it was comparing `filepath` from `props.links` (.ifc file) and collection.library.filepath (which is .blend file)
Example - https://imgur.com/a/phPcKSo
Appending ifc elements from library files will be deprecated as it's much more limited than appending it from linked files (in library you can only see object's name).
* fixed qsets to display separately
Signed-off-by: milinddethe15 <milinddethe15@gmail.com>
* updated data.py and run black formattor
---------
Signed-off-by: milinddethe15 <milinddethe15@gmail.com>