assign_representation - assign repr only to occurrence for profile- or layer-based types #6934

This commit is contained in:
Andrej730
2025-08-11 12:19:52 +05:00
parent f8f48796a9
commit 9f92e4853f
2 changed files with 37 additions and 1 deletions
@@ -41,6 +41,14 @@ class Usecase:
product_type
and product_type.RepresentationMaps
and representation.RepresentationType != "MappedRepresentation"
# Revit is adding a non-mapped representation to the exported profile-based types,
# so assigning representation to occurrence by accident was assigning it to the type.
# We guard from this by skipping profile and layer-based types.
# See 6934 for example.
and not (
(material := ifcopenshell.util.element.get_material(product_type))
and material.is_a() in ("IfcMaterialProfileSet", "IfcMaterialLayerSet")
)
):
product = product_type
@@ -60,7 +68,7 @@ class Usecase:
**{
"MappingOrigin": self.file.createIfcAxis2Placement3D(self.zero, self.z_axis, self.x_axis),
"MappedRepresentation": representation,
}
},
)
)
product.RepresentationMaps = maps