Skip to content

[Bug]: Indices in IfcArcIndex/IfcLineIndex in IfcIndexedPolyCurve are numbers, not IfcPositiveInteger #1881

@jonathan-merlet-ocl

Description

@jonathan-merlet-ocl

What happened?

Given the following file (trimmed down for repro):

ISO-10303-21;
HEADER;
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(('IFC4X3'));
ENDSEC;
DATA;

#100=IFCCARTESIANPOINTLIST2D(((1.,0.),(0.,1.)));
#101=IFCINDEXEDPOLYCURVE(#100,(IFCARCINDEX((1,2))),.F.);

ENDSEC;
END-ISO-10303-21;

And the following code:

    const line = api.GetLine(modelID, 101);
    const index = line.Segments[0].value[0];
    console.log("typeof index:", typeof index)
    console.log("typeof index.value:", typeof index.value)

The following output is produced:

typeof index: number
typeof index.value: undefined

Meaning index is a raw number, and not an IFcPositiveInteger as described in the typing.

I stumbled upon it while handling an IfcIndexedPolycurve, so I don't know if the problem is limited to those instances of IfcPositiveInteger or if the problem can be found elsewhere too.

Version

0.0.76 (originally detected on 0.0.75, but confirmed on latest)

What browsers are you seeing the problem on?

Chrome

Relevant log output

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions