From 50ed75635344c838d0df0870812da94d94c4ce7f Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Mon, 3 Feb 2025 16:04:56 +1100 Subject: [PATCH] Found out layer names don't exist in IFC2X3 that's incredible --- .../ifcopenshell/api/material/add_layer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ifcopenshell-python/ifcopenshell/api/material/add_layer.py b/src/ifcopenshell-python/ifcopenshell/api/material/add_layer.py index 8284d641f2..5fae2ed275 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/material/add_layer.py +++ b/src/ifcopenshell-python/ifcopenshell/api/material/add_layer.py @@ -85,7 +85,10 @@ def add_layer( """ unit_scale = ifcopenshell.util.unit.calculate_unit_scale(file) layers = list(layer_set.MaterialLayers or []) - layer = file.create_entity("IfcMaterialLayer", Material=material, LayerThickness=0.1 / unit_scale, Name=name) + if file.schema == "IFC2X3": + layer = file.create_entity("IfcMaterialLayer", Material=material, LayerThickness=0.1 / unit_scale) + else: + layer = file.create_entity("IfcMaterialLayer", Material=material, LayerThickness=0.1 / unit_scale, Name=name) layers.append(layer) layer_set.MaterialLayers = layers return layer