在Autodesk Forge Viewer中为对象着色的最佳方法



我使用autodesk forge查看器执行BIM项目(我使用的是查看器版本6*(。

我想根据完成状态给不同的物体涂上不同的颜色。

检查下图。

对象已经着色,我尝试使用setThemingColor,但它不起作用。我不想使用setSelectionColor,因为我的对象是在不选择特定对象的情况下显示颜色。

例如:在下面的图片中,我想用各自的颜色给圆形物体上色。

sample_image

更新:

这是我使用的代码片段

function changeObjectColor(modelId, status){

var color ;
switch (status) {
case 'Green':
color =  new THREE.Vector4(0, 0.5, 0, 0.5);
break;
case 'Red':
color =  new THREE.Vector4(1, 0, 0, 0.5);
break;
}
viewerApp.getCurrentViewer().setThemingColor(modelId,color);
}

结果设置颜色后的结果

我也使用隔离和选择方法,但即使删除了这两个方法调用,特定对象的颜色也不会改变

新的试用:

所以我按照本教程设置/隐藏了对象纹理(只是灰色(。但后来我尝试使用setThemingColor方法,但对象仍然不会显示预期的颜色

viewerApp.getCurrentViewer().setThemingColor(modelId, color, null, true);
viewerApp.getCurrentViewer().impl.invalidate(true, true, false);

我在这里错过了什么?

setThemingColor方法在v6中可用,应该可以正常工作。考虑发布负责设置颜色的代码片段。

以下是如何在Forge Digital Twin演示中使用该方法的示例。

相关内容

最新更新