Functions counting layout parts in the active drawing

The functions that follow extract how many layout 1ups (parts) there are in a project by taking into account the drawing (1up or layout) in which the cost model is loaded. This means that the functions produce different results depending on whether the cost model is loaded in a 1up or a layout.

You can use an alternative method of counting layout 1ups, which uses functions that take no account of where the cost model is loaded.

The functions

To Count Apply Cost Model In Use Function
How many pieces of the active 1up there are in all layouts. 1up PartsCount()
How many layout 1ups (parts) there are in the active layout. Layout
How many pieces of a specific 1up there are in the active layout. Layout PartsCount(OneUpN)
How many pieces of the active 1up there are in a specific layout. 1up PartsCount(LayoutN)

Alphabetical counting

If you choose to use the system names — OneUp1, OneUp2, Layout1, Layout2 and so on — EngView links these names to the available drawings in alphabetical order. This means that a cost model applied to a project that contains the 1ups Label 1 and Label 2 distributed in two layouts named Layout 1 and Layout 2 will produce different results from those that the same cost model will produce if these same 1ups are named Rectangle and Ellipse, respectively, and the two layouts are named MainLayout and InitialLayout. In the first case, OneUp1 = Label 1, OneUp2 = Label 2; Layout1 = Layout 1 and Layout2 = Layout 2. In the second case, OneUp1 = Ellipse, OneUp2 = Rectangle, Layout1 = InitialLayout and Layout2 = MainLayout. See the examples below to understand how alphabetical counting affects results.

Examples

Two 1ups are arrayed in two layouts. In the first example, the 1ups are named Label 1 and Label 2; in the second, they are named Rectangle and Ellipse. In both examples, the layouts names are identical: Layout A and Layout B.

In the tables that accompany the two examples, the red highlights point to how alphabetical counting affects counting results.

Examples with the 1ups Label 1 and Label 2

  1up Layout
Function Label 1 Label 2 A B
PartsCount() 24 5 15 14
PartsCount(OneUp1) n/a n/a 15 9
PartsCount(OneUp2) n/a n/a 0 5
PartsCount(Layout1) 15 0 n/a n/a
PartsCount(Layout2) 9 5 n/a n/a

Examples with the 1ups Rectangle and Ellipse

The second example involves the same 1ups, but this time they are named Rectangle and Ellipse. The layouts are the same: Layout A and Layout B. The red highlights point to the difference in counting.

  1up Layout
Function Rectangle Ellipse A B
PartsCount() 24 5 15 14
PartsCount(OneUp1) n/a n/a 0 5
PartsCount(OneUp2) n/a n/a 15 9
PartsCount(Layout1) 15 0 n/a n/a
PartsCount(Layout2) 9 5 n/a n/a

TIP: In the PartsCount() function, you can cite the names of drawings instead of the names of the system names OneUpN or LayoutN. For example, you can type the functions PartsCount(Rectangle) and PartsCount(Layout B). This way the function will always return the same result. Please note that using this approach requires that you follow a strict naming convention for your 1ups and layouts.

TIP: When typing functions, you can cite the names of drawings instead of the names of the system names OneUpN or LayoutN. For example, you can type the functions "Ellipse".PartsCount(), "Layout A".PartsCount(), "Rectangle".PartsCount(Layout A), "Layout B".PartsCount(Rectangle). This way the functions will always return the same results. Please note that using this approach requires that you follow a strict naming convention for your 1ups and layouts.