Zoom to specific id is not working
Hi, I have a simple wexbim model where zooming is not working properly, while e.g. highlighting works perfect. I cannot identify if:
- The model is corrupted.
- The is some bug in Viewer.
In Xbim Xplorer app zooming works fine.
I downloaded XbimWebUI repo and uploaded my model using wexbim-files-viewer. Zooming is not working for my element too.
I'm attaching my model to this issue (zipped). The problematic id is : 4229 (small window)
Can you show your code - or at least the salient zoom code? Are you using: viewer.zoomto()
As I wrote, I was able to reproduce it in wexbim-files-viewer.
I added a single line here: https://github.com/xBimTeam/XbimWebUI/blob/master/examples/wexbim-files-viewer/index.ts#L37
As in screenshot.
I know it is not the cleverest way, but after click to any element it should zoom my window but it zooms something completely different.

I have changed it to viewer.zoomTo(arg.id); - so picking should cause focusing on picked element but the camera seems to be set to something else, whatever element I pick
To sum up: the current code is following:
The result before click the window is:
after:
and the window is here:

It's likely because arg.xyz is null so you're not entering that path. Try moving the zoomTo call outside of that conditional logic.
xyz is the inferred click position in 3D space, but it's not always available on 'pick' events - especially when clicking on small elements.
I have changed it to viewer.zoomTo(arg.id);
Generally I'd recommend providing the model id as well as the product id is not guaranteed unique across models.
@andyward The zoom is definitely triggered because some action is executed (the view changed). I have added a console.log:
here is a console ooutput when clicking the window:
I also added model number just in case.
The result is still the same. Zoom is still wrong for a banch of elements including the window with number 4229
OK - reproduced this. It looks like the bounding box is not being calculated correctly on elements in this model so we're zooming to the wrong spot. My guess it there's a WCS issue. Paging @martin1cerny to see if he can investigate...
It's not just this element. Other items are off as well:

I'll have a look at this.
Thank you @andyward . What is the "WCS" issue? (I'm asking out of curiosity)
Hi, we were trying to identify the issue. I created a model in Revit 2019 and exported to wexbim -> everything worked fine. After upgrading the model to Revit 2023 it is still working. The issue occurs only when the model is created from scratch in Revit 2023. I'm sharing this information as it may help you identifying the root cause.
However, I still have a feeling it should be in a center after zooming but it is not. Attaching the model from revit 2019: 2019.zip
I too had a similar issue.
check the pull request below.
https://github.com/xBimTeam/XbimWebUI/pull/421