简体   繁体   English

Autodesk Forge - 如何同步获取多个选定对象的属性

[英]Autodesk Forge - how to get properties of multiple selected objects synchronously

In my Extension I have an ID from this.viewer.getSelection() array, eg 1234.在我的扩展中,我有一个来自this.viewer.getSelection()数组的 ID,例如 1234。

I've tried to get properties from this:我试图从中获取属性:

this.viewer.getProperties(1234,function(data) {console.log(data);},function(e1,e2) {console.log("ERROR:",e1,e2);})

But I see the error:但我看到错误:

Properties failed to load since model does not exist

Updated question: How to get properties of multiple selected objects synchronously ?更新的问题:如何同步获取多个选定对象的属性?

Under the hood, the viewer.getProperties method calls viewer.model.getProperties , and as the error message states, viewer.model is not available when the method is called.幕后viewer.getProperties方法调用viewer.model.getProperties ,并且如错误消息所述, viewer.model该方法时viewer.model不可用。 Note that there could be several different reasons for such scenario:请注意,这种情况可能有多种不同的原因:

  • the viewer.getProperties is called on a different instance of viewer (which does not have any model loaded)在不同的查看器实例(没有加载任何模型)上调用viewer.getProperties
  • the viewer.getProperties is called before the model has been loaded在加载模型之前调用viewer.getProperties
  • the viewer.getProperties is called after the model has been unloaded卸载模型后调用viewer.getProperties

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

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