PDA

View Full Version : create a cubic grid shell in VBA



kato01
08-19-2020, 04:24 AM
Hello,

Say I have a cube withe side d.
I would like to generate a 3D cubic SHELL of the above mentioned cube with the side size of (2*n+1)*d.
Looking for a code that generates the coordinates of the centers of these cubes.
A simple 3 level loop (like the pseudo code below) will generate a full structure.

for ix=-n to n
for iy=-n to n
for iz=-n to n
x0=ix*d
y0=iy*d
z0=iz*d
create cube(x0,y0,z0,d)
next iz
next iy
next ix

I am interested only in the outer shell.

Any ideas?

Thank you

snb
08-19-2020, 08:52 AM
Redim cube(12,12,12)