# Repeating a sub-component within a Dynamic Component (3 Dimensions)

I’ve used this formula more times than I can count:

https://help.sketchup.com/en/article/114548 (Repeating a sub-component within a Dynamic Component (2 Dimensions)

I’ve looked and looked, but couldn’t find any 3-direction arrays, so I came up with one. Same basic premise with an added level.

Here’s how I organize:

xSpa(cing) - distance between columns across
ySpa(cing) - distance between rows front-to-back
zSpa(cing) - distance between rows bottom-to-top

X: (Position of source component) + COPY * xSpa
Y: (Position of source component) + COPY * ySpa
Z: (Position of source component) + COPY * zSpa

xDiv(ider) - # of columns across
yDiv(ider) - # of rows front-to-back
zDiv(ider) - # of rows botton-to-top

Copies: xdiv * ydiv * zdiv-1

myCol(umn): =COPY - myDep * xDiv * zDiv - myRow * xDiv
myDep(th): =FLOOR (COPY / (xDiv * zDiv))
myRow: =FLOOR ((COPY - (myDep * xDiv * zDiv) +.1) / xDiv)

See what you can do with it!
BT

Edit: made my variables consistent and kept my * from disappearing with the html formatting

I’m just struggling with the same but the last three lines?

xDivQ, zDivQ

What does the Q mean?

Originally, I used a Q for “Quotient”, which I dropped when I moved to a mostly 4-letter variable system. Should be corrected now. Did you get it to work?

After several days I got it to work. I had made some error here and there so I’ve learned some in the process.