mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
len(get_inverse) -> get_total_inverses
This commit is contained in:
@@ -83,7 +83,7 @@ def assign_lag_time(
|
||||
duration = file.create_entity("IfcDuration", ifcopenshell.util.date.datetime2ifc(lag_value, "IfcDuration"))
|
||||
lag_time = file.create_entity("IfcLagTime", DurationType=duration_type, LagValue=duration)
|
||||
if rel_sequence.is_a("IfcRelSequence"):
|
||||
if rel_sequence.TimeLag and len(file.get_inverse(rel_sequence.TimeLag)) == 1:
|
||||
file.remove(rel_sequence.TimeLag)
|
||||
if (current_lag_time := rel_sequence.TimeLag) and file.get_total_inverses(current_lag_time) == 1:
|
||||
file.remove(current_lag_time)
|
||||
rel_sequence.TimeLag = lag_time
|
||||
return lag_time
|
||||
|
||||
@@ -108,11 +108,11 @@ def assign_recurrence_pattern(
|
||||
recurrence = file.create_entity("IfcRecurrencePattern", recurrence_type)
|
||||
|
||||
if parent.is_a("IfcWorkTime"):
|
||||
if parent.RecurrencePattern and len(file.get_inverse(parent.RecurrencePattern)) == 1:
|
||||
file.remove(parent.RecurrencePattern)
|
||||
if (old_recurrence := parent.RecurrencePattern) and file.get_total_inverses(old_recurrence) == 1:
|
||||
file.remove(old_recurrence)
|
||||
parent.RecurrencePattern = recurrence
|
||||
elif parent.is_a("IfcTaskTimeRecurring"):
|
||||
if (recurrence_old := parent.Recurrence) and len(file.get_inverse(recurrence_old)) == 1:
|
||||
if (recurrence_old := parent.Recurrence) and file.get_total_inverses(recurrence_old) == 1:
|
||||
file.remove(recurrence_old)
|
||||
parent.Recurrence = recurrence
|
||||
return recurrence
|
||||
|
||||
@@ -55,8 +55,8 @@ def unassign_lag_time(file: ifcopenshell.file, rel_sequence: ifcopenshell.entity
|
||||
# What if you didn't?
|
||||
ifcopenshell.api.sequence.unassign_lag_time(model, rel_sequence=sequence)
|
||||
"""
|
||||
if len(file.get_inverse(rel_sequence.TimeLag)) == 1:
|
||||
file.remove(rel_sequence.TimeLag)
|
||||
if file.get_total_inverses((current_lag_time := rel_sequence.TimeLag)) == 1:
|
||||
file.remove(current_lag_time)
|
||||
else:
|
||||
rel_sequence.TimeLag = None
|
||||
ifcopenshell.api.sequence.cascade_schedule(file, task=rel_sequence.RelatedProcess)
|
||||
|
||||
Reference in New Issue
Block a user