diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/get_related_products.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/get_related_products.py index b46c17c485..26ad4af7fa 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/sequence/get_related_products.py +++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/get_related_products.py @@ -70,7 +70,7 @@ class Usecase: elif self.settings["relating_product"]: for reference in self.settings["relating_product"].ReferencedBy: if reference.is_a("IfcRelAssignsToProduct"): - related_object = referenced_by.RelatedObjects[0] + related_object = reference.RelatedObjects[0] if related_object: assignments = self.settings["related_object"].HasAssignments for assignment in assignments: diff --git a/src/ifcopenshell-python/ifcopenshell/util/sequence.py b/src/ifcopenshell-python/ifcopenshell/util/sequence.py index b8ad222e8a..ebdedb5890 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/sequence.py +++ b/src/ifcopenshell-python/ifcopenshell/util/sequence.py @@ -18,6 +18,7 @@ import datetime import ifcopenshell.util.date +from math import floor from functools import lru_cache @@ -221,7 +222,7 @@ def is_work_time_applicable_to_day(work_time, day): return False # TODO elif recurrence.RecurrenceType == "MONTHLY_BY_POSITION": if not recurrence.Interval and not recurrence.Occurrences: - return (day.weekday() + 1) in recurrence.WeekdayComponent and math.floor( + return (day.weekday() + 1) in recurrence.WeekdayComponent and floor( day.day / 7 ) + 1 == recurrence["Position"] return False # TODO @@ -237,7 +238,7 @@ def is_work_time_applicable_to_day(work_time, day): return ( day.month in recurrence.MonthComponent and (day.weekday() + 1) in recurrence.WeekdayComponent - and math.floor(day.day / 7) + 1 == recurrence.Position + and floor(day.day / 7) + 1 == recurrence.Position ) return False # TODO