About Numeric Formats
Using SmartCAM's machine file, you can output the precise numeric format that your machine requires. For example, you may need to display four places to the right of the decimal point for positioning moves but display feed rates with only one digit to the right of the decimal point.
Most numeric formats are set in the @DECLARE CGT section of the CGT file, but they can also be assigned for specific output cases in the CGT file output @sections.
Use the numeric format nomenclature shown below, with the CGT #FMT() function for numeric CGT words such as positioning, feedrates, etc.
Format Type
The following format types are available:
Letter | Name | Description |
---|---|---|
D | Decimal | The number will include a decimal point. |
F | Filled | All unfilled fields will be filled with zeros (no decimal point). |
T | Trailing | Trailing zeros will be inserted and leading zeros will be suppressed (no decimal point). |
L | Leading | Leading zeros will be inserted and trailing zeros will be suppressed (no decimal point). |
P | Padded | Trailing zeros will be inserted and leading zeros will be suppressed (includes decimal point). |
Z | Zero | Leading and trailing zeros only output if needed. Mainly used for machines with limited memory. 1.0 is output as 1., 0.1 is output as .1, 1.1 is output as 1.1, and zero is output as 0. |
E | Everything | Leading and trailing zeros will be inserted (includes decimal point). |
Sign Control
Sign control determines whether a sign character should be output. The following options are available:
Sign | Description |
---|---|
(no entry) | Only negative numbers will be preceded by a sign. |
+ | All numbers will be preceded by a sign. |
! | No numbers will be preceded by a sign. |
Digits Allowed to Left and Right of Decimal Point
This field specifies the size and accuracy of the numbers. Values are rounded to the appropriate accuracy during formatting.
Field Width
This specifies the width of the numeric field, for right justification of the formatted values. This is useful when the decimal points need to line up. SmartCAM fills the left of the field with space characters.
Sign Position
SmartCAM uses this setting with field width to determine the location of the sign character, as counted from the left. If you do not specify a value, SmartCAM positions the sign against the formatted value. A setting of 1 will place the sign character in the first column.
The following table shows the value "10.75" expressed in different formats:
Format | Expression |
---|---|
D3.4 | 10.75 |
T3.4 | 107500 |
L3.4 | 01075 |
F3.4 | 0107500 |
P3.4 | 10.7500 |
E3.4 | 010.7500 |
Format Precedence Hierarchy
There are 4 levels of formatting precedence. They are listed here in order from highest to lowest.
Inline Formatting
Inserting a #FMT() command inline on a numeric #CGTWord in a CGT output section will override any other assigned formatting.
ex.
@LINE
This will override any other formatting for this specific occurrence of #myXvar in @LINE.
<X#FMT(#myXvar, D3.6)>
Individual #CGTWord Formatting
Use this method in the @DECLARE section to assign a format for a particular #CGTWord for use on all of its occurrences throughout the CGT.
ex.
@DECLARE
This will assign a specific numeric format for #XPOS and use that wherever it is output in the CGT
unless the higher precedent Inline Formatting is used to override it.
#FMT(#XPOS, D4.2)
We strongly suggest using this method when possible in place of inline formatting
to make the CGT more readable.
#CGTWord Class Formatting
Use this method in the @DECLARE section to assign formats for entire classes of #CGTWords. Consult The CGT Word Reference for a list of the available classes that can be assigned, and consult individual #CGTWords in the same reference to see which FMT Class they belong to.
ex.
@DECLARE
Will assign the respective formats to all #CGTWords that are of the #F_Decimal and
#F_Integer FMT classes, unless overridden by Individual #CGTWord Formatting or Inline Formatting.
#FMT(#F_Decimal,D2.6)
#FMT(#F_Integer,T2.0)
SMF Formatting (Deprecated)
Does the same thing as the #CGTWord Class Formatting, but the formats are assigned in the SMF.