Error on tessellation request in IFC2X3

IfcTriangulatedFaceSet/IfcPolygonalFaceSet were introduced in
Fix #7992: IFC4 and do not exist in IFC2X3. Previously, requesting an
IfcTessellatedFaceSet representation in an IFC2X3 file silently
fell back to a faceted brep after unassigning material sets.
Add a guard in the update_representation operator (user-facing
error) and in the add_representation API (ValueError) so the
unsupported request is caught instead of failing silently.

Generated with the assistance of an AI coding tool.
This commit is contained in:
Ryan Schultz
2026-06-09 07:30:59 -05:00
parent 93c6350e0f
commit bfa2d789f1
2 changed files with 13 additions and 0 deletions
@@ -121,6 +121,12 @@ class Usecase:
blender_object: bpy.types.Object
def execute(self) -> Union[ifcopenshell.entity_instance, None]:
# IfcTriangulatedFaceSet/IfcPolygonalFaceSet were introduced in IFC4 and
# do not exist in IFC2X3. Without this guard create_mesh_representation()
# silently falls back to a faceted brep, ignoring the requested class.
if self.settings["ifc_representation_class"] == "IfcTessellatedFaceSet" and self.file.schema == "IFC2X3":
raise ValueError("Tessellated face sets (IfcTessellatedFaceSet) are not supported in IFC2X3.")
self.is_manifold = None
self.coordinate_offset = self.settings["coordinate_offset"]
self.geometry = self.settings["geometry"]