Forge查看器属性下降

发布于 2025-01-18 04:30:23 字数 151 浏览 2 评论 0原文

我正在尝试创建一个下拉菜单,该菜单由Forge Viewer中的模型/多个模型中所有属性名称的独特列表填充。

是进入1的最佳方法

。获取散装特性 2。过滤到只获取属性的名称 3。创建一个唯一的数组o值

,还是有更简单的方法来执行此操作?似乎应该有

I'm trying to create a dropdown menu that is populated by a distinct list of all the property names in a model/multiple models that are in the forge viewer.

is the best way to

1 . get bulk properties
2. filter to just get the name of the properties
3. create a unique array o values from that

or is there a simpler way of doing this ? it seems like there should be

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情绪少女 2025-01-25 04:30:23

更有效的方法是使用 executeUserFunction 运行自定义代码段属性数据库网络工作者,并从那里收集所有属性名称,例如,如下所示:

async function getPropertyNames(model) {
    function userFunction(pdb) {
        let propertyNames = [];
        pdb.enumAttributes(function (attrId, attrDef) {
            propertyNames.push(attrDef.name);
        });
        return propertyNames;
    }
    return await model.getPropertyDb().executeUserFunction(userFunction);
}

A more efficient way would be to use the executeUserFunction to run a custom piece of code in the property database web worker, and collect all property names from there, e.g., like this:

async function getPropertyNames(model) {
    function userFunction(pdb) {
        let propertyNames = [];
        pdb.enumAttributes(function (attrId, attrDef) {
            propertyNames.push(attrDef.name);
        });
        return propertyNames;
    }
    return await model.getPropertyDb().executeUserFunction(userFunction);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文