You can now add/remove material profiles in a profile set. Thanks Jesusbill!

This commit is contained in:
Dion Moult
2021-04-08 08:57:45 +10:00
parent 41141b8fc9
commit b821e62391
9 changed files with 62 additions and 13 deletions
@@ -1,6 +1,3 @@
import ifcopenshell
class Usecase:
def __init__(self, file, **settings):
self.file = file
@@ -1,6 +1,3 @@
import ifcopenshell
class Usecase:
def __init__(self, file, **settings):
self.file = file
@@ -0,0 +1,13 @@
class Usecase:
def __init__(self, file, **settings):
self.file = file
self.settings = {"profile_set": None, "material": None}
for key, value in settings.items():
self.settings[key] = value
def execute(self):
profiles = list(self.settings["profile_set"].MaterialProfiles or [])
profile = self.file.create_entity("IfcMaterialProfile", **{"Material": self.settings["material"]})
profiles.append(profile)
self.settings["profile_set"].MaterialProfiles = profiles
return profile
@@ -1,6 +1,3 @@
import ifcopenshell
class Usecase:
def __init__(self, file, **settings):
self.file = file
@@ -1,6 +1,3 @@
import ifcopenshell
class Usecase:
def __init__(self, file, **settings):
self.file = file
@@ -0,0 +1,9 @@
class Usecase:
def __init__(self, file, **settings):
self.file = file
self.settings = {"profile": None}
for key, value in settings.items():
self.settings[key] = value
def execute(self):
self.file.remove(self.settings["profile"])
@@ -14,5 +14,5 @@ class Usecase:
elif self.settings["type"] == "ExceptionTimes":
exception_times = list(self.settings["work_calendar"].ExceptionTimes or [])
exception_times.append(work_time)
self.settings["work_calendar"].WorkingTimes = exception_times
self.settings["work_calendar"].ExceptionTimes = exception_times
return work_time