Add formula to dynamic component attributes with ruby

eg. I want to add Copies to dynamic attributes, the formula is: ‘Component#7!LenX/10’, if I add this formula with UI, it works well, but if I add this formula with ruby, after user scale the component with scale tool, the Copies attribute will turn into a fixed number, and will never work again after that.

Here is the code:

definition.set_attribute('dynamic_attributes', '_copies_formula', 'Component#7!LenX/10')
definition.set_attribute('dynamic_attributes', '_inst__copies_formula', 'Component#7!LenX/10')
definition.set_attribute('dynamic_attributes', '_copies_label', 'Copies')
definition.set_attribute('dynamic_attributes', '_inst__copies_label', 'Copies')

Does anyone know what’s going on?