Simple configurator - i am total CAD noob in programing

Helo All

I am CAD guy (PTC Creo parametric software). I exported my project to obj, made some tweaks in Blender and then uploaded to Sketchfab.My story short.

My goal is to change the color of “red” material for couple of “parts” in 3D model. The parts share the same material. Model below:

I tried to accomplish it by my own checking and digging a little bit existing examples like:

how ever all I learned is that this :

api.getMaterialList(function(err, materials) {
myMaterials = materials;

            for (var i = 0; i < myMaterials.length; i++) {
                var m = myMaterials[i];

is java script for arrays :))))

and that this example of changin color/texture does not change the diffuse color I am most interested in, but the emition channel

  function makeMyModelBlue(enabled) {
            for (var i = 0; i < myMaterials.length; i++) {
                var m = myMaterials[i];
                // here change only the channel you need to change
                m.channels.EmitColor.factor = 1;
                m.channels.EmitColor.enable = enabled;
                m.channels.EmitColor.color = [0.0, 0.0, 1.0];
                api.setMaterial(m);

I tried to replace m.channels.EmitColor.color = [0.0, 0.0, 1.0]; with m.channels.difuseColor.color = [#008000]; but without succes

so if I can ask about little help I would be very greatfull :))

1 Like

Gran proyecto colega…Espero tengas mucho exito!

En el caso que quieras tener unas de estas cajas de herramientas para poder copiar, las puedes conseguir en nuestra web.

Sigue así te doy un voto Expertosenhogar

Just a lttle note : try to use “diffuse” instead of “difuse” .
You can read these posts , perharps could you find an answer



1 Like