get all BuildingSmart smart properties for an object
BuildingSmart defines dozens of PSets and properties for a IfcDoor : https://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/lexical/IfcDoor.htm#6.1.3.16.5-Property-sets
Is it possible to get them by python in IfcOpenShell somehow to furter process them
Comments
Something like this? Just tested it on the Schependomlaan.ifc
Section of output:
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.
I would like to try similar in FreeCAD :D
@bernd Any idea what is equivalent in FreeCAD
Thanks
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.
I FreeCAD I found this list https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Arch/Presets/pset_definitions.csv I do not know if similar exist in BlenderBIM or where does BlenderBIM gets its Property names from?
related ... https://github.com/IfcOpenShell/IfcOpenShell/issues/953
https://wiki.osarch.org/index.php?title=IfcOpenShell_code_examples#Exploring_IFC_schema but somehow it does not find all properties defined in IFC4.3
Following the psets for IFC4 but how do I get them for IFC version 4.3
for IFC4x3 I get error key does not exist
Thanks Bernd, it works in FreeCAD also :D
@bernd IFC4X3 pset support was added a few months ago. Note that you have to specify "IFC4X3" with a capital X, not lowercase.
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.
@Moult Seems not working in FreeCAD ?
Traceback (most recent call last):
File "", line 1, in
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'
Traceback (most recent call last):
File "", line 1, in
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
@paullee IFC4X3 should be in the templates path: https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/src/ifcopenshell-python/ifcopenshell/util/pset.py#L42
If it doesn't, that means FreeCAD perhaps ships an outdated version of IfcOpenShell. That functionality was added a few months ago. I'm not sure how FreeCAD bundles IfcOpenShell.
@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 :)
'v0.7.0-07ee62eb9'
It is python 3.10
['/home/paullee/.local/lib/python3.10/site-packages/ifcopenshell']
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.
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
@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 ?
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 -
'0.7.0'
['/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')
'pip list' on my Fedora 36 command prompt return
'ifcopenshell 0.7.0.230218'
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
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
what about installing a blenderbim package in one of the sys.path folders ?
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.
'v0.7.0-476ab506d'
['/home/paullee/.local/lib/python3.10/site-packages/ifcopenshell']
Traceback (most recent call last):
File "", line 1, in
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)
@paullee
ifcopenshell-python-310-v0.7.0-476ab50-linux64.zip
is still outdatedhttps://github.com/IfcOpenShell/IfcOpenShell/commit/476ab506d is Feb 15
pset library for ifc4x3 was added at Feb 23 - https://github.com/IfcOpenShell/IfcOpenShell/commit/708dc6a
I apologise, the docs haven't been regenerated in a while, my bad. The good news is that there is a new build out literally yesterday:
https://github.com/IfcOpenBot/IfcOpenShell/commit/fc50bdd3a0354cf332ad846f0a336a9bbfd4a769
Note that we won't update the docs just yet, since there is a release today and the build contains some potentially dangerous changes related to drawing generation, so it might only be updated in another few weeks after testing.
Thanks Moult, the pre-built zip is updated today right?
I'll try again.
(Compiling is too demanding to me :) )
OK @Moult, the link you point to has the latest build.
(The blenderbim link https://blenderbim.org/docs-python/ifcopenshell-python/installation.html still point to outdated build)
Some message return on importing -
No stream support: No module named 'lark'
But it seems "IFC4X3" working, thanks !
'v0.7.0-fc50bdd3a'
<ifcopenshell.util.pset.PsetQto object at 0x7f3955436d70>
Indeed, stream support was just added (we might delay the import to prevent that annoying message). We'll delay regenerating the docs for a few weeks.