Skip to content

The first and last characters of the GUID are being cut off during IFC → JSON conversion. #7

@JuanCarlos3

Description

@JuanCarlos3

For example, the GUID in the IFC is:
157c866c-9c08-4348-a0ed-4d57cd66c9e2

…but in the converted JSON it appears as:
57c866c-9c08-4348-a0ed-4d57cd66c9e

GUID in IFC editor:
Image

GUID in converted JSON:
"relatedElements": [ { "ref": "92c2898-fd68-44ef-9178-3348e340017" }, { "ref": "57c866c-9c08-4348-a0ed-4d57cd66c9e" } ],

This looks like a parsing issue in ifc2json4.py and ifc2json5a.py. The current logic appears to assume the GUID string is always wrapped (e.g., with braces), but in some IFC exports that wrapper isn’t present—so the slice trims valid characters.

Code chunk which I believe is the culprit (line 121 in ifc2json5a.py):
for entity in self.ifcModel.by_type('IfcObjectDefinition'): self.rootObjects[entity.id()] = guid.split( guid.expand(entity.GlobalId) )[1:-1]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions