Add handlers to update layer when adding and removing material layer

This commit is contained in:
Bruno Perdigão
2025-01-20 16:48:47 -03:00
parent 325d6138d3
commit 3740b86678
4 changed files with 42 additions and 24 deletions
@@ -80,10 +80,11 @@ def add_layer(
# Great! Let's assign our material set to our wall type.
ifcopenshell.api.material.assign_material(model, products=[wall_type], material=material_set)
"""
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(file)
settings = {"layer_set": layer_set, "material": material}
layers = list(settings["layer_set"].MaterialLayers or [])
layer = file.create_entity("IfcMaterialLayer", **{"Material": settings["material"], "LayerThickness": 1.0})
layer = file.create_entity("IfcMaterialLayer", **{"Material": settings["material"], "LayerThickness": 0.1 / unit_scale})
layers.append(layer)
settings["layer_set"].MaterialLayers = layers
return layer