Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Parsing error in web-ifc when encountering * in IFC file #1160

Closed
powerocean opened this issue Nov 20, 2024 · 2 comments
Closed

[Bug]: Parsing error in web-ifc when encountering * in IFC file #1160

powerocean opened this issue Nov 20, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@powerocean
Copy link

What happened?

Description

I encountered an issue with web-ifc where it fails to correctly parse IFC files containing the * symbol in certain fields. According to the IFC standard, * is a valid placeholder for an undefined value, but web-ifc does not seem to handle it properly. This leads to incorrect parsing results, especially when parsing relationships such as IFCRELAGGREGATES.
Here is an example of a problematic IFC snippet:
#1 = IFCRELAGGREGATES('BohvtDLAfw6mzz2U8Z3f8j', *, $, $, #2, (#12));
and
#13 = IFCRELCONTAINEDINSPATIALSTRUCTURE('Ey9YGvNEs4iJHMHGM1vuJq', *, $, $, (#14), #12);

Expected Behavior

  • The RelatingObject should be parsed as: { "value": 2, "type": 5 }
  • The RelatedObjects should be parsed as: [{ "value": 12, "type": 5 }]

Actual Behavior

Due to the presence of *, the parser incorrectly returns:

  • RelatingObject : { "value": undefined, "type": 5 }
  • RelatedObjects: []

Steps to Reproduce:

  1. Use the following IFC snippet (or a file containing it) with web-ifc:
    #1 = IFCRELAGGREGATES('BohvtDLAfw6mzz2U8Z3f8j', *, $, $, #2, (#12));
  2. Attempt to parse the file using web-ifc.
  3. Check the parsed values of RelatingObject and RelatedObjects.

Proposed Solutions:

  1. Modify the parser to treat * as a $ value or equivalent during processing.
  2. Ensure that subsequent fields are correctly parsed even when * is encountered.

Version

0.0.65

What browsers are you seeing the problem on?

No response

Relevant log output

ERROR: Invalid IFC Line:2
Uncaught TypeError: v[7]?.map is not a function

Anything else?

snippet.zip

@powerocean powerocean added the bug Something isn't working label Nov 20, 2024
@beachtom beachtom self-assigned this Nov 23, 2024
@beachtom
Copy link
Collaborator

So * should only be used if the class of the object has set that property to a derived property. These should parse - if they don't please let me know

So looking at your example file its use in IFCSIUnit is valid - but its use in IFCBuilding and the others is incorrect - and they should be set to $

@powerocean
Copy link
Author

Okay, I understand. I found that this IFC file can be parsed by BIMvision correctly, and I guess it might have implemented some special logic to ignore this IFC syntax error.

@beachtom beachtom closed this as completed Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants