mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-28 15:53:00 +00:00
b71354ce19
Assigning a material to an occurrence with a set material type has raised "IfcMaterial cannot be assiged as a IfcMaterialLayerSetUsage" since the default changed to assigning usages to occurrences. The type is upgraded to a usage but the material is passed on unchanged, and material.assign_material only accepts a material for a usage when that material is already the set, whereas the Object Materials dropdown gives us a plain IfcMaterial. Pass nothing in that case and let the API make the set, as it does when asked for a usage with no material. Look the set up past the usage afterwards, so the material the user picked is added to it. get_material returns the usage, which is not a material set, so neither branch of the repair below matched and the picked material was dropped, leaving the set empty. This is a stopgap and is commented as such: the real problem is that assign_material builds sets with no items in them and ignores the material it was given, which is not valid IFC and leaves callers patching up after it. Also register "I evaluate expression" as a Then step. It has only ever been a Given and a When, so the last line of the scenario covering this could never run; it is the only Then of its kind in the suite. test/bim goes from 16 failures to 15, with none introduced. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>