ThatOpen / engine_web-ifc

Reading and writing IFC files with Javascript, at native speeds.
https://thatopen.github.io/engine_web-ifc/demo
Mozilla Public License 2.0
585 stars 176 forks source link

[Feat]: Create IFC compliant GUIDs when using IfcGloballyUniqueId #905

Open HoyosJuan opened 3 weeks ago

HoyosJuan commented 3 weeks ago

What is your idea?

Let's say I am creating a new entity. In many cases, the constructor requires the GUID of the element, which one creates by using new IfcGloballyUniqueId(). Right now, IfcGloballyUniqueId() expects the user to provide ID. However, GUIDs in the IFC schema are not anything the user like, but something that complies with this. The problem is, we can't let users fight with knowing how to correctly compress IDs to comply with the schema, it's something the same library should care about.

Proposal

Let the IfcGloballyUniqueId() to optionally accept a UUID v4. If the UUID is provided, then the class compress it based on the requirements from the schema. If the UUID is not provided, then the class creates a random GUID that is compressed based on the schema.