ifcopenshell, get Material Name
Hi there,
is there a possibility in ifcopenshell to directly get the material name of a building element easily? Similar to the great get_psets() method.
cheers Bernd
BTW: in FreeCAD we use this ... https://github.com/FreeCAD/FreeCAD/blob/916fe37a6b757e3bf6d51fb65ebc412243125d8e/src/Mod/Arch/importIFCHelper.py#L239-L257
Comments
@bernd
ifcopenshell.util.element.get_material(element, should_skip_usage=True or False you choose)
works great. Setting the material Name works too :-)
What does the parameter "should_skip_usage" do?
Just to be sure ... There is no
ifcopenshell.util.element.get_layer()
in https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/src/ifcopenshell-python/ifcopenshell/util/element.py or is there some other short smart way to get the layer.FreeCAD code for layer:
https://github.com/FreeCAD/FreeCAD/blob/916fe37a6b757e3bf6d51fb65ebc412243125d8e/src/Mod/Arch/importIFC.py#L404-L411
cheers bernd
Sorry no layer utility. PR welcome :)
The
should_skip_usage
determines if you want to skip the material set usage and jump straight to the material set. Usages are per instance, so sometimes its not what you're after.https://github.com/IfcOpenShell/IfcOpenShell/pull/1869
... and we now have an
ifcopenshell.util.element.get_layers()
! https://github.com/IfcOpenShell/IfcOpenShell/commit/41486ba08a3ddcbd5dd40a086dd9b96ca6a3fbaa