英文:
Loading issue sprites in a aggregated viewer
问题
我在尝试将问题正确放置在一个聚合查看器中。我在查看器中加载了几个模型,我想加载项目中的所有问题,不管它们是在哪个模型/视图中创建的。现在我正试图比较我的 Revit 模型的项目基点与查看器的 globalOffset,然后将其与所讨论问题的位置和 viewerState.globalOffset 进行比较,如下所示:this.viewer.model.getGlobalOffset().x - 142000 * 3.28084 /* PBP 米 -> 英尺 */ + (linkedDoc.details.position.x - linkedDoc.details.viewerState.globalOffset.x)
这个逻辑有时候能正常工作,特别是当特定模型首先加载并且查看器将其用作全局偏移的基础时。但当另一个模型首先加载时,globalOffset 与一些问题不相关。我认为我需要一种全局坐标系统,我可以将其他所有内容与之相关联,但我不确定如果它不是 globalOffset 的话,这是什么。我似乎找不到其他人遇到这些问题,所以我不知道该如何解决。我应该强制查看器在初始化时使用特定的 globalOffset 吗?这可能吗?非常感谢任何帮助!
英文:
I'm having trouble placing my issues correctly in an aggregated viewer. I have several models loaded in my viewer, and I want to load all issues in my project independent of in which model/view they were created in.
Right now I am trying to compare the project base point of my Revit models to the globalOffset of the viewer, and then comparing that to the position and viewerState.globalOffset of the issue in question, like so:
this.viewer.model.getGlobalOffset().x - 142000 * 3.28084 /* PBP meter -> feet */ + (linkedDoc.details.position.x - linkedDoc.details.viewerState.globalOffset.x)
This logic is working half of the time, the times when a specific model is loaded first and the viewer uses that as basis for the globalOffset. When another model loads first the globalOffset doesn't correlate to (some of) the issues. What I think I need is some kind of global coordinate system that I can relate all others to, but I'm not sure what this is if it isn't the globalOffset.
I can't seem to find anyone else having these issues, so I'm not sure how to go about solving it. Should I force the viewer to use a specific globalOffset at init? Is this possible?
Many thanks for any help!
答案1
得分: 1
你说得对 - AggregatedView
类存储了第一个加载的模型的全局偏移量,并将其应用于随后加载的模型。不过我不确定是否有一种方式来指定自定义的全局偏移量。
如果你需要更多控制模型放置的位置,你可以通过在 viewer.loadDocumentNode
方法中指定附加选项来自行聚合各个模型(如此博文中所解释的)。你还可以指定类似 applyScaling: 'ft'
的选项,以将所有加载的模型缩放为单一的、一致的单位系统。
英文:
You're right - the AggregatedView
class stores the global offset of the first loaded model, and applies it to subsequently loaded models as well. I'm not sure if there's a way to specify a custom global offset, though.
If you need more control over where the models are placed, you could simply aggregate the individual models yourself by specifying additional options in the viewer.loadDocumentNode
method (as explained in this blog post). You can also specify something like applyScaling: 'ft'
to scale all loaded models into a single, consistent unit system.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论