Guide to writing formulas and formatting formula results

Writing formulas

Formula patterns contain an N. What is it?

In formula patterns, N is a number from 1 through 9. It points to a predefined rectangular area in the design frame. For example, in a formula, OneUp2 refers to the OneUp2 area in a design frame; Layout1 to the Layout1 area, and so on. When writing formulas, use the number that corresponds to your situation.

$OneUpN.Length("Rillen 3pt", m)$
$OneUp2.Length("Rillen mit Rillkörper", m)$
$Layout1.SheetWidth(mm); n1$ cm.
Use quotation marks around space-separated style names

If a style name consists of a single word, type it as it is. If a style name is made up of multiple space-separated words, type the entire name in quotation marks, like this (in red):

$OneUp1.Length("Rillen 3pt", m)$
$OneUp1.Length("Rillen mit Rillkörper", m)$
Parameter names are case-sensitive

Formulas are not case-sensitive, but the names of parameters that you use in them are. The following two formulas produce different results, which depend on the values of the used parameters:

$OneUp1.Cost.TotalRulesLength; n2$
$OneUp1.Cost.totalRulesLength; n2$
Use smallcase for measurement units and rounding symbols

Formulas are not case-sensitive, but use smallcase when indicating measurement units and rounding:

$Layout1.SHEETWidth(mm); n1$ cm.
Millimeters are the default measurement units

Unless you indicate otherwise, formulas compute their results in millimeters. This means that if you do not specify a measurement unit, the formula will compute the result in millimeters. The following two formulas produce identical results:

$Layout1.SHEETWidth(mm)$ mm.
$Layout1.SHEETWidth()$ mm.

NOTE: To see the letters "mm" after a measurement, write them after the formula, as in the formulas above.

Know your list separator

When typing a formula, make sure you separate its elements with your computer's list separator symbol. Yours may be different from the one used in this guide. Examples (in red):

With Semicolon With Comma
$Layout1.Area(m; Plotting); n2$ $Layout1.Area(m, Plotting), n2$
$Layout1.AreaEx(yes; mm); n2$ $Layout1.AreaEx(yes, mm), n2$
$Fold3D1.BoundingBoxWidth(Production; mm; yes)$ $Fold3D1.BoundingBoxWidth(Production, mm, yes)$

Formatting formula results

Formatting as decimal

To see results as decimal, use the nN format as follows:

nN Decimal place Type Example
None Applies the default precision formatting.   12.30
n0 No decimal part n0 12
n1 One decimal place n1 12.3
n2 Two decimal places n2 12.30
n3 Three decimal places n3 12.300
n4 Four decimal places n4 12.3000
Hide ending zeros* 12.3

* Displays the result with the default metric units but hiding any ending zeros. This formatting is useful when "Hide ending zeros" is not selected in the program's global settings for measurement units and formatting.

NOTE: Apart from setting the number of decimal places, each format also applies the standard rounding rules. For example, for the number 12.7716, n0 displays 13; n1 displays 12.8; n2 displays 12.77; n3 displays 12.772.

Formatting as fractions

To see results as fractions, use the fN format as follows:

fN Converts to Type Example
f Applies the default precision formatting.   12 3/4
f0 No fractional part f0 7
f1 1/2 f1 12 1/2
f2 1/4 f2 12 3/4
f3 1/8 f3 14 5/8
f4 1/16 f4 14 11/16
f5 1/32 f5 12 26/32
f6 1/64 f6 18 51/64
Using a thousands separator

You can use a thousands separator for computed formula results. To use your system's digit grouping symbol (set in the regional settings), in the formatting section of the formula use a t.

In the examples below, comma is the default system's digit grouping symbol. In the left-hand column, see how to place the t mark in formulas and how EngView then displays computed formula results.

Set thousands separator Formatted result Note
$Layout1.Length(); t$ 2,000.25 Default precision
$Layout1.Length(); n2t$ 2,000.25 Precision 2
$Layout1.Length(); n3t$ 2,000.247 Precision 3
$Layout1.Length(); n0t$ 2,000 No decimal part

To print a custom thousands separator that is different from your system's digit grouping symbol (set in the regional settings), in the formatting section of the formula use a T+{char}.

Set thousands separator Formatted result Note
$Layout1.Length(); T+_$ 2_000.25 Default precision
$Layout1.Length(); n2T+_$ 2_000.25 Precision 2
$Layout1.Length(); n3 T+_$ 2_000.247 Precision 3
$Layout1.Length(); n0 T+_$ 2_000 No decimal part
Using a custom decimal symbol

To print custom decimal symbol that is different from your system's decimal symbol (set in the regional settings), in the formatting section of the formula use a D+{char}.

In the examples below, dot is the system's decimal symbol. In the left-hand column, see how to place the D mark in formulas and how EngView then displays computed formula results.

Set decimal symbol Formatted result Note
$Layout1.Length(); D,$ 2000,25 Default precision
$Layout1.Length(); n2D,$ 2000,25 Precision 2
$$Layout1.Length(); n3D,$ 2000,247 Precision 3
Using a custom list separator

The settings in this section apply to formulas ToolOffsetList and ToolPosList.

To use a custom list separator that is different from your system's list separator (set in the regional settings), in the formatting section of the formula use a L"string" string.

In the examples below, semicolon is the system's list separator. In the left-hand column, see how to place the L"string" mark in formulas and how EngView then displays computed formula results.

Set list separator Formatted result Note
$OneUp1.ToolOffsetList("Wheel Creasing"; ; ; 90; 0; mm; L"-")$ 200.00-273.00-193.00-273.00 List separator is "–", in default precision.
$OneUp1.ToolOffsetList("Wheel Creasing"; ; ; 90; 0; mm; n1L"-")$ 200.0-273.0-193.0-273.0 List separator is "–", in precision 1.
$OneUp1.ToolOffsetList("Wheel Creasing"; ; ; 90; 0; mm; L" / ")$ 200.00 / 273.00 / 193.00 / 273.00 List separator is "/", in default precision.
Combining formatting

Let's assume that the system's formatting is as follows:

Decimal symbol: comma

Digit grouping symbol: space

List separator: semicolon

  Formatted result Note
Use system's formatting and default precision (n2) $Layout1.Length()$ 2000,25
Use system's thousands separator (digit grouping symbol) and default precision (n2) $Layout1.Length(); t$ 2 000,25
Use custom formatting: precision: 3 decimal symbol: dot thousands separator:_ $Layout1.Length(); n3D.T+_$ 2_000.247
$ Layout1.Length(); n3T+_D.$
Use custom formatting: precision: 1 decimal symbol: dot thousands separator: _ list separator: / $OneUp1.ToolOffsetList("Wheel Creasing"; ; ; 90; 0; mm; n1D.T+_L" / ")$ 790.0 / 1_360.0 / 793.0 / 1_360.0
$OneUp1.ToolOffsetList("Wheel Creasing"; ; ; 90; 0; mm; n1T+_D.L" / ") $