E
by Enrr on 24 May 2024, edited 25 May 2024
#
Hi, developping a small scale IDS writer on python.
I use the bSDD database to have a list of the possible entities.
Then from bSDD I can retrieve all the properties and Psets from an entity (to allow the user to not having to go on internet, and copy pasting the specific pset he wants, without making a typing error). The problem is that these properties don't have the correct datatype ("String" instead of IfcLabel or any other).
I was wondering if it is possible to use the IfcOpenshell module (or any other tool), to retrieve this information (input : bSDD identifier of the property - output: datatype)
I don't want to download the IFC schema because it is not the aim to have the data in a folder.
A
by Andrej730 on 24 May 2024
#
+2 votes
Maybe ifcopenshell.util.attribute.get_primitive_type
can help - https://github.com/IfcOpenShell/IfcOpenShell/blob/7a44f9e8a709a0be92ed235906677fd472c06223/src/ifcopenshell-python/ifcopenshell/util/attribute.py#L23-L55
Example (more examples you can find in ifcopenshell codebase).
import ifcopenshell.util.attribute
ifc_file = ifcopenshell.file()
wall = ifc_file.create_entity("IfcWall")
attr = wall.wrapped_data.declaration().as_entity().attribute_by_index(0)
# <attribute GlobalId: <type IfcGloballyUniqueId: <string>>> string
print(attr, ifcopenshell.util.attribute.get_primitive_type(attr))
M
by Moult on 25 May 2024
#
The ifcopenshell.util.pset utility also lets you grab pset templates and their data types.