简体   繁体   English

在聚合查看器中使用 Viewer3D 方法

[英]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?).我似乎无法弄清楚如何使用 Viewer3D 可用的“getSelection”方法(构建在哪个聚合视图之上?)。 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?是否有任何示例如何在我的聚合视图中使用 Viewer3D 中的方法?

(sorry if this question seems banal, I'm quite new to JS) (对不起,如果这个问题看起来很平庸,我对 JS 很陌生)

It's quite straightforward, just use AggregatedView.viewer .这很简单,只需使用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参考: https://gist.github.com/yiskang/c404af571ba4d631b5929c777503891e#file-index-html-L81

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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