我是Java的完全新手,但我希望在不久的将来开始学习课程。我目前有一个工作正常的Forge查看器,带有来自Autodesk的tutorial的扩展程序和仪表板。我想创建一个扩展,以读取项目中的某些参数,列出它们,并使我能够在列表中选择某个参数并将其隔离。
在Autodesk forge网站上,有post,其中说明了如何在创建Forge查看器时向基于标准的属性扩展添加基于属性的选择和隔离。我想将此选择/隔离功能实现到我可以通过Autodesk中的docking panel extension添加的tutorial。此扩展已经使我能够选择要从项目中读取的参数,并为我列出这些参数,因此仅缺少选择/隔离部分。
所以我的问题是,如何在对接面板扩展中实现选择/隔离功能?
我添加了运行我的查看器的代码的。
最佳答案
Autodesk.Viewing.UI.PropertyPanel
类提供了几种方法,您可以在派生类中重写这些方法以控制其行为。您可能正在寻找的方法是onPropertyClick(property: Object, event: Event)
:
class MyCustomPanel extends Autodesk.Viewing.UI.PropertyPanel {
constructor(viewer, container, id, title, options) {
super(container, id, title, options);
this.viewer = viewer;
}
onPropertyClick(prop, event) {
console.log('name', prop.name);
console.log('value', prop.value);
console.log('category', prop.category);
// Here you can get the dbIDs of objects you're interested in and isolate them, for example
// this.viewer.search(prop.value, (dbids) => {
// this.viewer.isolate(dbids);
// });
}
}
关于javascript - Autodesk Forge-集成基于属性的选择/隔离,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59983511/