Merge pull request #8554 from sboddy/fixes-for-ci-tests

Fix ifcopenshell-python test drift (4 CI failures traced to root cause)
This commit is contained in:
sboddy
2026-07-18 20:31:05 +01:00
committed by GitHub
7 changed files with 74 additions and 53 deletions
@@ -196,13 +196,25 @@ class Usecase:
allowed_occurrences = set(
ifcopenshell.util.type.get_applicable_entities(relating_type.is_a(), schema=self.file.schema)
)
schema = ifcopenshell.schema_by_name(self.file.schema)
# The implementer agreement map has no entry for the abstract
# IfcTypeProduct, which Bonsai uses for annotation types. The schema
# itself defines IfcTypeProduct.ApplicableOccurrence for exactly this
# purpose, so honor it when the leading class token is a valid entity.
if applicable_occurrence := getattr(relating_type, "ApplicableOccurrence", None):
occurrence_class = applicable_occurrence.split("/", 1)[0]
schema = ifcopenshell.schema_by_name(self.file.schema)
try:
schema.declaration_by_name(occurrence_class)
allowed_occurrences.add(occurrence_class)
except RuntimeError:
pass
# The map only covers physical product occurrence/type pairs (e.g.
# IfcWallType -> IfcWall). Process and resource types (IfcTaskType,
# IfcCrewResourceType, ...) aren't in it, but the schema's universal
# Type-suffix naming convention gives the same pairing directly.
if (type_class := relating_type.is_a()).endswith("Type"):
occurrence_class = type_class[: -len("Type")]
try:
schema.declaration_by_name(occurrence_class)
allowed_occurrences.add(occurrence_class)
+1 -1
View File
@@ -548,7 +548,7 @@ def main(
arranged = W.arrange_polygons(
*filter(None, (ARRANGE_POLYGON_SETTINGS,)),
polies, # ty: ignore[too-many-positional-arguments]
polies,
*((logger,) if logger is not None else ()),
)
svg_data_3 = W.polygons_to_svg(arranged, False)
@@ -2,7 +2,7 @@ ISO-10303-21;
HEADER;
FILE_DESCRIPTION(('ViewDefinition [CoordinationView]','RevitIdentifiers [ContentGUID: a0df3484-2dab-42c5-b806-8c10d313bee0, VersionGUID: 658c1394-f3a4-43d1-9b3c-eee44a0cd67a, NumberOfSaves: 2]','CoordinateReference [CoordinateBase: Shared Coordinates]'),'2;1');
FILE_NAME('Column_4x3.ifc','2025-03-12T13:53:30+00:00',(''),(''),'ODA SDAI 24.12','Autodesk Revit 25.4.0.32 (ENG) - IFC 25.4.0.32','');
FILE_SCHEMA(('IFC2X3'));
FILE_SCHEMA(('IFC4'));
ENDSEC;
DATA;
#1=IFCORGANIZATION($,'Autodesk Revit 2025 (ENG)',$,$,$);