Functions counting layout parts in a specified drawing

The functions that follow extract how many layout 1ups (parts) there are in a project. These functions take no account of the drawing in which you load the cost model: 1up or layout. This means that no matter in which drawing you load the cost model, you will receive identical results.

You can use an alternative method of counting layout 1ups, which uses functions that produce different results depending on whether you load the cost model in a 1up or layout drawings.

The functions

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

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 layout 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
OneUp1.PartsCount() 24 24 24 24
OneUp2.PartsCount() 5 5 5 5
Layout1.PartsCount() 15 15 15 15
Layout2.PartsCount() 14 14 14 14
OneUp1.PartsCount(Layout1) 15 15 15 15
Layout1.PartsCount(OneUp1) 15 15 15 15
OneUp1.PartsCount(Layout2) 9 9 9 9
Layout2.PartsCount(OneUp1) 9 9 9 9
OneUp2.PartsCount(Layout1) 0 0 0 0
Layout1.PartsCount(OneUp2) 0 0 0 0
OneUp2.PartsCount(Layout2) 5 5 5 5
Layout2.PartsCount(OneUp2) 5 5 5 5

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
OneUp1.PartsCount() 5 5 5 5
OneUp2.PartsCount() 24 24 24 24
Layout1.PartsCount() 15 15 15 15
Layout2.PartsCount() 14 14 14 14
OneUp1.PartsCount(Layout1) 0 0 0 0
Layout1.PartsCount(OneUp1) 0 0 0 0
OneUp1.PartsCount(Layout2) 5 5 5 5
Layout2.PartsCount(OneUp1) 5 5 5 5
OneUp2.PartsCount(Layout1) 15 15 15 15
Layout1.PartsCount(OneUp2) 15 15 15 15
OneUp2.PartsCount(Layout2) 9 9 9 9
Layout2.PartsCount(OneUp2) 9 9 9 9

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.

NOTE: Drawing names are enclosed in quotation marks when they precede the function; when a drawing name is used as function argument (in parentheses after the function), no quotation marks are needed.