Feature to create IfcTask trees for entities of IfcWorkSchedule

This commit is contained in:
bosonprojets
2021-04-18 00:49:43 +00:00
parent f5d27621e7
commit 3201c234fa
8 changed files with 196 additions and 96 deletions
@@ -1,16 +1,12 @@
import ifcopenshell.api
import ifcopenshell
class Usecase:
def __init__(self, file, **settings):
self.file = file
self.settings = {
"name": None,
"predefined_type": "NOTDEFINED",
"is_milestone": False,
"identification": "none",
"predecessor_to": None,
"successor_from": None,
"work_schedule": None,
"parent_task": None,
}
for key, value in settings.items():
self.settings[key] = value
@@ -20,8 +16,23 @@ class Usecase:
"root.create_entity",
self.file,
ifc_class="IfcTask",
predefined_type=self.settings["predefined_type"],
name=self.settings["name"],
name= None,
predefined_type= "NOTDEFINED",
identification= "none",
)
task.IsMilestone = self.settings["is_milestone"]
task.IsMilestone = False
if self.settings["work_schedule"]:
self.file.create_entity(
"IfcRelAssignsToControl",
**{
"GlobalId": ifcopenshell.guid.new(),
"OwnerHistory": ifcopenshell.api.run("owner.create_owner_history", self.file),
"RelatedObjects": [task],
"RelatingControl": self.settings["work_schedule"],
}
)
elif self.settings["parent_task"]:
ifcopenshell.api.run(
"nest.assign_object", self.file, object=task, relating_object=self.settings["parent_task"]
)
return task