ifcopenshell, get a sorted list of all unique attribute values of a specific attribute of a ifc file

see discussion title. Is there some method for this somewhere in ifcopenshell already?

Comments

  • Depending on the attribute value data type.

    Assuemed I have a ifc file. For a specific attribute in this ifc file I would like to know for all occurrences of this attribute the value range. If the data type is bool and all occurrences have True it would be just True. If the data type is string and any occurrence of the attribute has a different value it would be a list of all these values. Hopefully you got the point.

    It should be not difficult to implement in Python, but if it is available I do not need to implement it.

  • @bernd ah I see. Unfortunately I don't know any existing code which does this, and also it seems a little complex. E.g. are you after attributes per IFC class, or do you also want to filter by property set name (which perhaps is more useful?). Let me know if you cook something up. I assume this is for an autocomplete function of sorts?

  • @Moult said:
    @bernd ah I see. Unfortunately I don't know any existing code which does this, and also it seems a little complex. E.g. are you after attributes per IFC class, or do you also want to filter by property set name (which perhaps is more useful?). Let me know if you cook something up. I assume this is for an autocomplete function of sorts?

    Did you end up getting any further with this? @bernd - This is a use case I scripted for myself in another software (Desite) - It helped to be able to see a list of all unique values given a particular property, this way you cold quickly see at a quick glance whether a model included non-specified values and/or irregular values. If not, i`d be happy to give it a shot.

  • edited October 2021

    Revisiting this thread, it can be accomplished using something like:

    def find_existing_attribute_values(ifc_file, element, i):
        results = set()
        for e in ifc_file.by_type(element.is_a()):
            results.add(e[i])
        return results
    

    Or did I miss something?

Sign In or Register to comment.