查看器中的模型聚合-协调问题 [英] Model aggregating in viewer - coordinate issue

查看:71
本文介绍了查看器中的模型聚合-协调问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看器中动态聚合模型(来自多个BIM文件).基本上,我先初始化查看器,然后初始化用户选择动态查看的每个模型的LoadDocument和LoadModel.

I am dynamically aggregating models in the Viewer (coming from multiple BIM files). Basically, I initialize the viewer, and then LoadDocument and LoadModel for each model that user chooses to view, dynamically.

这些大多数是NVC文件(我用于测试的文件),它们共享坐标系.动态加载模型并正确缝合"模型.

These are mostly NVC files (what I used for testing), which are sharing the coordinate system. Models getting dynamically loaded and getting 'stitched' correctly.

但是,在加载第二个模型时,坐标系越来越混乱-并非总是如此,但在某些情况下(在v6.3中-尚未检查以前的版本).发生这种情况时,我会注意到以下内容:

However, coordinate system is getting screwed up when the second model gets loaded - not always but in some cases (in v6.3 - haven't checked previous versions). When this happens, I can notice the followings:

  1. 当我在查看器中单击主页"图标时,它不会显示完整的汇总模型,而只会在中心显示第一个加载的模型,而其余的则显示在屏幕外部.
  2. 当我单击要选择的元素时,它会选择其他内容(带有偏移量),而在某些情况下则什么也不选择(这意味着单击的坐标被错误地解释了).

我尝试了多种组合,当第一个加载的模型未占据聚合模型的完整大小(例如,建筑物的一层)时,似乎会发生此问题.

I have tried multiple combinations and this problem seems to happen when first loaded model is not occupying full size of the aggregated model (say, one floor of the building).

但是我想出了一个解决方案.加载模型后(每次用户选择某些模型时),如果我隐藏"所有模型并再次显示"它们,则可以解决click和AGGREGATED_SELECTION事件的问题.

I figured out a solution though. After loading the models (every time when user choose some), if I 'hide' all models and 'show' them again, it fixes the problems with click and AGGREGATED_SELECTION event.

这不是一个很好的用户体验,因为我希望能够在用户围绕先前聚合的模型集移动时在后台加载模型.如果我在加载新的游戏后隐藏/显示,这将使用户感到烦恼.

This is not a nice user experience because I want to be able to load the models in the background while user is moving around the previously aggregated model-set. If I hide/show after loading the new one, it will be annoying to user.

有没有一种方法可以重置"查看器的坐标系(达到与隐藏/显示模型相同的效果)?

Is there a way to 'reset' the coordinate system of the viewer (to the same effect what happens when hide/show the models)?

对于解决此问题,我将不胜感激.

I would appreciate some help to get around this issue.

谢谢 班杜

推荐答案

好,因此存在很大的偏移量,从而导致精度问题.这就是为什么您会看到相机出现很多抖动"的原因.

ok, so there is a massive offset, causing a precision issue. Which is why you are seeing lots of 'jittering' of the camera.

要解决此问题,我们需要通过手动返回所有更接近原点的几何形状来校正大量偏移. (或修复原始的navisworks文件).

To fix this... we need to correct the massive offset, by returning all the geometry closer to origin manually. (or fixing the original navisworks file).

首先,让我们粗略地计算出偏移值...

First, let's roughly figure out the offset value...

按住ALT键,然后在对象上的任意位置单击.这将设置一个绿点,即枢轴点.然后使用 viewer.navigation.getPivotPoint()获取x,y,z值. (详细信息: https://github.com/wallabyway/markupExt/issues/2 ).

Hold down ALT-key and click anywhere on an object. This sets a green dot, the pivot point. Then use viewer.navigation.getPivotPoint() to get the x,y,z value. (details: https://github.com/wallabyway/markupExt/issues/2).

您应该看到这样的xyz值... Z.Vector3 {x:1296285.515098644,y:14995636.431742325,z:364.26238179027337}

You should see an xyz value like this... Z.Vector3 {x: 1296285.515098644, y: 14995636.431742325, z: 364.26238179027337}

现在,使用此值调整设置全局偏移量,以正确地将所有模型移近0,0,0.像这样...

Now, adjust set the global offset using this value, to correctly move all the models closer to 0,0,0. like this...

第70行:

var modelOptions = {
    sharedPropertyDbPath: doc.getPropertyDbPath(),
    globalOffset: {x:1296285.515098644, y: 14995636.431742325, z:0}
};
viewer.loadModel(svfUrl, modelOptions, onLoadModelSuccess);

`

这可以逆转此大偏移量的影响.结果是由于精度问题,几何图形停止了闪烁,并且相机的移动停止了抖动".

This reverses the effect of this big offset. The result is the geometry stops flickering and the camera movement stops 'jittering' due to precision issues.

让我知道这是否对您有用. 迈克尔

Let me know if that works for you. Michael

ps.您可以从小文件AECModelData.json中提取精确"全局偏移量,请参见博客:

ps. you can pull the 'exact' global-offset out of the small side-file AECModelData.json, see blog: forge.autodesk.com/blog/add-revit-levels-and-2d-minimap-your-3d

这篇关于查看器中的模型聚合-协调问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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