get_applicable_types in ifc2x3 to prioritize IfcBuildingElementProxyType

for occurrence classes without special type.

E.g. previously:
you select IfcSlab and change it to IfcRoof - since there is not IfcRoofType in IFC2X3 it would figure the matching product type is IfcBeamType and change this slab's type element to IfcBeamType. IfcBuildingElementProxyType seems more generic and fitting.
This commit is contained in:
Andrej730
2025-03-11 18:20:12 +05:00
parent 977d814d39
commit a9f7d4ab3b
2 changed files with 15 additions and 0 deletions
@@ -183,6 +183,10 @@ class Usecase:
if self.occurrence_class:
ifc_class_ = self.occurrence_class
else:
# NOTE: in theory we can skip reassignment in IFC2X3 in some cases
# e.g. if occurrence is IfcRoof and we're reassigning to IfcBuildingElementProxyType
# but currently type_to_entity_map doesn't completely match entity_to_type_map,
# see type.py for more details.
ifc_class_ = next(iter(ifcopenshell.util.type.get_applicable_entities(ifc_class, self.file.schema)))
self.reassign_class(occurrence, ifc_class_, predefined_type)
else: