如何在手机或平板电脑上访问模型三? [英] How to access to model three on mobile or tablette?

查看:71
本文介绍了如何在手机或平板电脑上访问模型三?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过访问模型的三者来列出建筑物的某些元素.

I'm trying to list some elements of my building by accessing to the Three of my model.

在我的计算机上工作正常,但在Ipad或平板电脑上却无法正常工作.

It's working very fine on my computer but not on my Ipad or Tablet.

我正在使用以下代码:

    getInstanceTree() {

    return new Promise(async (resolve, reject) => {
      try {
        let viewer = LevelsExtension.viewer;
        viewer.getObjectTree(function (instanceTree) {
          return resolve(instanceTree);
        },
          function (errorCode) {
            return reject(errorCode);
          });

      } catch (ex) {
        return reject(ex)
      }
    })
  };

在移动设备和Ipad上,使用errorCode中的undefined值调用return reject(errorCode);.

On mobile and Ipad, return reject(errorCode); is call with undefined value in the errorCode.

我该怎么办?

推荐答案

没有错误代码的错误回调可能表明模型数据库(存储对象树的模型)尚不可用.您什么时候调用getInstanceTree()方法?

An error callback with no error code might indicate that the model database (where the object tree is stored) is not yet available. At what point are you calling the getInstanceTree() method?

当模型数据库准备就绪时,查看器会触发事件-您可以使用viewer.addEventListener(Autodesk.Viewing.OBJECT_TREE_CREATED_EVENT, function(ev) { ... })订阅该事件.

The viewer triggers an event when the model database is ready - you can subscribe to it using viewer.addEventListener(Autodesk.Viewing.OBJECT_TREE_CREATED_EVENT, function(ev) { ... }).

希望有帮助:)

跟进我们在要点上的讨论,以及遇到类似问题的任何人问题:

following up on our discussion on the gist, and for anyone running into similar problems:

当您无法访问移动设备上的模型的对象树时,很可能达到了Forge查看器的内存限制,您可以通过将限制明确设置为零来尝试绕过这些限制:

When you're unable to access the object tree of a model on a mobile device, you're likely hitting memory limits of the Forge viewer, and you can try to bypass those by explicitly setting the limits to zero:

viewer = new Autodesk.Viewing.Private.GuiViewer3D(
    document.getElementById('viewer'),
    { memory: { limit: 0 } }
);

这篇关于如何在手机或平板电脑上访问模型三?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆