ThatOpen / engine_web-ifc

Reading and writing IFC files with Javascript, at native speeds.
https://thatopen.github.io/engine_web-ifc/demo
Mozilla Public License 2.0
617 stars 190 forks source link

[Bug]: IfcDirection.DirectionRatios incorrectly read as an array of strings #463

Closed jonathan-merlet-ocl closed 1 year ago

jonathan-merlet-ocl commented 1 year ago

What happened?

Given the following file :

ISO-10303-21;
HEADER;
/******************************************************
* STEP Physical File produced by: IFCjs WebIfc 0.0.42
* Module: web-ifc/IfcLoader
* Version: 0.0.42
* Source: https://github.com/IFCjs/web-ifc
* Issues: https://github.com/IFCjs/web-ifc/issues
******************************************************/
FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1');
FILE_NAME('web-ifc-model-0.ifc','2023-08-04T14:40:03',($),($),'ifcjs/web-ifc-api','ifcjs/web-ifc-api',$);
FILE_SCHEMA(('IFC2X3'));
ENDSEC;
DATA;
#1000000=IFCDIRECTION((1.,0.,0.));
ENDSEC;
END-ISO-10303-21;

And this code to get the line (this._api is a WebIfc.IfcAPI instance) const line = this._api.GetLine(0, 1000000); The direction ratios are stored as string instead of numbers (output from chrome console) :

typeof line.DirectionRatios[0]
'string'
line
IfcDirection {expressID: 1000000, type: 32440307, DirectionRatios: Array(3)}
DirectionRatios: (3) ['1.000000', '0.000000', '0.000000']
expressID: 1000000
type: 32440307
[[Prototype]]: IfcGeometricRepresentationItem

N.B : this IFC file is not correct because it does not contain a project, but web-ifc parses it just fine and it exhibits the problem. I detected it in a bigger IFC file written by web-ifc with correct direction, but I tried to produce a minimal example.

Version

0.0.42

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

Anything else?

No response

jonathan-merlet-ocl commented 1 year ago

Do note that IFC4 and 4X3 seem to have the same problem, with strings instead of IfcReal.

beachtom commented 1 year ago

Any idea if this is something that has recently only just started happening - or has it been there a while and we just never noticed?

jonathan-merlet-ocl commented 1 year ago

@beachtom just tested quickly, 0.0.40 exhibits the problem, 0.0.39 does not. That leaves some uncertainty, but it's not very recent.

beachtom commented 1 year ago

This is now fixed