Skip to content Skip to sidebar Skip to footer

Autodesk Forge Viewer : Does Viewer.setthemingcolor Work On A Converted Dwg File?

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.setT

Solution 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, newTHREE.Vector4(0, 1, 1,1));
      }
    })

    returntrue;
  };

  _this.unload = function () {

    returntrue;
  };
};

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);

Post a Comment for "Autodesk Forge Viewer : Does Viewer.setthemingcolor Work On A Converted Dwg File?"