# Modulus Function for Dynamic Component Attribute

Hello, it is my first time posting.
I am modeling a Cabinet that it will be fully dynamic, the user will only enter a few values, like: Width, Height, Depth, Shelfcount etc…
I am now entering the formulas for the Shelves positions, what i am trying to achieve is a grid of shelves.
what i did manage is split the copies on the x axis using: “=(INT(COPY/vertical_sections)*cabinet!spacing_x)+cabinet!left_thickness”.
for splitting on the z axis, i need the opposite. (Modulus function) (Exp: “=(MOD(COPY)*cabinet!spacing_z)+cabinet!bottom_thickness”) but i can not seem to find such a function in the function list.

A modulus function gives the absolute value of a number or variable
can use ABS(number)The ABS function returns the absolute value of number.
However ABS(copy) is not needed as copy>=0

copy is a read only postive interger (except for zero, a value that is read as false like all negitives) is assign to each DC internal copy in order, with the zero attached to the orginal
copy is always greater or equal to zero, so for values greater than zero, use =if(copy,this,that)

so could use Z = startvalue +copy*somevalue
this would be startvalue for the orginal
then copied at somevalue times the interger upto the number of copies thereafter
if you wanted the cabinet to have no shelf, then for number =0, copies would be number-1, that is -1, so you could use in hidden
=if(copies<0,1,0) or =not(copies+1)

i built a quick and dirty modulo component so i had the formula handy in projects. maybe i
modulo.skp (10.2 KB)
t helps.

i copy & edit one of the formulas into a parent component and use it to calculate bits (like quadratic residue arrays with spacing requirements for acoustic diffusers) for other parts to consume.