ifcopenshell - bcf library

Hi all,

my first post here, so hello everbody!
While searching for bcf python libraries i've found the library within the ifcopenshell repo.
Wasn't aware of that... :)
I copied this folder to my site-packages folder:
https://github.com/IfcOpenShell/IfcOpenShell/tree/v0.7.0/src/bcf/src/bcf
Is that correct or is it necessary to install an other way?
I'm asking because i got an error when importing the bcfxml module.
Any help welcome!

Cheers
Marcus

Tagged:

Comments

  • That's correct, you may need some other dependencies like xsdata. What's the error you're getting?

  • The xsdata module is already installed.

    from bcf.bcfxml import load
    Traceback (most recent call last):
    File "", line 1, in
    File "C:\Users\nillma\AppData\Roaming\Python\Python38\site-packages\bcf\bcfxml.py", line 25, in
    from bcf.v2.bcfxml import BcfXml as BcfXml2
    File "C:\Users\nillma\AppData\Roaming\Python\Python38\site-packages\bcf\v2\bcfxml.py", line 8, in
    import bcf.v2.model as mdl
    File "C:\Users\nillma\AppData\Roaming\Python\Python38\site-packages\bcf\v2\model__init__.py", line 1, in
    from bcf.v2.model.markup import (
    File "C:\Users\nillma\AppData\Roaming\Python\Python38\site-packages\bcf\v2\model\markup.py", line 7, in
    @dataclass(slots=True, kw_only=True)
    TypeError: dataclass() got an unexpected keyword argument 'slots'

  • I found the cause of the error. I'm using Python 3.8.8 and Python 3.10 seems to be is neccesary.
    The dataclass module in P 3.10 has enhanced keywords.
    Unlucky me since my CAD uses embedded Python 3.8.8.
    :)

  • @mcnill oh dear, we actually had a debate on whether or not we should support older Python versions, and we concluded that for stuff like bcf since it was relatively new we decided not to bother with legacy support. BTW if you want a BCF that does support older versions, you can jump back in commit history to like a month ago and use the old BCF system, it lacks a few neat features (mostly speed increases from I/O minimisation) from the new one but is functional.

  • @Moult Thank you for your response!
    I'll have a look into the older version.

Sign In or Register to comment.