mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 02:47:48 +00:00
Implement adding, editing, and removing time lags to sequence relationships
This commit is contained in:
@@ -1,13 +1,18 @@
|
||||
import ifcopenshell.util.date
|
||||
|
||||
|
||||
class Usecase:
|
||||
def __init__(self, file, **settings):
|
||||
self.file = file
|
||||
self.settings = {"rel_sequence": None, "attributes": {}}
|
||||
self.settings = {"lag_time": None, "attributes": {}}
|
||||
for key, value in settings.items():
|
||||
self.settings[key] = value
|
||||
|
||||
def execute(self):
|
||||
for name, value in self.settings["attributes"].items():
|
||||
if name == "LagValue" and value is not None:
|
||||
# TODO: support RatioMeasure
|
||||
value = self.file.createIfcDuration(value)
|
||||
setattr(self.settings["rel_sequence"], name, value)
|
||||
if isinstance(value, float):
|
||||
value = self.file.createIfcRatioMeasure(value)
|
||||
else:
|
||||
value = self.file.createIfcDuration(ifcopenshell.util.date.datetime2ifc(value, "IfcDuration"))
|
||||
setattr(self.settings["lag_time"], name, value)
|
||||
|
||||
Reference in New Issue
Block a user