问题
viewer.setThemingColor works fine for me to change the color of something in a revit to svf file
but when i try and use it for a DWG to SVF conversion it does nothing.
oViewer.setThemingColor(1604, new THREE.Vector4(0, 1, 1,1));
Note one thing I am assuming is that the dbId that the mouse click does for seletion is the same dbId I need to use for setThemingColor
Any pointers would be helpful.
回答1:
That should work... Are you sure about you are passing a correct dbId? In fact it works on my side.
You can give it a try on my viewer playground. It could be that there is an issue specific to your model, in which case you could share that design with us. Privately if needed.
Here is my test code:
AutodeskNamespace("Autodesk.ADN.Viewing.Extension");
Autodesk.ADN.Viewing.Extension.Basic = function (viewer, options) {
Autodesk.Viewing.Extension.call(this, viewer, options);
var _this = this;
_this.load = function () {
viewer.addEventListener(Autodesk.Viewing.SELECTION_CHANGED_EVENT, function(e){
if(e.dbIdArray.length) {
var dbId = e.dbIdArray[0];
console.log('DbId: ' + dbId);
viewer.setThemingColor(dbId, new THREE.Vector4(0, 1, 1,1));
}
})
return true;
};
_this.unload = function () {
return true;
};
};
Autodesk.ADN.Viewing.Extension.Basic.prototype =
Object.create(Autodesk.Viewing.Extension.prototype);
Autodesk.ADN.Viewing.Extension.Basic.prototype.constructor =
Autodesk.ADN.Viewing.Extension.Basic;
Autodesk.Viewing.theExtensionManager.registerExtension(
"Autodesk.ADN.Viewing.Extension.Basic",
Autodesk.ADN.Viewing.Extension.Basic);
来源:https://stackoverflow.com/questions/38534862/autodesk-forge-viewer-does-viewer-setthemingcolor-work-on-a-converted-dwg-file