[英]combine model on Autodesk Forge
I have couple of questions about combine model on forge viewer (load list urn to 1 viewer):我有几个关于在 forge 查看器上组合 model 的问题(将列表 urn 加载到 1 个查看器):
var instanceTree = GlobalViewer.model.getData().instanceTree;
var instanceTree = GlobalViewer.model.getData().instanceTree;
var allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex);
var list = allDbIdsStr.map(function (id) { return parseInt(id) });
list will return all dbid of main model, how can i access all data of all model when i combine? Appreciate any comments,感谢任何评论,
Regarding #1: viewer.model
obviously only references one of the models (I believe it's the last one you loaded), but you can use viewer.getVisibleModels()
or viewer.getHiddenModels()
to get other loaded models as well.关于 #1:
viewer.model
显然只引用了其中一个模型(我相信这是您加载的最后一个模型),但您也可以使用viewer.getVisibleModels()
或viewer.getHiddenModels()
来获取其他加载的模型。
Regarding #2: dbIDs
are only unique within a single model;关于 #2:
dbIDs
仅在单个 model 中是唯一的; many of the viewer methods accept an additional parameter specifying the model on which to operate, for example, you could say viewer.select([123, 456], oneOfMyModels)
.许多查看器方法接受一个附加参数,指定要在其上操作的 model,例如,您可以说
viewer.select([123, 456], oneOfMyModels)
。
Regarding #3: that's a good question;关于#3:这是个好问题; loading a 2D model first puts the viewer into 2D viewing mode (where only zoom and pan is allowed);
加载 2D model 首先将查看器置于 2D 查看模式(仅允许缩放和平移); if you know you will be working with 3D models, I'd recommend always loading those first
如果您知道您将使用 3D 模型,我建议始终先加载这些模型
Regarding #4: yes, each loaded model can have different units;关于#4:是的,每个加载的 model 可以有不同的单位; when loading a model using the
loadDocumentNode
method you can specify additional options (for example, a placement transform for the loaded geometries), and one of them is an object called applyScaling
, for example, like so:使用
loadDocumentNode
方法加载 model 时,您可以指定其他选项(例如,加载几何图形的放置变换),其中之一是 object ,称为applyScaling
,例如,如下所示:
viewer.loadDocumentNode(doc, viewable, {
applyScaling: { to: 'mm' }
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.