autodesk-forge - 与剖面交互
问题描述
我正在创建一个剖面平面,如:
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)
推荐阅读
- javascript - 具有交替行和行号的文本区域
- kubernetes - 一段时间后在 Cloudant 中出现 401 客户端错误
- python - Python - ValueError:从 CSV 绘制图形时,min() arg 是一个空序列
- sql - PostgreSQL 中的 SQL 窗口函数
- css - SVG 无响应,脱离容器
- r - 使用方法“pmm”,同时从插补中排除变量
- laravel - Swift_AddressEncoder_IdnAddressEncoder 类不存在
- ios - iOS 图表放大一系列值
- python - 连接 Excel 文件,使用文件名作为索引引发错误
- javascript - Ajax 调用返回错误后重新提交表单