mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
You can now add and remove users for ownership history
This commit is contained in:
+2
-2
@@ -1,9 +1,9 @@
|
||||
class Usecase:
|
||||
def __init__(self, file, **settings):
|
||||
self.file = file
|
||||
self.settings = {"actor": None}
|
||||
self.settings = {"person": None, "organisation": None}
|
||||
for key, value in settings.items():
|
||||
self.settings[key] = value
|
||||
|
||||
def execute(self):
|
||||
self.file.remove(self.settings["actor"])
|
||||
return self.file.createIfcPersonAndOrganization(self.settings["person"], self.settings["organisation"])
|
||||
@@ -27,7 +27,7 @@ class Usecase:
|
||||
elif inverse.is_a("IfcPersonAndOrganization"):
|
||||
ifcopenshell.api.run("owner.remove_person_and_organisation", self.file, person_and_organisation=inverse)
|
||||
elif inverse.is_a("IfcActor"):
|
||||
ifcopenshell.api.run("owner.remove_actor", self.file, actor=inverse)
|
||||
ifcopenshell.api.run("root.remove_product", self.file, product=inverse)
|
||||
elif inverse.is_a("IfcResourceLevelRelationship") and not inverse.is_a("IfcOrganizationRelationship"):
|
||||
if inverse.RelatedResourceObjects == (self.settings["organisation"],):
|
||||
self.file.remove(inverse)
|
||||
|
||||
@@ -28,7 +28,7 @@ class Usecase:
|
||||
elif inverse.is_a("IfcPersonAndOrganization"):
|
||||
ifcopenshell.api.run("owner.remove_person_and_organisation", self.file, person_and_organisation=inverse)
|
||||
elif inverse.is_a("IfcActor"):
|
||||
ifcopenshell.api.run("owner.remove_actor", self.file, actor=inverse)
|
||||
ifcopenshell.api.run("root.remove_product", self.file, product=inverse)
|
||||
elif inverse.is_a("IfcResourceLevelRelationship"):
|
||||
if inverse.RelatedResourceObjects == (self.settings["person"],):
|
||||
self.file.remove(inverse)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import ifcopenshell.api
|
||||
|
||||
|
||||
class Usecase:
|
||||
def __init__(self, file, **settings):
|
||||
self.file = file
|
||||
@@ -6,4 +9,15 @@ class Usecase:
|
||||
self.settings[key] = value
|
||||
|
||||
def execute(self):
|
||||
for inverse in self.file.get_inverse(self.settings["person_and_organisation"]):
|
||||
if inverse.is_a("IfcDocumentInformation"):
|
||||
if inverse.Editors == (self.settings["person_and_organisation"],):
|
||||
inverse.Editors = None
|
||||
elif inverse.is_a("IfcActor"):
|
||||
ifcopenshell.api.run("root.remove_product", self.file, product=inverse)
|
||||
elif inverse.is_a("IfcResourceLevelRelationship"):
|
||||
if inverse.RelatedResourceObjects == (self.settings["person_and_organisation"],):
|
||||
self.file.remove(inverse)
|
||||
elif inverse.is_a("IfcOwnerHistory"):
|
||||
self.file.remove(inverse)
|
||||
self.file.remove(self.settings["person_and_organisation"])
|
||||
|
||||
Reference in New Issue
Block a user