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

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 :relieved:

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

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.

auto_awesome

Quizás quisiste decir: hola no se pueden descargar los archivos para estudiarlos, no se si sea posible volver a subirlos gracias

volume_up

104 / 5.000

Resultados de traducción

star_border

Hello, the files cannot be downloaded to study them, I do not know if it is possible to upload them again, thanks

Sorry but I no longer have the files, 7 years is one or two computers ago

Materials need to be loaded to a file before the DC can reference them, so named materials are usually held in a swatch, usually with a formula that causes a redraw.

Masonry Wall | 3D Warehouse (sketchup.com)
This example contains a scaler/swatch you can place on an internal surface of a DC. The example uses scaled versions of the brick and block material shipped with Sketchup, data is placed in the material names so to pass to the DC using the text formulas. The area formula reads a back face painted 0020_Red

Moreover colours can be referenced without preload, using the inbuilt codes:
Class: Sketchup::Color — SketchUp Ruby API Documentation