OSArch Community

get all BuildingSmart smart properties for an object

  1. B
  2. C

    Something like this? Just tested it on the Schependomlaan.ifc

    
    import ifcopenshell
    
    from blenderbim.bim.ifc import IfcStore
    
    
    ifc_file = ifcopenshell.open(IfcStore.path)
    
    products = ifc_file.by_type('IfcDoor')
    
    
    for ifcproduct in products:
    
        if ifcproduct.IsDefinedBy:        
    
            for ifcreldefinesbyproperties in ifcproduct.IsDefinedBy:
    
                if (ifcreldefinesbyproperties.is_a()) == 'IfcRelDefinesByProperties':
    
                    if ifcreldefinesbyproperties.RelatingPropertyDefinition.is_a() == 'IfcPropertySet':
    
                        for ifcproperty in (ifcreldefinesbyproperties.RelatingPropertyDefinition.HasProperties):
    
                            print (ifcproduct.Name, ifcreldefinesbyproperties.RelatingPropertyDefinition.Name, ifcproperty)
    

    Section of output:

    
    ...
    
    D1L AC_Pset_32_KD_berkvens_BA #978576=IfcPropertySingleValue('openingshoek 2d',$,IfcPlaneAngleMeasure(15.),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978577=IfcPropertySingleValue('arcering kozijn',$,IfcLabel('000 Ddichte arcering (01)'),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978578=IfcPropertySingleValue('arcering kozijnachtergrond',$,IfcLabel('Lege arcering (2)'),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978579=IfcPropertySingleValue('pen contourlijn kozijn',$,IfcLabel('Standaardpen'),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978580=IfcPropertySingleValue('pen acchergrondarcering',$,IfcLabel('Achtergrond wit - NIET WIJZIGEN'),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978581=IfcPropertySingleValue('pen acchergrondarcering kozijn',$,IfcLabel('Standaardpen'),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978582=IfcPropertySingleValue('pen acering deurzijde',$,IfcLabel('Achtergrond wit - NIET WIJZIGEN'),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978583=IfcPropertySingleValue('pen arcering dorpelzijde',$,IfcLabel('Achtergrond wit - NIET WIJZIGEN'),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978584=IfcPropertySingleValue('deurarcering',$,IfcLabel('310 naaldhout (01)'),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978585=IfcPropertySingleValue('pen arcering deur',$,IfcLabel('Standaardpen'),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978586=IfcPropertySingleValue('openingshoek 3d',$,IfcPlaneAngleMeasure(0.),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978587=IfcPropertySingleValue('openingslijnen',$,IfcLabel('beiden'),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978588=IfcPropertySingleValue('deurdorpel',$,IfcBoolean(.F.),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978589=IfcPropertySingleValue('materiaal dorpel',$,IfcLabel('RAL 9005 '),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978590=IfcPropertySingleValue('bovenlichttype',$,IfcLabel('glas'),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978591=IfcPropertySingleValue('materiaal bovenlicht glas',$,IfcLabel('Glas - blauw'),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978592=IfcPropertySingleValue('materiaal bovenlicht paneel',$,IfcLabel('RAL 9010 '),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978593=IfcPropertySingleValue('neuslat links (scharnierzijde)',$,IfcBoolean(.F.),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978594=IfcPropertySingleValue('neuslat rechts (scharnierzijde',$,IfcBoolean(.T.),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978595=IfcPropertySingleValue('materiaal neuslatten',$,IfcLabel('Verf - wit'),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978596=IfcPropertySingleValue('kruk en schild',$,IfcBoolean(.T.),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978597=IfcPropertySingleValue('materiaal kruk en schild',$,IfcLabel('Metaal - Roestvrijstaal'),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978598=IfcPropertySingleValue('slottype',$,IfcLabel('loopslot'),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978599=IfcPropertySingleValue('materiaal cilinder',$,IfcLabel('Metaal - Roestvrijstaal'),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978600=IfcPropertySingleValue('materiaal deur',$,IfcLabel('RAL 9001'),$)
    
    D1L AC_Pset_32_KD_berkvens_BA #978601=IfcPropertySingleValue('materiaal kozijn',$,IfcLabel('RAL 9010 '),$)
    
    D1L AC_Pset_RenovationAndPhasing #978607=IfcPropertySingleValue('Renovation Status',$,IfcLabel('New'),$)
    
    D1L Pset_DoorCommon #978613=IfcPropertySingleValue('IsExternal',$,IfcBoolean(.F.),$)
    
    ...
    
  3. B

    another question in this regard. AFAIK BuildingSmart defines property names in different main world languarges. I could not find them on the page linked in the post before.

  4. P

    I would like to try similar in FreeCAD :D

    @bernd Any idea what is equivalent in FreeCAD

    from blenderbim.bim.ifc import IfcStore

    Thanks

  5. B

    No not all properties from a model like Schependomlaanbut but all properties BuildingSmart has defined for an IfcDoor in ifc schema 4x3. That is why I posted the link. I would like to have all possible BuildingSmart properties in a list.

  6. B
  7. B
  8. B
  9. B

    Following the psets for IFC4 but how do I get them for IFC version 4.3

    import ifcopenshell.util.pset
    
    from ifcopenshell import util
    
    pset_qto = util.pset.PsetQto("IFC4")
    
    all_psets = pset_qto.get_applicable_names("IfcDoor")
    
    
    
    for pset in all_psets:
    
        print(pset)
    
    
    
    
    >>> import ifcopenshell.util.pset
    
    >>> from ifcopenshell import util
    
    >>> pset_qto = util.pset.PsetQto("IFC4")
    
    >>> all_psets = pset_qto.get_applicable_names("IfcDoor")
    
    >>> 
    
    >>> for pset in all_psets:
    
    ...     print(pset)
    
    ... 
    
    Pset_EnvironmentalImpactIndicators
    
    Pset_EnvironmentalImpactValues
    
    Pset_DoorCommon
    
    Pset_DoorWindowGlazingType
    
    Qto_DoorBaseQuantities
    
    Pset_Condition
    
    Pset_ManufacturerOccurrence
    
    Pset_ManufacturerTypeInformation
    
    Pset_ServiceLife
    
    Pset_Warranty
    
    >>> 
  10. B

    for IFC4x3 I get error key does not exist

    >>> util.pset.PsetQto("IFC4x3").get_applicable_names("IfcDoor")
    
    Traceback (most recent call last):
    
      File "<input>", line 1, in <module>
    
      File "C:\0_BHA_privat\progr\FreeCAD\FreeCAD_0.21.xxxxx\bin\lib\site-packages\ifcopenshell\util\pset.py", line 47, in __init__
    
        path = str(folder_path.joinpath("schema", self.templates_path[schema]))
    
    KeyError: 'IFC4x3'
    
    >>> 
  11. P

    Thanks Bernd, it works in FreeCAD also :D

  12. M

    @bernd IFC4X3 pset support was added a few months ago. Note that you have to specify "IFC4X3" with a capital X, not lowercase.

    
    >>> ifcopenshell.util.pset.PsetQto("IFC4X3").get_applicable_names("IfcDoor")
    
    ['Pset_Condition', 'Pset_ConstructionAdministration', 'Pset_ConstructionOccurence', 'Pset_DoorCommon', 'Pset_DoorWindowGlazingType', 'Pset_ElementKinematics', 'Pset_EnvironmentalCondition', 'Pset_EnvironmentalImpactIndicators', 'Pset_EnvironmentalImpactValues', 'Pset_InstallationOccurrence', 'Pset_MaintenanceStrategy', 'Pset_MaintenanceTriggerCondition', 'Pset_MaintenanceTriggerDuration', 'Pset_MaintenanceTriggerPerformance', 'Pset_ManufacturerOccurrence', 'Pset_ManufacturerTypeInformation', 'Pset_ProcessCapacity', 'Pset_RepairOccurrence', 'Pset_Risk', 'Pset_ServiceLife', 'Pset_Tolerance', 'Pset_Uncertainty', 'Pset_Warranty', 'Qto_BodyGeometryValidation', 'Qto_DoorBaseQuantities']
    

    Ping @yorik you might want to delete https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Arch/Presets/pset_definitions.csv and use the IfcOpenShell util instead that way it is always up to date.

  13. P

    @Moult Seems not working in FreeCAD ?

    import ifcopenshell.util.pset

    ifcopenshell.util.pset.PsetQto("IFC4X3")

    Traceback (most recent call last):

    File "<input>", line 1, in <module>

    File "/home/paullee/Downloads/FreeCAD_weekly-builds-33071-2023-05-04-conda-Linux-x86_64-py311/squashfs-root/usr/lib/python3.11/site-packages/ifcopenshell/util/pset.py", line 47, in init

    path = str(folder_path.joinpath("schema", self.templates_path[schema]))
    
                                              ~~~~~~~~~~~~~~~~~~~^^^^^^^^

    KeyError: 'IFC4X3'

    ifcopenshell.util.pset.PsetQto("IFC4X3").get_applicable_names("IfcDoor")

    Traceback (most recent call last):

    File "<input>", line 1, in <module>

    File "/home/paullee/Downloads/FreeCAD_weekly-builds-33071-2023-05-04-conda-Linux-x86_64-py311/squashfs-root/usr/lib/python3.11/site-packages/ifcopenshell/util/pset.py", line 47, in init

    path = str(folder_path.joinpath("schema", self.templates_path[schema]))
    
                                              ~~~~~~~~~~~~~~~~~~~^^^^^^^^

    KeyError: 'IFC4X3

  14. M
  15. P

    @Moult Thanks, I am trying to check whilst I see your remarks above, not sure the correct way to do it though at the moment. referring to FreeCAD wiki https://wiki.freecad.org/IfcOpenShell

    @yorik Could you comment please?

    Thanks :)

    ifcopenshell.ifcopenshell.version

    'v0.7.0-07ee62eb9'

    It is python 3.10

    ifcopenshell.path

    ['/home/paullee/.local/lib/python3.10/site-packages/ifcopenshell']

  16. M

    07ee62eb9 is Jan 18. So yes, it is outdated. From the path it seems as though your IfcOpenShell is on your system (i.e. not tied to FreeCAD). You can upgrade using these instructions https://blenderbim.org/docs-python/ifcopenshell-python/installation.html#pre-built-packages

    It seems as though the FreeCAD Wiki can (should?) point to the install docs here instead https://blenderbim.org/docs-python/ifcopenshell-python/installation.html which is kept up to date and includes a few more methods of installation.

  17. Y

    IfcOpenShell is bundled with the stable installers of FreeCAD. Basically the latest available version at this point. But indeed after several months users find themselves with a rather old version...

    This wasn't really a problem until now, because the standard IFC import/exporter bundled with FreeCAD/Arch uses pretty much standard features, but now with NativeIFC we use extreme advanced features, that's how bold we are ?...

    Maybe it's time to change this, ex. download IfcOpenShell at run time? Since FreeCAD 0.21 is about to be released I think it's best not to change that just now, but after that it might be interesting to look at it.

    Indeed the blenderbim install page should be mentioned on the wiki.. will do that now

  18. P

    @yorik I am not sure the version outcome I reported is that bundled with FreeCAD AppImage I use - as FC seems use 3.11, but ifcopenshell report 3.10.

    I have Fedora version installed also so not sure if it confused Appimage.

    I may test again - or you are sure it is the same versiom (outdated as Moult pointed out ?

  19. P

    OK, @yorik it turns out an earlier AppImage version run python 11 (FreeCAD_weekly-builds-33071-2023-05-04-conda-Linux-x86_64-py311); later all python 310. Why?

    Anyway, it does not run the 'system ifconpenshell' but the 'bundled one with AppImage, but it only return -

    ifcopenshell.version

    '0.7.0'

    ifcopenshell.path

    ['/home/paullee/Downloads/FreeCAD_weekly-builds-33071-2023-05-04-conda-Linux-x86_64-py311/squashfs-root/usr/lib/python3.11/site-packages/ifcopenshell']

    @Moult Any further command to return anything more than '0.7.0' ? (Though this version also returns KeyError : 'IFC4X3')

  20. P

    'pip list' on my Fedora 36 command prompt return

    'ifcopenshell 0.7.0.230218'

  21. Y

    Definitely you need an ifcopenshell compiled with the same python version of FreeCAD. Not sure why one appimage had py11 and the others not... maybe there was some bug with py11 at that time. Also i'm not sure if an appimage can use system python packages... if not, that's annoying, but there might still pe a way to place manually the ifcopenshell folder in one of the python sys.path

  22. P

    No worry about python version :)

    Just tested the latest AppImage released yesterday - have 'pip uninstall' the 'system' ifcopenshell, and in FC python console it import the bundled ifcopenshell - But it sill have the KeyError : 'IFC4X3'.

    Need to wait until FC bundle with latest ifcopenshell :D

  23. Y

    what about installing a blenderbim package in one of the sys.path folders ?

  24. P

    Now I am not sure ... @Moult

    1. I download the pre-built package from https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-310-v0.7.0-476ab50-linux64.zip

    2. Then, put in the /home/paullee/.local/lib/python3.10

    3. Import in FreeCAD console seems would load this version (rather than FC bundled one)

    4. Everything is fine but still KeyError :D

    "Python 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:55:59) [GCC 12.3.0] on linux

    Type 'help', 'copyright', 'credits' or 'license' for more information.

    import ifcopenshell

    ifcopenshell.version

    'v0.7.0-476ab506d'

    ifcopenshell.path

    ['/home/paullee/.local/lib/python3.10/site-packages/ifcopenshell']

    import ifcopenshell.util.pset

    ifcopenshell.util.pset.PsetQto("IFC4X3")

    Traceback (most recent call last):

    File "<input>", line 1, in <module>

    File "/home/paullee/.local/lib/python3.10/site-packages/ifcopenshell/util/pset.py", line 47, in init

    path = str(folder_path.joinpath("schema", self.templates_path[schema]))

    KeyError: 'IFC4X3'

    (sorry, off-topic too long)

  25. A
  1. Page 1
  2. 2

Login or Register to reply.