Industry Foundation Classes (IFC) data model is intended to describe architectural elements as a neutral vendor. From my experience, although it is easy to use, it still has lots of details to be improved. E.g. Geo-reference, encoding system….etc.
Today I will only describe IFC GUID encoding. Each architectural element has its own unique ID and it has 3 different representations. Those are UniqueId, DWF and IFC GUID. Basically, DWF equals IFC GUID so we only focus on UniqueId to IFC GUID conversion. In terms of the whole concept, you can refer to this article https://thebuildingcoder.typepad.com/blog/2009/02/uniqueid-dwf-and-ifc-guid.html
What I do is rewriting someone’s code and make it to Python 3 version.
A GUID is a 16-byte, i.e. 128 bit number. Written in groups of 8–4–4–4–12 hexadecimal characters, i.e. 32 characters.
E.g. fbe83329-bd27–43ab-94f4–1a592746ba4c
The next step is converting uniqueId to IFC GUID. The mapping table is shown as below,
self.b64_charset = str.encode(‘ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/’)
self.ifc_charset = str.encode(‘0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_$’)
Finally, we can generate the IFC GUID. For instance,
__WpARqdGwkKz1fP9qQwJ0
Below is the Github for the complete code:
https://github.com/bigeyesung/IFCProject/blob/master/IFCConvert.py