Can not distingguish ".U." and "$" on "IfcMaterialLayer.IsVentilated : OPTIONAL IfcLogical;"
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"
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?)
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?
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~
Appreciate this is old but having fixed up the GPLEX code, I had a quick look at this. As you say the issue is that IPropertyValue.BooleanVal returns a bool, and we use this interface when in the code-generated IPersist.Parse() methods such as in your IFCMATERIALLAYER example here
To fix this we'd need to:
- Extend the
IPropertyValueinterface with a LogicalVal property - Regenerate (or spot fix) the Parse code for IfcLogical properties
- Update the lexer to output a new Token
- Map the token to a SetLogicalValue()
- Update the Parsers/Indexers to handle this new mechanic
... quite a bit of work (especially no 2 which needs @martin1cerny ). Semantically I'm not sure what the difference is between a null IfcLogical and an IfcLogical with value undefined.
Appreciate this is old but having fixed up the GPLEX code, I had a quick look at this. As you say the issue is that
IPropertyValue.BooleanValreturns a bool, and we use this interface when in the code-generatedIPersist.Parse()methods such as in your IFCMATERIALLAYER example hereTo fix this we'd need to:
- Extend the
IPropertyValueinterface with a LogicalVal property- Regenerate (or spot fix) the Parse code for IfcLogical properties
- Update the lexer to output a new Token
- Map the token to a SetLogicalValue()
- Update the Parsers/Indexers to handle this new mechanic
... quite a bit of work (especially no 2 which needs @martin1cerny ). Semantically I'm not sure what the difference is between a null IfcLogical and an IfcLogical with value undefined.
Thank you for your response!
According to the buildingSMART IFC documentation, https://standards.buildingsmart.org/IFC/RELEASE/IFC4_1/FINAL/HTML/schema/ifcmaterialresource/lexical/ifcmateriallayer.htm
The description of this attribute says:
set to UNKNOWN if the material layer is an air gap and does not provide air exchange (or when this information about air exchange of the air gap is not available). set to FALSE if the material layer is a solid material layer (the default).
So the null value and the .U. value are semantically different.
I agree that this is quite a lot of work when I tried to fix it but end up realizing the modification on IPropertyValue will affect a lot.
I appreciate that this issue is finally on the TODO list, and hope for a good result : )