autodesk-forge - Forge 查看器 6.3.4 版不显示新发布的文档浏览器扩展
解决方案
经过一些实验,我得到了它的工作。这是我的工作流程,以防您仍然需要它。
首先,初始化查看器:
// initialize the viewer
Autodesk.Viewing.Initializer(adOptions, () => {
// when initialized, call loading function
this.loadDocument(encodedUrn);
});
然后,在上面调用的函数中加载您的文档:
// load the document from the urn
Autodesk.Viewing.Document.load(
encodedUrn,
this.onDocumentLoadSuccess,
this.onDocumentLoadFailure,
);
在成功回调中,您现在可以执行以下操作:
onDocumentLoadSuccess(doc) {
// get the geometries of the document
const geometries = doc.getRoot().search({ type: 'geometry' });
// Choose any of the available geometries
const initGeom = geometries[0];
// and prepare config for the viewer application
const config = {
extensions: ['Autodesk.DocumentBrowser'],
};
// create the viewer application and bind the reference of the viewerContainer to 'this.viewer'
this.viewer = new Autodesk.Viewing.Private.GuiViewer3D(
this.viewerContainer,
config,
);
// start the viewer
this.viewer.start();
// load a node in the fetched document
this.viewer.loadDocumentNode(doc.getRoot().lmvDocument, initGeom);
}
我希望这也能让它对你有用。帮助我的是这篇博文中对 loadDocumentNode 函数的引用。
推荐阅读
- c - 定义Linux中C程序允许的最大char []数组大小
- uwp - 桌面桥 SQLite
- php - 开始使用 Google 存储
- python - 下面代码中这一行的含义是什么?
- spring - oracle物理连接在关闭时会影响性能吗
- google-cloud-firestore - 是否可以为尚不存在的父文档插入子集合实体?
- c# - 为什么 LINQ to Entities string.Contains(string.Empty) 除了 string.Contains(string.Empty.ToLower()) 什么都不匹配?
- php - 如何从此代码中为每一行更新 MySQL?
- c# - 如何转换列表