Fix #4547. Handle both null inherited predefined types and disable editing predefined types on occurrences which inherit from a type.

This commit is contained in:
Dion Moult
2024-04-15 11:53:37 +10:00
parent 8a62558575
commit acf6628f23
3 changed files with 17 additions and 6 deletions
@@ -64,7 +64,8 @@ class Usecase:
self.settings["product"].PredefinedType = "USERDEFINED"
elif hasattr(self.settings["product"], "ObjectType"):
relating_type = ifcopenshell.util.element.get_type(self.settings["product"])
if relating_type and relating_type.PredefinedType != "NOTDEFINED":
# Allow for None due to https://github.com/buildingSMART/IFC4.3.x-development/issues/818
if relating_type and relating_type.PredefinedType not in ("NOTDEFINED", None):
self.settings["product"].ObjectType = None
self.settings["product"].PredefinedType = None
elif (