Autodesk forge 如何在autodesk forge viewer中更改选择颜色?

Autodesk forge 如何在autodesk forge viewer中更改选择颜色?,autodesk-forge,autodesk-viewer,Autodesk Forge,Autodesk Viewer,在Forge Viewer v3中,我们设置了如下选择的颜色: onRequestClick(e) { const THREE_RED_COLOR = new THREE.Color(1, 0, 0); NOP_VIEWER.impl.setSelectionColor(THREE_RED_COLOR); NOP_VIEWER.select($(e.target).parent().find(`th`).data(`attributes`)); } 在v6中,此代码仍按预期选择查看

在Forge Viewer v3中,我们设置了如下选择的颜色:

onRequestClick(e) {
  const THREE_RED_COLOR = new THREE.Color(1, 0, 0);
  NOP_VIEWER.impl.setSelectionColor(THREE_RED_COLOR);
  NOP_VIEWER.select($(e.target).parent().find(`th`).data(`attributes`));
}
在v6中,此代码仍按预期选择查看器对象,但选择颜色保持为默认蓝色,不会按预期更改为红色。
现在是否通过不同的方法进行此更改?我还缺少什么吗?

当我尝试使用Viewer v6.4.2时,您的代码运行良好:

viewer.impl.setSelectionColor(new THREE.Color(1, 0, 0));
viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT,()=>viewer.select(1))
看到它在行动

您可能希望在浏览器控制台中再次尝试相关代码以隔离问题

编辑

如果查看源,它会清楚地表明它仅适用于三维模型:

/**
     * Changes the color of the selection for 3D models.
     * 
     * @example
     *  viewer.setSelectionColor(new THREE.Color(0xFF0000)); // red color
     * @param {THREE.Color} color
     * 
     * @alias Autodesk.Viewing.Viewer3D#setSelectionColor
     */
    Viewer3D.prototype.setSelectionColor = function(color, selectionType) {
        this.impl.setSelectionColor(color, selectionType);
    };

将与工程部一起记录功能请求,以便将此功能也移植到二维模型。

我确认它在二维文件上不起作用。 这是我尝试的截图

我调用了两个圆上的get选择。确认观众已参与,并且我能够检测到不同的选择

然后,当我调用setSelectionColor函数时,什么都没有发生


尝试使用查看器
viewer.clearSelection();viewer.set2dSelectionColor(红色)

其中
viewer=NOP\u viewer;红色=新的三种颜色(1,0,0)


这是否解决了问题?

您的示例使用的是3D viewer,使用2D viewer时的代码是否不同?(抱歉,忘了在我原来的帖子中提到这是2D)另外,我使用控制台记录了这个函数,它看起来像是接受了2个参数,而不是1
ƒ(e,t){var n=new O.Color(e);n.multiplyScalar(.5);var I=function(t){t.Color.set(e),t.emissive.set(n)};I(this.selectionMaterialBase),I(this.selectionMaterialTop),this.selectionMaterialBase.variants&&thi…
对于2d图纸,设置选择颜色的方法是:NOP_VIEWER.set2dSelectionColor(新的三种颜色(1,1,1))Hi Michale,有没有办法将alpha通道传递到选择颜色中?