New BCF library available in IfcOpenShell for devs
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.
- 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.
- 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.
- bcfplugin only supports BCF-XML. BCF data can be transferred in different ways - one way is via saving and reading into
.bcffiles 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.
- 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).
- It uses a global to store the BCF project. This means you cannot open two projects simultaneously.
- It's not particularly Pythonic. A lot of getters and setters and return codes.
- 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.