XbimWebUI icon indicating copy to clipboard operation
XbimWebUI copied to clipboard

Zoom to specific id is not working

Open kolmar1991 opened this issue 3 years ago • 12 comments

Hi, I have a simple wexbim model where zooming is not working properly, while e.g. highlighting works perfect. I cannot identify if:

  1. The model is corrupted.
  2. 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)

IFC_edit_System.zip

kolmar1991 avatar Nov 27 '22 09:11 kolmar1991

Can you show your code - or at least the salient zoom code? Are you using: viewer.zoomto()

andyward avatar Nov 27 '22 11:11 andyward

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. image

kolmar1991 avatar Nov 27 '22 12:11 kolmar1991

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

kolmar1991 avatar Nov 27 '22 13:11 kolmar1991

To sum up: the current code is following: image The result before click the window is: image after: image and the window is here: image

kolmar1991 avatar Nov 27 '22 13:11 kolmar1991

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 avatar Nov 27 '22 18:11 andyward

@andyward The zoom is definitely triggered because some action is executed (the view changed). I have added a console.log: image here is a console ooutput when clicking the window: image 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

kolmar1991 avatar Nov 27 '22 20:11 kolmar1991

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:

image

andyward avatar Nov 28 '22 09:11 andyward

I'll have a look at this.

martin1cerny avatar Nov 28 '22 16:11 martin1cerny

Thank you @andyward . What is the "WCS" issue? (I'm asking out of curiosity)

kolmar1991 avatar Nov 28 '22 18:11 kolmar1991

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.

kolmar1991 avatar Nov 29 '22 18:11 kolmar1991

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

kolmar1991 avatar Nov 29 '22 18:11 kolmar1991

I too had a similar issue.

check the pull request below.

https://github.com/xBimTeam/XbimWebUI/pull/421

tomlee-dev avatar Mar 29 '23 04:03 tomlee-dev