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

Where to type the formatting symbols
In design frames
For cost model parameters
Formatting as decimal fractions

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

nN Decimal place Type Example
n Applies the default precision formatting. n; mm. 12.78 mm.
n0 No fractional part n0; mm. 7 mm.
n1 One decimal place n1; mm. 12.1 mm.
n2 Two decimal places n2; mm. 12.78 mm.
n3 Three decimal places n3; mm. 14.448 mm.
n4 Four decimal places n4; mm. 145.8879 mm.

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 mixed numbers

To see results as mixed numbers, use the fN format as follows:

fN Converts to Type Example
f Applies the default precision formatting. f; mm. 12 3/4 inch
f0 No fractional part f0; inch 7 inch
f1 1/2 f1; inch 12 1/2 inch
f2 1/4 f2; inch 12 3/4 inch
f3 1/8 f3; inch 14 5/8 inch
f4 1/16 f4; inch 14 11/16 inch
f5 1/32 f5; inch 12 26/32 inch
f6 1/64 f6; inch 18 51/64 inch
Second decimal place is the default rounding

Unless you indicate otherwise, formula results are rounded to the second decimal place. The following three formulas round their results identically:

$Layout1.SHEETWidth(); n2$ Two decimal places specified explicitly
$Layout1.SHEETWidth()$ Default rounding is used
$Layout1.SHEETWidth(); n$ Default rounding specified explicitly
Rounding results with functions

You can use formulas for rounding calculation results.

To round Use Example
By standard rounding rules:
23.44 → 23.00; 23.45 → 24.00
$round(OneUpN.Length(Cutting; mm)$. 23.00 mm.
Up to the next integer:
23.01 → 24.00
$roundup(OneUpN.Length(Cutting; mm)$, $ceil(OneUpN.Length(Cutting; mm)$ 24.00 mm.
Down to the previous integer:
23.99 → 23.00
$rounddown(OneUpN.Length(Cutting; mm)$, $floor(OneUpN.Length(Cutting; mm)$ 23.00 mm.
Using a thousands separator

You can use a thousands separator for computed formula results. Insert a t in the formula's formatting section — between the precision mark and the closing $ sign. This tells EngView to use your system's digit grouping symbol (set in the regional settings) when displaying formula results.

In the examples below, comma is the 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 separator Formatted result
$Layout1.SHEETWidth(); n2t$ mm. 2,000.25 mm.
$Layout1.SHEETWidth(); n4t$ mm. 1,500.3457 mm.
$Layout1.SHEETWidth(); n0t$ mm. 1,000 mm.