SET() Error message: Invalild entity to animate ("Material")


#1

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


#2

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!!!


#3

please post the component, then we can specifically address the issue


#4

Here it is. It’s very simple function. By clicking the cylinder or the tooltip, their color changesMyCylinder.skp (478.4 KB) .


#5

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)


#6

THANK YOU so much for your help. You saved my day :relieved:


#7

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)


#8

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.
set(“Route1!Material”,“MyWhite”,“Blue”)
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


#9

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.