to avoid issues importing csvs that used it to extract correct predefined type
Example warning:
WARNING. Assigning 'predefined_type' is not yet supported. Skipping value 'ELECTRICACTUATOR' for element: '#89=IfcActuator('1RjCen6XL6WAdhz7HumLFU',$,'Actuator.002',$,$,#179,$,$,.ELECTRICACTUATOR.)'.
Traceback
Traceback (most recent call last):
File "\bonsai\bim\module\type\operator.py", line 63, in execute
return IfcStore.execute_ifc_operator(self, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\bonsai\bim\ifc.py", line 408, in execute_ifc_operator
result = getattr(operator, "_execute")(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\bonsai\bim\module\type\operator.py", line 78, in _execute
active_context = active_representation.ContextOfItems
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'ContextOfItems'
Error: Python: Traceback (most recent call last):
File "\bonsai\bim\ifc.py", line 408, in execute_ifc_operator
result = getattr(operator, "_execute")(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\bonsai\bim\module\type\operator.py", line 78, in _execute
active_context = active_representation.ContextOfItems
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'ContextOfItems'
It was leaving an orphaned pset if 'products' was a list of all elements pset is assigned to. Then it would create a new pset for each element leaving original pset orphaned.
In IFC it's possible for a property set to be assigned to multiple elements and which may lead to confusing behaviour when you edit a pset on one element and other element seems to get edited too.
Which makes it worse is that that it is possible that some software is might be doing this unintentionally when exporting IFC (as some sort of optimization as storing 1 is more optimal than n copies of it).
So now there are some tools in Bonsai and in IfcOpenShell to handle the shared psest:
1) Indication that property is shared - https://imgur.com/a/9dd3jST (similar to how Blender indicates ID data-block users). You can click on it to "unshare" the pset - a new copy for the pset will be created and it's going to be linked only to the active object.
2) api pset.unshare_pset method that does the same. And util.element.get_elements_using_pset method that encapsulates schema differences and different approaches for occurrences/types.
3) ifcpatch recipe 'UnsharePsets' that's making all property sets in the IFC file to have just 1 element that's using them. You can limit the affected elements by providing query.
ifcpatch recipe is also available in Bonsai - https://i.imgur.com/aOCx7HI.png