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

used custom code implementation for model browser functionality. is there any way to get data of model browser. #21

Open
sannysoni123 opened this issue Apr 30, 2018 · 2 comments

Comments

@sannysoni123
Copy link

i used headless functionality for viewer in angular 5. Common attributes like zoom, rotation, pan - custom usage of setActiveNavigationTool() inbuilt function.
so is there any way to get model browser data functionality like door / wall / kitchen attributes
Please let me know the way ...

@julianobrasil
Copy link

This would be cool. I've found very limited access to what happens in the model browser (some example of how to switch the event a click on the model browser leaves would fire, for example). But it would be much nicer if you had a way to get a reference to the instance to, for example, change the handler function that responds to the mouse clicks.

@julianobrasil
Copy link

In fact, based on this post and after some console.log's, I've found out what you have to override to have a little bit of control. In the current version of Viewer I'm using (v7), a click on an item in the Viewer Model Browser fires an internal function that isolates the clicked element. This internal function is called isolate. Without having to mess with everything, you can override it:

(Autodesk.Viewing.Extensions as any).ViewerModelStructurePanel.prototype.isolate = function isolate(
    dbId: number,
    model: Autodesk.Viewing.Model
  ) {
    // here you can do whatever you want to
    if (model) {
      const event = {
        type: 'MY_CUSTOM_EVENT',
        dbId,
        model,
      };
      this.viewer.dispatchEvent(event);
    }
  };

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

No branches or pull requests

2 participants