我正在使用Autodesk Forge Viewer v7.18.0以及使用新SceneBuilder在查看器本身中添加3d几何图形的自定义扩展。
在使用它时,当用户从一个文件切换到另一个文件时,基本上加载了不同的 SVF 文件,我们删除了 SceneBuilder 创建的模型生成器中的所有片段,然后调用
Autodesk.Viewing.Document.load(fileUrn, onDocumentLoadSuccess, onDocumentLoadFailure)
而在onDocumentLoadSuccess()
中,我们调用函数
//The viewable is fetched from the file based on certain criteria
viewer.loadDocumentNode(doc, viewable, loadOptions)
这在第一次加载新文件时会出现以下错误,我不确定如何解决:
Uncaught TypeError: Cannot read property 'dispatchEvent' of null
at f.dispose (FragmentList.js:782)
at u.dtor (RenderModel.js:144)
at H.unloadModel (Viewer3DImpl.js:2763)
at H.unloadCurrentModel (Viewer3DImpl.js:2925)
at T.Z.tearDown (Viewer3D.js:800)
at T.tearDown (GuiViewer3D.js:180)
at T.Z.loadDocumentNode (Viewer3D.js:1713)
at onDocumentLoadSuccess (eval at <anonymous> (jquery.min.js:1), <anonymous>:142:12)
at Function.p (Document.js:146)
at l (Xhr.js:564)
如果再次加载新文件并且按预期工作,则不会显示相同的错误。
任何帮助都非常感谢。
正如您在堆栈跟踪中看到的,当卸载Model
/RenderModel
对象时(切换到另一个 SVF 时(,它将自动处置其所有片段,因此您不必手动执行此操作。
如果即使不手动删除片段仍然收到此错误,则可能是SceneBuilder
扩展中的错误。在这种情况下,请向forge (dot) help (at) autodesk (dot) com
提交错误报告。