SET() Error message - Invalid entity to animate

I am trying to change dynamic component properties through ruby ​​script. But an error occurs ( Invalild entity to animate ).
The syntax is as follows
nn = “component#7”
sang_def.set_attribute ‘dynamic_attributes’, ‘onclick’, “SET(”#{nn}!Hidden",0);"

I’m using SketchUp 2021 version and I’m running Windows 10.

up1

Most probably because the syntax is wrong. ( you are using wrong characters of double quotes " and not using or missing single quotes '… not proper usage of String literal etc. )

You can check e.g. the following topics regarding " Dynamic Components is a proprietary , closed-source native extension…" :

https://forums.sketchup.com/t/ruby-api-set-a-new-dynamic-attributes-attributes-and-value-but-this-windows-can-not-display-that-value/85567

https://forums.sketchup.com/t/error-while-adding-custom-attributes-through-ruby/123238

1 Like

The onclick formulas probably need to be defined in the Parent component for it to work properly.

thank you for reply.

I pasted the source code, but it looks strange in html.
The real code is below.

up3

If I put the script directly, it works fine. If I just put it using ruby ​​script, I get an error.