与剖面交互

Interact with section plane

我正在创建一个像这样的剖面:

    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 按钮创建时那样与这架飞机互动。任何人都可以指出正确的方向以实现这一目标吗?

提前致谢!

为什么要存储 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)