If you're reading this, we've just migrated servers! If anything looks broken please email dion@thinkmoult.com :)

New BCF library available in IfcOpenShell for devs

edited March 2021 in General

A quick primer for those new to BCF. BCF (BIM Collaboration Format) is a specification to transfer issues about a model. It's basically a standardisation of a typical software development bugtracker fields like issue name, issue description, priority, assigned, due, etc. However, it has a few additional AEC specific things like viewpoints (i.e. camera angles of the problem), snapshots (screenshots of the problem), screen-space markups like lines and images, and construction phase, etc. Also, for whatever reason instead of calling it an issue or bug, they call it a "topic". It's the same concept though.

We totally need a article on this on the OSArch wiki.

Anyway, previously the only FOSS BCF lib I was aware of (at least for Python - there is an old C# one part of BCFier) is bcfplugin, built as a GSoC project for FreeCAD's BCF feature. There are, however, some issues.

  1. bcfplugin is unmaintained. I've fixed a few issues here and there but really nobody is looking at it. Some unit tests don't run.
  2. bcfplugin is huge. It's over 8,000 lines of code. And that's excluding FreeCAD GUI code (I already decoupled it), and excluding unit tests. Relative to the simplicity of the BCF spec, this is really hard to maintain.
  3. bcfplugin only supports BCF-XML. BCF data can be transferred in different ways - one way is via saving and reading into .bcf files which are simply small zipped folders with XML data. Another way is via a rest interface. However, all the code and especially the data model code is extremely tightly coupled to XML - it would need to be rewritten for the API.
  4. It's missing features. For example, it wasn't possible to create a new project, nor delete a topic, nor even add a topic headlessly (which was coupled to FreeCAD's GUI).
  5. It uses a global to store the BCF project. This means you cannot open two projects simultaneously.
  6. It's not particularly Pythonic. A lot of getters and setters and return codes.
  7. The attribute naming is a little inconsistent with the spec (both BCF-XML and BCF-API)

I've rewritten a new BCF Python lib from scratch to resolve these issues and it is available here: https://github.com/IfcOpenShell/IfcOpenShell/tree/v0.6.0/src/bcf

It's 10 times smaller (only 800 something lines of code), less dependencies, decoupled from GUI, decoupled from XML, and a bit more feature complete. Still a work in progress though - I'm currently rebuilding the BlenderBIM Add-on's BCF capabilities to use this library instead.

Ping @yorik - it may be worth rebuilding FreeCAD's implementation to use this one too. Firstly because I suppose FreeCAD must've been missing some features since bcfplugin was definitely missing some features, and secondly so that FreeCAD can easily support BCF-API in the future.

Tagged:
brunopostleMeetlatDADA_universec4rlosdiasCyrilJanFduncanhtlcnnbernd

Comments

  • edited December 2020

    @Moult great if we can get BCF-API support from a common source for FreeCAD & BlenderBIM. Such an obvious way to do collaboration. You may find this paper interesting: https://orbit.dtu.dk/en/publications/using-bcf-as-a-mediator-for-task-management-in-building-design

    @Moult why are things like this and BlenderBIM Add-in itself part of IfcOpenShell. How come they are not separate projects?

    Help with the Wikipedia page is appreciated, needs a cleanup since I last worked on it. https://en.wikipedia.org/wiki/BIM_Collaboration_Format

    Our own page is https://wiki.osarch.org/index.php?title=BIM_Collaboration_Format_(BCF) and it would be good with some references to the current state of free software support, for now I only have a list.

  • @Moult why are things like this and BlenderBIM Add-in itself part of IfcOpenShell. How come they are not separate projects?

    Interests me too.

  • @duncan said:
    @Moult why are things like this and BlenderBIM Add-in itself part of IfcOpenShell. How come they are not separate projects?

    There isn't a stable release of ifcopenshell 0.6 that you could target. For the time being, the python library and Blenderbim require a development version of ifcopenshell, so it makes sense for a user to update them all at the same time (though I notice the library bundled in the windows add-on is a bit behind).

  • Yes - FreeCAD and the BlenderBIM Add-on share things wherever possible - the previous bcfplugin was shared, but I've decided that there are too many downsides to keep on using it. Hence why I'm listing the issues and recommending FreeCAD to migrate too.

    I'll do a stint on the wiki.

    The reason the BlenderBIM Add-on is part of IfcOpenShell is actually not due to the dependency - the builds use the bot binaries and the folder structure is independent. It is no different to FreeCAD. Actually the reason is more historic. I started hacking on Blender + IFC support in 2019. That's when the name "BlenderBIM" appeared. Thomas, however, built IFC import support into Blender 10 years ago. The original name was "IfcBlender", just like there is an "IfcMax" in IfcOpenShell. When I joined, I was simply hoping to contribute to add IFC export support (that's why the source folder is called src/ifcblenderexport). Thomas is the true inventor of the BlenderBIM Add-on. As I built more export features, I had to add the features to the import too, to slowly get import and export to integrate. One thing led to another and it grew into the BlenderBIM Add-on, but the original offering was always part of IfcOpenShell.

    The original IfcBlender is still available today as a barebones importer (i.e. it does geometry and styles, and it may also do a spatial tree).

    brunopostleiosvarms
  • edited December 2020

    @Moult so how do you as a developer decide when to build on an existing project and when to start a new one. I'm thinking of http://bcfier.com/ which supports Revit, Navisworks, XbimXplorer. My thinking is that with support for more software there must in theory also be more support for growing the project and greater feature development. Ahhh - just realized that c# development off windows is a pain. I'd forgotten about that. But are there other considerations?
    So I've shared this on twitter

    and added an RFE to pyRevit https://github.com/eirannejad/pyRevit/issues/1097

  • Thanks for the history information....
    I assume it is similar to bimtester... It started small... than grow...
    Off topic Just realized if it grows even more it could be used for testing all BIM data even if it is not from ifc. Than it would not be related to ifcopenshell.

  • edited December 2020

    @duncan in general I try to reuse whenever possible. I reused and did a lot of work on bcfplugin a lot before I decided it wasn't worth it, for the reasons listed at the beginning of this thread. And yes, bcfier is C#.

    @bernd correct - that is why bimtester is called bimtester and not ifctester :D It can test anything, connect to anything ... for example, it should connect to bcf! Especially with all these new workflow-based standards like ISO19650 and upcoming OpenCDE APIs that can complement it it should connect to those too... oh and the BSDD API...

  • Can the new BCF library also be used for the creation of new BCF files? For instance from within Dynamo?

  • @chachi_ws yes, the library supports both reading and writing of files.

  • Cool, thanks for the quick reply.

Sign In or Register to comment.