The so-called "Formula N" allows a specific entity to be added only once in the module, but allowing the user to increase or decrease the quantity that this item will be repeated.
In this documentation we will use as an example a cabinet that may contain a varied number of shelves. So that it is not necessary to add each shelf individually, it is possible to register the aggregate shelf only once and use the formula N with repetition with variable distance.
For that:
1. Access the Registry - Modules menu.
2. Select the cabinet in which the shelf will be added by the navigation tree.
3. Access the Inserts tab.
4. Perform the registration of the aggregate shelf normally. To see how to register and configure an aggregate, click here.
5. In Dimension, fill in the desired dimensions in Width, Height and Depth.
In the example used, we set the width of the shelf to be the width of the parent (since the sides are aggregated outside the boundaries of the cabinet), the height is fixed at 15mm, and the depth is the parent depth minus 40mm.
6. In Positioning, configure the positioning on the axes, but keep the axis that will be configured with the repetition formula blank.
In the example of the cabinet with shelves, fill the X and Y axes with the desired position and leave the Z axis, corresponding to the axis where the repetition should occur, blank.
7. In Repetition, fill in:
Insertion: Number of repeated aggregates when inserting the module in the design.
Minimum: Minimum amount of repetition of the aggregate after insertion into the design.
Maximum: Maximum amount of repetition of the aggregate after insertion into the design.
In the example, we use the insertion quantity of 6 shelves, a minimum of 1 and a maximum of 8.
8. Check the Recalculate checkbox if any of the fields (Insert, Minimum or Maximum) are filled with formulas, so that repetition is recalculated with each design change.
9. In Positioning, in the field of the axis on which the repetition should occur, fill in the repetition formula with a fixed distance:
X axis: $N$ == 1 ? $Pw$/2-$W$/2 : ((($Pw$-(2*VAR1)-($W$*$N$))/($N$+1))*$NI$)+VAR1+($NI$ > 1 ? ($NI$-1)*$W$ : 0)
Where VAR1 should be replaced by the thickness of the side.
Y axis: $N$ == 1 ? -($PD$/2-$D$/2+(VAR1+VAR2)/2) : -(((($PD$-(VAR1+VAR2)-($D$ * $N$)) / ($N$ + 1)) * $NI$) + (VAR1+VAR2) +($NI$ > 1 ? ($NI$-1)*$D$ : 0))
Where VAR1 must be replaced by the thickness of the bottom and VAR2, by the indentation of the bottom.
Z axis: $N$ == 1 ? $PH$/2-$H$/2+VAR2/2 : ((($PH$-VAR2-(2*VAR1)-($H$*$N$))/($N$+1))*$NI$)+VAR2+VAR1+($NI$ > 1 ? ($NI$-1)*$H$ : 0)
Where VAR1 should be replaced by the thickness of the base VAR2, by the height of the baseboard.
In the example, we use the formula with variable distance on the Z axis, since the repetition of shelves occurs on this axis and the distances vary according to the number of repeated shelves. If the calculation must be with a fixed distance, then access the formula editor and, in the side tree, find in Formulas "Repetition with fixed distance in ...".
For the cabinet example, as the cabinet has a skirting board, we calculated the distance from the cabinet footer (without the height of the base), resulting in 60mm. In addition, the height of the upper and lower bases is 18mm each, and the height of the shelf is 15mm.
Example formula on the Z axis: $N$ == 1 ? $PH$/2-$H$/2+60/2 : ((($PH$-60-(2*18)-($H$*$N$))/($N$+1))*$NI$)+60+18+($NI$ > 1 ? ($NI$-1)*$H$ : 0)
10. After configuring the formula N, update the registration by clicking on the Refresh icon and test the insertion of the item in the environment. The distance from the shelves, that is, the height of the spans must be the same for all spans.