FORMAT Object
- Last UpdatedMar 24, 2023
- 3 minute read
The format object is used to format the output of real objects and especially real physical objects such as distances. It controls precision, units, conversions and unit qualifiers.
Format objects are also used to control conversions of strings to reals by providing guidance on dimensions and units. This occurs for text boxes in you interface, and also for real to string and string to real conversion methods.
Members
|
Name |
Type |
Purpose |
|---|---|---|
|
CompSeparator |
STRING | | |
Separator used for multi-component data types such as POSITIONS. |
|
Denominator |
REAL 32 |
Largest denominator for Imperial fractions. |
|
Dimension |
STRING ‘NONE’ L L2 L3 |
Number is un-dimensioned. Number is a LENGTH. Number is an AREA. Number is a VOLUME. |
|
The TYPE string can be any existing values (L L2 L3 NONE) or any standard dimension (Measure), or any standard unit (which indirectly defines a dimension) either in full name (for example, meter), or description or shortname (unitqualifier), or compound unit qualifier (for example, lb/m4) form. No validation is actually performed until the format is used. |
||
|
DP |
REAL 2 |
Number of decimal places for decimal fractions. |
|
ENU |
BOOLEAN TRUE FALSE |
Use ENU format when outputting POSITIONS. Use XYZ format when outputting POSITIONS. |
|
Fraction |
BOOLEAN FALSE TRUE |
Fractional part output as decimal. Fractional part output as fraction. |
|
FtLabel |
STRING |’| |
Label used for feet. For example: ' or FT or ft or feet. |
|
InchSeparator |
STRING |.| |
Separator between inches and fractions. |
|
Label |
STRING |mm| |
General distance label. For example: mm or m or " or IN. |
|
The label (and similarly the foot label and the inch separator can be any string (within normal and reasonable unit limitations!). They are primarily supplied to allow physical values to be formatted in any reasonable way on reports, in files and in text fields. However, it is often necessary for such values to be re-interpreted by the system (especially as they are validated after entry in the text field. In these case, if normal value and unit parsing fails to interpret the values then the string is reinterpreted with the Label, ftlabel and inch separators substituted by normal standard unit qualifiers and separators enabling the values and units to be successfully interpreted when correct and consistent with the format object. If the label is set to UNITS, then the standard unit qualifier will be output by the system, consistent with the dimension of the format. |
||
|
OriginExp |
BLOCK || |/*| |CE| |
With respect to World. With respect to World. With respect to Current Element. |
|
NextFormat |
STRING |
This specifies the name of another format object (looks for local and global variables) which will be considered for use as an alternative format when formatting a value to a string. If the current formats a value whose absolute value is less than one. The nextFormat may also be delegate to its own NextFormat object and so a chain of formats can be constructed below the forma actually specified by the calling function. Each succeeding format should define a smaller unit for formatting to and hence will convert the quantity to a bigger value. The format actually chosen will be that whose conversion unit produces a value that is greater than one. All formats must be of the same consistent dimension (measure) and each successive format must define a smaller unit (for example - a value of 200 mm will be formatted in cm, if the chain of formats have units of km, m, cm, mm, micron. One light year will be in km, one angstrom will be in microns. |
|
PadFractions |
BOOLEAN FALSE TRUE |
Do not pad Fractions. Pad Fractions with trailing spaces. |
|
TrailZeros |
BOOLEAN |
Trailing zeros are included up the required number of decimal places (as set by the DP member) if TrailZeros is unset, or if it is TRUE. If TrailZeros is FALSE trailing zeros will be removed up to and including a trailing decimal point. |
|
Units |
STRING MM M FINCH INCH |
Output number in millimeters. Output number in meters. Output number in feet and inches. Output number in inches. |
|
The TYPE string can be any standard form of unit, or a compound unit. If dimension is unset the unit often defines what the unit is when the format is used. No validation is performed on this string until the format is used when the values will be converted to units specified. |
||
|
Zeros |
BOOLEAN TRUE FALSE |
Leading zeroes are displayed for Imperial units. Leading zeroes are not displayed for Imperial units. |