XbimWebUI icon indicating copy to clipboard operation
XbimWebUI copied to clipboard

Viewer.getMergedRegion doesn't merge all regions in all models

Open yogster opened this issue 2 years ago • 0 comments

Expected behavior:

Viewer.getMergedRegion should merge all regions in all models

Actual behavior or exception details:

Viewer.getMergedRegion merges the most populated region of each model

This is because ModuleHandle.InitRegions only takes the most populated region of a geometry and discards the rest.

This means it's hard to find the bounds to use when clipping if there is more than one region in the model. Also, on loading the IFC the camera points to the centre of the most populated region, instead of the centre of the model(s).

Version of the xBIM Viewer:

Latest (code in current master branch)

Minimal code (or steps) to reproduce the issue:

const viewer = new Viewer('canvasElementId');
viewer.on('loaded', function() {
    console.log(viewer.getMergedRegion());
});
viewer.load(fileUrl);

/*
Returns:
{
     population: 22,
     centre: [ 62640, 3100, 1747.5],
     bbox: [ 59900, -80, -5.000010013580322, 5480, 6360, 3505 ]
}

Should return:
{
     population: 110,
     centre: [ 2640, 3100, 1747.5],
     bbox: [ -60100, -80, -5.000010013580322, 125480, 6360, 3505 ]
}
*/

Minimal file to reproduce the issue:

20200205Model_PNO.ifc.zip

(from Open IFC Model Repository)

yogster avatar Apr 12 '22 14:04 yogster