mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
28 lines
917 B
Python
28 lines
917 B
Python
|
|
import ifcopenshell
|
||
|
|
import ifcopenshell.api
|
||
|
|
|
||
|
|
|
||
|
|
class Usecase:
|
||
|
|
def __init__(self, file, **settings):
|
||
|
|
self.file = file
|
||
|
|
self.settings = {
|
||
|
|
"relating_process": None,
|
||
|
|
"related_process": None,
|
||
|
|
}
|
||
|
|
for key, value in settings.items():
|
||
|
|
self.settings[key] = value
|
||
|
|
|
||
|
|
def execute(self):
|
||
|
|
for rel in self.settings["related_process"].IsSuccessorFrom or []:
|
||
|
|
if rel.RelatingProcess == self.settings["relating_process"]:
|
||
|
|
return rel
|
||
|
|
return self.file.create_entity(
|
||
|
|
"IfcRelSequence",
|
||
|
|
**{
|
||
|
|
"GlobalId": ifcopenshell.guid.new(),
|
||
|
|
"OwnerHistory": ifcopenshell.api.run("owner.create_owner_history", self.file),
|
||
|
|
"RelatingProcess": self.settings["relating_process"],
|
||
|
|
"RelatedProcess": self.settings["related_process"],
|
||
|
|
}
|
||
|
|
)
|