Reply To: Zone Stamp Decimal Places

#2343
Csilla Mai
Keymaster

Hi Derek,

In your script a form of STR function is used, which is the first form in the GDL Guide:

STR (numeric_expression, length, fractions)

The fractions gives the number of characters after the floating point. If you would like the user to control the number of the decimals, then you can create a new parameter, for example “iDecimals” and rewrite the masterscript:

str_area_m2 = AreaM2Text + str(num_area_m2,8,iDecimals) + ' sq m'
str_area_ft2 = AreaFt2Text + str(num_area_ft2,8,iDecimals) + ' sq ft'
str_area_acre = AcreText + str(num_area_acre,8,iDecimals) + ' acres'
str_area_hect = HectText + str(num_area_hect,8,iDecimals) + ' hectares'

To format the values according to the Project Preferences setting, see the How to display values with units set in Project Preferences? post.

Csilla Mai
Library Developer, Library Team
GRAPHISOFT SE