xBimTeam / XbimEssentials

A .NET library to work with data in the IFC format. This is the core component of the Xbim Toolkit
https://xbimteam.github.io/
Other
494 stars 173 forks source link

Update StepTextHelper.cs #536

Closed Dottormo closed 10 months ago

Dottormo commented 10 months ago

Prevent Format Exception in IFC XML file from Revit.

andyward commented 10 months ago

Thanks @Dottormo! Do you happen to have a sample file that exhibits this issue? Partly as a test case and partly as it would be good to understand if there's further edge cases to consider (in which case we should just be more defensive in this area)

Dottormo commented 10 months ago

Thanks @Dottormo! Do you happen to have a sample file that exhibits this issue? Partly as a test case and partly as it would be good to understand if there's further edge cases to consider (in which case we should just be more defensive in this area)

Hi Andy!

Of Course!

I was testing some files extracted from Revit 2023 when I realized that I was getting an error because there was a NAN in the xml (also in same xmlZipped file).

House.zip You can find the error in line 594 col 20: \NAN(SNAN)\

I don't know why Revit wrote this value.

Thank you so much

Roberto

P.S.: Sorry guys! I opened pull request on master branch instead of dev branch

andyward commented 10 months ago

Thanks - I managed to reproduce this myself later on with an IFcXml export from Revit 2023. Will take a look later (I think we need to be more permissive in the parser actually). Master is fine as clearly this a bit of a blocker for IFCXml users

andyward commented 10 months ago

BTW, while we should be more tolerant, this seems like a bug in the Revit IFC exporter rather than any IfcXML standard/convention. SNAN is a Signalled NaN typically from C++ libs - and feels a bit similar to a Debug.Assert left in a release. Background reading: https://stackoverflow.com/questions/18118408/what-is-the-difference-between-quiet-nan-and-signaling-nan. i.e. it looks like Revit-ifc is not handling optional values correctly in Ifcxml export

andyward commented 10 months ago

Thanks - I ended up with a slightly different fix that should better handle other edge cases like this.

Still need to determine what Revit is doing...