Create a cubic shell with VBA

tuli1954

New Member
Joined
Apr 26, 2018
Messages
13
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.
I am interested only in the outer shell.
VBA Code:
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


Any ideas?

Thank you
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
just figure it out
a cube has 6 faces. freeze on coordinate and loop the other two. do that for x=+/-Max(x),y=+/-Max(y) and z=+/-Maz(z)
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,011
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top