I’m trying to change color of an object by using the SET() function. But each time it gives error. Error message: Invalild entity to animate (“Material”)
I’d like to use the onClick function with the dynamic component I created to change the color (Material). I follow the steps shown in tutorials and doing nothing different but it still doesn’t work properly. Help!!!
please post the component, then we can specifically address the issue
Here it is. It’s very simple function. By clicking the cylinder or the tooltip, their color changesMyCylinder.skp (478.4 KB) .
the set did not have the current material in its list. This seems to formed some sort of bug, which I could not fix.
A rewrite solved the problem
MyCylinder2.skp (478.1 KB)
THANK YOU so much for your help. You saved my day
OK, this time it didn’t give any error, but still doesn’t change the color of the cylinders when clicking on the sign. I’m not sure what I’m doing wrong here. Also, I noticed that the order of the Group and component (Route1) on the Component Attributes panel is wrong. How can I move the Group up so that it sits right after NewRoute in the panel? Is this the reason the function not working properly? (the attached screen)
Color_Change_DC.skp (202.0 KB)
In the materials dialogue press the “house” home icon, check the colors, you have named blue …white
and the white is named White & MyWhite & which is okay
I renamed the blue to “Blue” which is the paint to the group of pipes
However on entering the group I note that each pipe is painted White
Trying to change Material in Route1 to White only allows “MyWhite”, the first bug
Next I checked the surface material of the pipes within the group. they were all painted white. I selected and painted them default, closed the group
Now I assume you require the whole group to change, however if you want to you can pick a member within the group and paint it a color/material and this will not change with the group. I amended to default to try and undo the White…MyWhite confusion
typing in the material value in Route1 now changes the color
Now delete onClick rewrite it.
The software will then recalibrate and it should work
Color_Change_DC (1).skp (202.4 KB)
I am not sure, but I believe that the DC writes a memory address which it does not easily let go… so rewriting the formula seems to fix this
I don’t know what to say, thank you so much for taking the time explaining the errors I’ve made here. I have to admit the Material attribute seems very confusing. I watched many video tutorials to understand how it works but can’t find much there unfortunately.