mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
sequence.assign_recurrence_pattern - fix bug assigning pattern to a task time recurring
It wasn't considering that IfcTaskTimeRecurring might be just created and IfcTaskTimeRecurring.Recurrence is None resulting in error below
File "\api\sequence\assign_recurrence_pattern.py", line 120, in assign_recurrence_pattern
if len(file.get_inverse(settings["parent"].Recurrence)) == 1:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\file.py", line 524, in get_inverse
inverses = [entity_instance(e, self) for e in self.wrapped_data.get_inverse(inst.wrapped_data)]
AttributeError: 'NoneType' object has no attribute 'wrapped_data'
This commit is contained in:
@@ -117,7 +117,7 @@ def assign_recurrence_pattern(
|
||||
file.remove(settings["parent"].RecurrencePattern)
|
||||
settings["parent"].RecurrencePattern = recurrence
|
||||
elif settings["parent"].is_a("IfcTaskTimeRecurring"):
|
||||
if len(file.get_inverse(settings["parent"].Recurrence)) == 1:
|
||||
file.remove(settings["parent"].Recurrence)
|
||||
if recurrence_old := settings["parent"].Recurrence and len(file.get_inverse(recurrence_old)) == 1:
|
||||
file.remove(recurrence_old)
|
||||
settings["parent"].Recurrence = recurrence
|
||||
return recurrence
|
||||
|
||||
Reference in New Issue
Block a user