有没有办法在查看器中使用 BoxSelection 扩展启用部分选择
Is there a way to enable partial selection using the BoxSelection extension in the viewer
我们正在使用自定义扩展来处理 window 根据此博客 post 中的步骤在 Forge 查看器中进行的选择:https://forge.autodesk.com/blog/custom-window-selection-forge-viewer-part-iii。
我们可以在该扩展程序上设置 'partial selection' 模式。有没有办法使用 v7.32 中添加的新 BoxSelection 扩展来做到这一点?
添加了扩展名为 Autodesk.BoxSelection 的新选项:
使用几何交集
由于其他问题,该选项默认不开启,您可以通过以下代码切换。再次加载后,鼠标左向右拖动为包含,鼠标右向左拖动为相交。
async function enableGeomtricBoxSelection() {
// unload the extension, which was loaded with geometric selection turned off
viewer.unloadExtension('Autodesk.BoxSelection');
// reload the extension with geometric selection turned on
ext = await viewer.loadExtension('Autodesk.BoxSelection', {
useGeometricIntersection: true
});
// Display the toolbar button (optional) in the toolbar. You can invoke box
// selection by holding cmd(mac) / ctrl(windows) + mouse drag
ext.addToolbarButton(true);
}
enableGeomtricBoxSelection();
我们正在使用自定义扩展来处理 window 根据此博客 post 中的步骤在 Forge 查看器中进行的选择:https://forge.autodesk.com/blog/custom-window-selection-forge-viewer-part-iii。
我们可以在该扩展程序上设置 'partial selection' 模式。有没有办法使用 v7.32 中添加的新 BoxSelection 扩展来做到这一点?
添加了扩展名为 Autodesk.BoxSelection 的新选项: 使用几何交集
由于其他问题,该选项默认不开启,您可以通过以下代码切换。再次加载后,鼠标左向右拖动为包含,鼠标右向左拖动为相交。
async function enableGeomtricBoxSelection() {
// unload the extension, which was loaded with geometric selection turned off
viewer.unloadExtension('Autodesk.BoxSelection');
// reload the extension with geometric selection turned on
ext = await viewer.loadExtension('Autodesk.BoxSelection', {
useGeometricIntersection: true
});
// Display the toolbar button (optional) in the toolbar. You can invoke box
// selection by holding cmd(mac) / ctrl(windows) + mouse drag
ext.addToolbarButton(true);
}
enableGeomtricBoxSelection();