Optimise owner check depending on your implementation and no longer create default users on IFC4. Can result in 50% faster script running on long scripted operations.

This commit is contained in:
Dion Moult
2021-10-29 18:04:17 +11:00
parent 4bf4622498
commit 109149a0be
5 changed files with 18 additions and 13 deletions
@@ -12,10 +12,11 @@ class Usecase:
def execute(self):
user = ifcopenshell.api.owner.settings.get_user(self.file)
if self.file.schema != "IFC2X3" and not user:
return
application = ifcopenshell.api.owner.settings.get_application(self.file)
if self.file.schema != "IFC2X3":
if not user or not application:
return
if self.file.schema != "IFC2X3" and not application:
return
return self.file.create_entity(
"IfcOwnerHistory",
**{
@@ -15,8 +15,10 @@ class Usecase:
if not hasattr(self.settings["element"], "OwnerHistory"):
return
user = ifcopenshell.api.owner.settings.get_user(self.file)
if not user:
return
application = ifcopenshell.api.owner.settings.get_application(self.file)
if not user or not application:
if not application:
return
if not self.settings["element"].OwnerHistory:
self.settings["element"].OwnerHistory = ifcopenshell.api.run(