首页 > 解决方案 > 与剖面交互

问题描述

我正在创建一个剖面平面,如:

    this.viewer.loadExtension("Autodesk.Section")
    const SectionTool = this.viewer.getExtension("Autodesk.Section")
    SectionTool.load()
    SectionTool.activate()
    SectionTool.tool.setSectionPlane(this.hitTest.face.normal, this.hitTest.point)

    const state = this.viewer.getState();
    this.viewer.restoreState(state);

这工作得很好,我得到了剖面。但是我无法像使用 UI 按钮创建时那样与这架飞机进行交互。谁能指出我正确的方向以使这成为可能?

先感谢您!

标签: autodesk-forgeautodesk-viewer

解决方案


为什么要存储 hitTest 结果,然后在没有切面的情况下恢复状态的其他方面(如果它们是在保存的状态中捕获的……),然后以编程方式从 hittest 结果中恢复切面……例如:

const hitTest = JSON.parse(localStorage.getItem('hitTestResult'))
delete state.cutplanes
viewer.restoreState(state)

 const SectionTool = viewer.getExtension("Autodesk.Section")
 SectionTool.activate()
 SectionTool.tool.setSectionPlane(hitTest.face.normal, hitTest.point)

推荐阅读