Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zoom to specific id is not working #403

Open
kolmar1991 opened this issue Nov 27, 2022 · 12 comments
Open

Zoom to specific id is not working #403

kolmar1991 opened this issue Nov 27, 2022 · 12 comments
Assignees
Labels

Comments

@kolmar1991
Copy link

kolmar1991 commented Nov 27, 2022

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

@andyward
Copy link
Member

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

@kolmar1991
Copy link
Author

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
Copy link
Author

kolmar1991 commented Nov 27, 2022

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
Copy link
Author

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

@andyward
Copy link
Member

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.

@kolmar1991
Copy link
Author

@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

@andyward
Copy link
Member

andyward commented Nov 28, 2022

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

@martin1cerny
Copy link
Member

I'll have a look at this.

@kolmar1991
Copy link
Author

kolmar1991 commented Nov 28, 2022

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

@kolmar1991
Copy link
Author

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
Copy link
Author

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

@tomlee-dev
Copy link

I too had a similar issue.

check the pull request below.

#421

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants