Constructors
NumberFormat
#public NumberFormat(bool specialCaseIntegers, bool specialCaseRationals, bool specialCaseIntegralConstants, bool specialCaseRationalConstants, bool specialCaseIntegralRoots, int minimumDecimals, int maximumDecimals, bool roundLastDecimal, int mantissaMinimumDecimals, int mantissaMaximumDecimals, int eNotationLowerLimit, int eNotationUpperLimit, bool eNotationSuperscript)
Create a new NumberFormat state.
Parameters:
| specialCaseIntegers (bool) | If true, numbers that are close to integers are formatted as such. |
| specialCaseRationals (bool) | If true, numbers that are close to rationals (ie. fractions) are formatted as such. |
| specialCaseIntegralConstants (bool) | If true, number that are multiples of pi are formatted as such. |
| specialCaseRationalConstants (bool) | If true, numbers that are some fraction of pi are formatted as such. |
| specialCaseIntegralRoots (bool) | If true, numbers that are roots of integers are formatted as such. |
| minimumDecimals (int) | Number of decimal places to always include during regular number formatting. |
| maximumDecimals (int) | Maximum number of decimals to display during regular number formatting. |
| roundLastDecimal (bool) | If true, excess decimals are rounded away silently. If false, they are still rounded but an ellipsis is appended to mark the loss. |
| mantissaMinimumDecimals (int) | Number of decimals to always include during scientific notation formatting. |
| mantissaMaximumDecimals (int) | Maximum number of decimals to display during scientific notation formatting. |
| eNotationLowerLimit (int) | Numbers smaller than 10^limit will be displayed using scientific notation. |
| eNotationUpperLimit (int) | Numbers bigger than 10^limit will be displayed using scientific notation. |
| eNotationSuperscript (bool) | If true, scientific notation uses superscript symbols for the power. |
Properties
Honest
#Same as Minimal, but whenever the displayed digits do not capture the exact value, an ellipsis is appended.
Intent
#Gets the standard humanistic number formatting for Grasshopper. The numeric format attempts to reverse engineer all intent.
MantissaMaximumDecimals
#Maximum number of decimals to display for the mantissa during scientific formatting.
MantissaMinimumDecimals
#Minimum number of decimals to display for the mantissa during scientific formatting.
Minimal
#Gets the number formatting rules which most closely track common formatting in software. Floating point numbers always have at least one decimal digit, but no more than 6 and the final digit is rounded.
RoundLastDecimal
#Round away excess decimals silently. If false, excess decimals are still rounded, but an ellipsis character will be appended to mark the loss.
ScientificNotationLowerThreshold
#Gets the power of ten below which numbers are formatted using scientific notation.
ScientificNotationSuperscript
#Gets whether to format scientific notation using 'e' or using superscripts. If this property yields false, the formatting should look like 1.534e-17, if this property yields true, the formatting should look like 1.534×10⁻¹⁷.
ScientificNotationUpperThreshold
#Gets the power of ten above which numbers are formatted using scientific notation.
SpecialCaseRationalConstants
#Numbers that are close to fractional values of PI will be displayed as such.
Methods
Format
#Format a list of numbers until they fit within the provided limit. This method will iteratively lower the MaximumDecimals to 1 until the text fits within the limit, or it will return the shortest string.
Format
#Format a list of numbers using a formatting pattern.
Modify
#public NumberFormat Modify(bool? specialCaseIntegers = null, bool? specialCaseRationals = null, bool? specialCaseIntegralConstants = null, bool? specialCaseRationalConstants = null, bool? specialCaseIntegralRoots = null, int? minimumDecimals = null, int? maximumDecimals = null, bool? roundLastDecimal = null, int? mantissaMinimumDecimals = null, int? mantissaMaximumDecimals = null, int? eNotationUpperLimit = null, int? eNotationLowerLimit = null, bool? eNotationSuperscript = null)
Modify this formatting.
Parameters:
| specialCaseIntegers (bool? = null) | |
| specialCaseRationals (bool? = null) | |
| specialCaseIntegralConstants (bool? = null) | |
| specialCaseRationalConstants (bool? = null) | |
| specialCaseIntegralRoots (bool? = null) | |
| minimumDecimals (int? = null) | |
| maximumDecimals (int? = null) | |
| roundLastDecimal (bool? = null) | |
| mantissaMinimumDecimals (int? = null) | |
| mantissaMaximumDecimals (int? = null) | |
| eNotationUpperLimit (int? = null) | |
| eNotationLowerLimit (int? = null) | |
| eNotationSuperscript (bool? = null) |