简体   繁体   中英

Using Viewer3D methods inside an Aggregated Viewer

I want to build functionality for selected objects and shown models in my Aggregated View. I can't seem to figure out how to use the "getSelection" method that is available to the Viewer3D (which Aggregated View is built on?). I can getModel easy enough though:

function extGetModels() {
var modelurn = [];
var visibleModels = viewer.getVisibleNodes();
visibleModels.forEach(model => {
    var i = viewer.getModel(model);
    modelurn.push(i);
});

Is there any examples how I can use the methods in Viewer3D in my aggregated view?

(sorry if this question seems banal, I'm quite new to JS)

It's quite straightforward, just use AggregatedView.viewer . For example,

const view = new Autodesk.Viewing.AggregatedView();
view.init( viewerDiv, options3d );


// somewhere in your code ...

const viewer = view.viewer;
viewer.getVisibleNodes();

Ref: https://gist.github.com/yiskang/c404af571ba4d631b5929c777503891e#file-index-html-L81

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM