B
by bernd on 5 Nov 2021, edited 16 Nov 2021
#
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
M
by Moult on 6 Nov 2021
#
+1 votes
@bernd ifcopenshell.util.element.get_material(element, should_skip_usage=True or False you choose)
B
by bernd on 8 Nov 2021, edited 8 Nov 2021
#
works great. Setting the material Name works too :-)
What does the parameter "should_skip_usage" do?
B
by bernd on 9 Nov 2021, edited 9 Nov 2021
#
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
M
by Moult on 9 Nov 2021
#
+1 votes
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.
M
by Moult on 16 Nov 2021
#
+3 votes
... and we now have an ifcopenshell.util.element.get_layers()
! https://github.com/IfcOpenShell/IfcOpenShell/commit/41486ba08a3ddcbd5dd40a086dd9b96ca6a3fbaa