Skip to content

DataConverter can't handle malformed IFC-headers #207

Closed

Description

@MagicalBloom

Describe the bug 📝

IFC-file with this kind of header line results in uncaught error:
FILE_NAME ('filename.ifc', '2023-09-07T18:44:01', ($), ('CADMATIC Oy'), $, $, $);

If you add single quotes around dollar signs, the model loads normally.

Reproduction ▶️

No response

Steps to reproduce 🔢

No response

System Info 💻

System:
    OS: Windows 10 10.0.19045
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i5-13600K
    Memory: 17.60 GB / 31.75 GB
  Binaries:
    Node: 18.12.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.3636.0), Chromium (120.0.2210.61)
    Internet Explorer: 11.0.19041.3636

Used Package Manager 📦

npm

Error Trace/Logs 📃

Click to expand!
data-converter.ts:98  Uncaught (in promise) TypeError: Cannot read properties of null (reading 'value')
    at DataConverter.getMetadataEntry (data-converter.ts:98:36)
    at DataConverter.getIfcMetadata (data-converter.ts:81:23)
    at DataConverter.saveModelData (data-converter.ts:68:36)
    at async DataConverter.generate (data-converter.ts:57:5)
    at async _FragmentIfcLoader.load (index.ts:82:19)
    at async getFragments (fragments.ts:37:12)
    at async HTMLInputElement.<anonymous> (+page.svelte:164:19)

Validations ✅

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Make sure this is a repository issue and not a framework-specific issue. For example, if it's a THREE.js related bug, it should likely be reported to mrdoob/threejs instead.
  • Check that this is a concrete bug. For Q&A join our Community.
  • The provided reproduction is a minimal reproducible example of the bug.

Activity

  1. added
    bug
    on Dec 11, 2023
  2. HoyosJuan commented on Dec 13, 2023

    @HoyosJuan
    Contributor

    Hey @MagicalBloom... but if it's a malformed header (meaning it doesn't follow the IFC schema), don't you think the authoring software is the one that should solve their exporting? We usually try to avoid making adjustments in the parser to include situations where incoming files does not comply with the schema.

    Dollar signs in the IFC schema are used to set null attributes in entities. The third attribute in the FILE_NAME entity is used to set the author of the IFC File (usually the one who exported the file). If there is no author specified, then the dollar sign should be used without parentheses... but in case the author is specified, then it should come in the form of an array (thus the parentheses) with the name of the person. That means the following two FILE_NAME entities comply with the requirements:

    FILE_NAME ('filename.ifc', '2023-09-07T18:44:01', $, ('CADMATIC Oy'), $, $, $);
    FILE_NAME ('filename.ifc', '2023-09-07T18:44:01', ('MagicalBloom', '[email protected]'), ('CADMATIC Oy'), $, $, $);

    In conclusion, the problem with the header from Cadmatic, is that the use of parentheses around the dollar sign in the third attribute is incorrect. I would then suggest you two things:

    1. Look at the Cadmatic settings to specify an author of the IFC file. By doing that, hopefully, the third attribute in the FILE_NAME entity gets correctly exported.
    2. If you're a Cadmatic customer, then talk with them about it.

    Please, let me know if this answer helps you!

  3. MagicalBloom commented on Dec 13, 2023

    @MagicalBloom
    Author

    Of course the software should fix their exporting to match the IFC schema but maybe you could handle the error and tell the library user that supplied IFC-file had malformed headers, or do you expect that parser will always get perfect input? I'm not using Cadmatic myself I just got this file from a client.

    Thanks a lot for the explanation about the IFC schema though! I'll send mail to Cadmatic about the problem and hopefully it'll get fixed at some point.

  4. self-assigned this
    on Dec 21, 2023
  5. HoyosJuan commented on Dec 21, 2023

    @HoyosJuan
    Contributor

    Solved in PR #229.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions