Configure the units of dynamic components in Ruby

Hello,

I am currently setting up dynamic components using Ruby.

To add a units to a dynamic component attribute I use this method::

s.set_attribute "dynamic_attributes", "_ myattribute_units", "STRING"

In this example my dynamic attribute will be text.

Many units are easy to apply but others are not because I don’t know what to call them like the “DECIMAL NUMBER”.

List of what I found and what I did not find with a question mark “?” :

  • WHOLE NUMBER = ?
  • DECIMAL NUMBER = ?
  • PERCENTAGE = ?
  • TRUE / FALSE = ?
  • TEXT = STRING
  • INCHES = INCHES
  • DECIMAL FEET = FEET
  • MILLIMETERS = MILLIMETERS
  • CENTIMETERS = CENTIMETERS
  • METERS = METERS
  • DEGREES = DEGREES
  • DOLLARS = DOLLARS
  • EUROS = EUROS
  • YEN = YEN
  • POUNDS (weight) = POUNDS
  • KILOGRAMS = KILOGRAMS

The one that bugs me the most now and the “DECIMAL NUMBER” that I have already tried to set with “DECIMAL”, “DECIMAL_NUMBER” etc … but it does not work because I get a 601 error:

Message d'erreur

This error message is normal as long as I cannot find the exact text for parameterized in decimal.

So I need your help to find out how to set to “Decimal” and if possible for other units with question mark ?.

Thank you in advance for your help.

I found the answer to my question just with a little logic:

  • WHOLE NUMBER = INTEGER
  • DECIMAL NUMBER = FLOAT
  • PERCENTAGE = PERCENT
  • TRUE/FALSE = BOOLEAN
  • TEXT = STRING
  • INCHES = INCHES
  • DECIMAL FEET = FEET
  • MILLIMETERS = MILLIMETERS
  • CENTIMETERS = CENTIMETERS
  • METERS = METERS
  • DEGREES = DEGREES
  • DOLLARS = DOLLARS
  • EUROS = EUROS
  • YEN = YEN
  • POUNDS (weight) = POUNDS
  • KILOGRAMS = KILOGRAMS

I’m not going to delete this topic so that it can be used by someone else who might need it.

Hello,

I continue on the same subject because the question is also on the options of the attributes.

In the image below I manage to configure almost all the options of a dynamic attribute except cella with the question mark:

I have done a lot of research on the web without success!

Do you know how to do it?

Thank you in advance for your help.

Just install an attribute inspector extension and look at the “dynamic_attributes” dictionary.

I use: Attribute Inspector by Aerilius

FWIW … the answer is "_attribute_formulaunits" with values:
"FLOAT", "STRING", "INCHES", or "CENTIMETERS"

2 Likes

Well done, it works wonderfully!

I just tested Attribute Inspector and found it to be a wonderful plugin.

Thanks Dan for your help. :slightly_smiling_face:

1 Like

For your information, none of this internal implementation is public API. You can investigate it yourself and try to work against it, but it is not advised.