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

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

问题描述

我正在查看器中动态聚合模型(来自多个 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).

不过我想出了一个解决方案.加载模型后(每次用户选择一些模型时),如果我隐藏"所有模型并再次显示"它们,它会解决点击和 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,所以有一个巨大的偏移量,导致精度问题.这就是为什么您会看到相机出现大量抖动".

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 中提取精确"全局偏移量,请参阅博客:forge.autodesk.com/blog/add-revit-levels-and-2d-minimap-your-3d

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天全站免登陆