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
485 stars 172 forks source link

Can not distingguish ".U." and "$" on "IfcMaterialLayer.IsVentilated : OPTIONAL IfcLogical;" #502

Open highan911 opened 1 year ago

highan911 commented 1 year ago

When loading an IFC STEP file with data row like

#347= IFCMATERIALLAYER(#326,417.,.U.,'Component 1',$,$,$);

The corresponding property is "null" instance will be printed as

#347=IFCMATERIALLAYER(#326,417.,$,'Component 1',$,$,$);

The definition in "IFC4.exp" is

IsVentilated : OPTIONAL IfcLogical;

Assemblies and versions affected:

Issue found in Xbim.IO.MemoryModel 5.1.341 and relying on Xbim.Ifc4 5.1.341

Steps (or code) to reproduce the issue:

    string ifcPath = "./filename.ifc";
    MemoryModel model = MemoryModel.OpenReadStep21(ifcPath);

    var entity = model.Instances[347] as IIfcMaterialLayer;

    Console.WriteLine(entity.IsVentilated == null ? "null" : entity.IsVentilated.ToString());

    Console.WriteLine(entity.ToString());

Minimal file to reproduce the issue:

(Any IFC file with IFCMATERIALLAYER)

Expected behavior:

The property should be an "Xbim.Ifc4.MeasureResource.IfcLogical" with "_value==null"

highan911 commented 1 year ago

There may be two cores to solve this issue.

The first core of this issue should be at StepP21Lex.lex line 35:

[\.][U][\.]         {return((int)Tokens.NONDEF); } 

However, the second core is the interface IPropertyValue, which can not distinguish ".U." from "$" ... And if this interface is modified, a major number of classes will be affected ...

(Any good idea about this?)

martin1cerny commented 1 year ago

Hi @highan911, I'm happy to have a look at this. Could you create a PR with a failing test, so I could start from there please?

highan911 commented 1 year ago

Hi @highan911, I'm happy to have a look at this. Could you create a PR with a failing test, so I could start from there please?

Thank you very much~