This commit is contained in:
Vukas Pajic
2023-04-17 13:50:02 +02:00
committed by Dion Moult
parent 8ae7763ac5
commit d333090b09
+8 -12
View File
@@ -202,15 +202,14 @@ class Specification:
elements = []
if self.applicability:
for i, facet in enumerate(self.applicability):
# Usually, we rely on an entity applicability to give us our first
# shortlist of elements, as it's the most efficient way to filter
# elements. If this does not exist, then we have no choice but to
# check everything.
if i == 0 and not isinstance(facet, Entity):
elements = list(ifc_file)
elements = facet.filter(ifc_file, elements)
for i, facet in enumerate(self.applicability):
# Usually, we rely on an entity applicability to give us our first
# shortlist of elements, as it's the most efficient way to filter
# elements. If this does not exist, then we have no choice but to
# check everything.
if i == 0 and not isinstance(facet, Entity):
elements = list(ifc_file)
elements = facet.filter(ifc_file, elements)
for element in elements:
is_applicable = True
@@ -239,7 +238,6 @@ class Specification:
facet.status = bool(facet.failed_entities)
self.status = True
# if spec is required
if self.minOccurs != 0:
if not self.applicable_entities:
self.status = False
@@ -247,11 +245,9 @@ class Specification:
facet.status = False
elif self.failed_entities:
self.status = False
# if spec is optional
elif self.minOccurs == 0 and self.maxOccurs != 0:
if self.failed_entities:
self.status = False
# if spec is prohibited
elif self.maxOccurs == 0:
if (len(self.applicable_entities)) > 0 and len(self.requirements) == 0:
self.status = False