Formulas for counting objects by style

The formulas that follow count how many objects in a specific style there are in a drawing. Notice that there are two different formulas — one that counts objects in the specified style but does not count objects in its child styles, and another formula that counts objects both in the specified style and its child styles.

Counting objects without child styles

Extracts From Formula
1up OneUp1.Count(StyleName)
Layout Layout1.Count(StyleName)
  1. StyleName: The style of the objects which you want to count. Objects in its child styles are not counted.

IMPORTANT: To extract the total length of all objects in all styles, including the objects in the child styles, leave the argument empty.

Counting objects with child styles included

Extracts From Formula
1up OneUp1.CountAll(StyleName)
Layout Layout1.CountAll(StyleName)
  1. 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.Length(Cutting; m; yes); n2$ $Layout1.Length(Cutting, m, yes), n2$

Examples

The examples that follow show you how to write formulas for counting objects and set formatting for the results. The first formula does not include objects in child styles; the second and third examples include these objects. The n0 rounding identifier makes sure that the result is printed without a fractional part.

Objects in style Extracted From Use Example
Creasing Layout1 $Layout1.Count(Creasing); n0$ 44
Creasing, incl. child styles Layout1 $Layout1.CountAll(Creasing); n0$ 52
All styles, incl. child styles OneUp1 $OneUp1.CountAll(); n0$ 240
All styles, incl. child styles OneUp1 $OneUp1.Count(); n0$ 240

See the general rules for how to write formulas and format formula results.