Home › Forums › Problems and solutions in GDL › Informations from the environment › Zone Stamp Decimal Places
- This topic has 3 replies, 2 voices, and was last updated 9 years ago by
Csilla Mai.
-
AuthorPosts
-
-
March 11, 2016 at 17:41 #2338
Derek Jackson
ParticipantHi,
I’m creating some custom Zone Stamps for our projects. They’re pretty much there, but I’ve noticed that they’ve stopped responding the project’s setting for number of decimal places (which the standard Zone Stamp happily does) – they seem to be stuck at two regardless of what I do.I have some real numbers which I use for output to scheduling, which sit at two decimal places. In the Master Script I have the lines:
str_area_m2 = AreaM2Text + str(num_area_m2,8,2) + ' sq m' str_area_ft2 = AreaFt2Text + str(num_area_ft2,8,2) + ' sq ft' str_area_acre = AcreText + str(num_area_acre,8,2) + ' acres' str_area_hect = HectText + str(num_area_hect,8,2) + ' hectares'
The ‘str_area’ parameters are used for the text2 string output on the plan, with the ‘num_area’ parameters remaining untouched. However, is the str(num_area,8,2) command somehow forcing the real numbers to sit at two decimals and ignore the project settings?
Thanks,
Derek
-
March 16, 2016 at 10:38 #2343
Csilla Mai
MemberHi 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 -
March 17, 2016 at 17:55 #2344
Derek Jackson
ParticipantThanks, I’ve happily got the string outputs in plan view correctly responding to the project preferences.
However, when I schedule the object (which looks at a realnum translation of the ROOM_AREA parameter), the schedule seems to be stuck at two decimal places. I’ve tried changing the calculated units preference, but this has no effect.
I suspect I need to do something with the REQUEST(“Calc_area_unit”) command? But I can’t get it to work – it throws up an error in the Parameters script when I place it in the Master script, and besides, I don’t how to apply it directly to a realnum parameter (the examples above show a conversion to a string).
Any thoughts? Thanks,
Derek
-
March 21, 2016 at 12:20 #2346
Csilla Mai
MemberHi Derek,
The REQUEST(“Calc_area_unit”) command is only supported in 2D script, and it returns a format which can be used for string conversions. For scheduling the Realnum parameter itself, the setting at Options/Project Preferences/Working Units/Angle & Font Size Decimals in Dialog Boxes: takes effect on the number of the decimals.
Csilla Mai
Library Developer, Library Team
GRAPHISOFT SE
-
-
AuthorPosts
- The forum ‘Informations from the environment’ is closed to new topics and replies.