I know my code for the 2 by 2 by 2 cube is correct. However for the rest they are being housed on the same plane as the 2 by 2 by 2. Does anyone have suggestions on how to get the 1.8 by 1.8 by 1.8 cube to show stacked on top of the 2 by 2 by 2 and so on?

\begin{tikzpicture}

    \pgfmathsetmacro{\cubex}{0.4}
    \pgfmathsetmacro{\cubey}{0.4}
    \pgfmathsetmacro{\cubez}{0.4}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{0.6}
    \pgfmathsetmacro{\cubey}{0.6}
    \pgfmathsetmacro{\cubez}{0.6}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{0.8}
    \pgfmathsetmacro{\cubey}{0.8}
    \pgfmathsetmacro{\cubez}{0.8}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.0}
    \pgfmathsetmacro{\cubey}{1.0}
    \pgfmathsetmacro{\cubez}{1.0}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.2}
    \pgfmathsetmacro{\cubey}{1.2}
    \pgfmathsetmacro{\cubez}{1.2}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.4}
    \pgfmathsetmacro{\cubey}{1.4}
    \pgfmathsetmacro{\cubez}{1.4}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.6}
    \pgfmathsetmacro{\cubey}{1.6}
    \pgfmathsetmacro{\cubez}{1.6}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.8}
    \pgfmathsetmacro{\cubey}{1.8}
    \pgfmathsetmacro{\cubez}{1.8}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{2}
    \pgfmathsetmacro{\cubey}{2}
    \pgfmathsetmacro{\cubez}{2}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

\end{tikzpicture}
  • You draw all of them starting at same coordinate (0,0,0), and as you fill=white all sides, only the largest and last cube is seen. – Ignasi Oct 17 at 7:13

You could also declare a newcommand (or a pic) whith some parameters to save typping.

\documentclass[tikz,border=2mm]{standalone} 
\usetikzlibrary{positioning}

%#1: optional. Default: fill=white
%#2: origin
%#3: size: cubex=cubey=cubez (it's a cube)
\newcommand{\cube}[3][fill=white]{
    \draw[black, #1] (#2) -- ++(-#3,0,0) -- ++(0,#3,0) -- ++(0,0,-#3) -- ++(#3,0,0) -- ++(0,-#3,0)-- cycle;
    \draw[black,line join=bevel, #1] (#2) -- ++(0,#3,0) -- ++(0,0,-#3) (#2)++(0,#3,0)--++(-#3,0,0);
}

\begin{document}
\begin{tikzpicture}
    \cube[fill=red!30]{0,0,0}{2}
    \cube[fill=green!30]{0,2,0}{1.8}
    \cube[fill=blue!30]{0,3.8,0}{1.6}
    \cube[fill=pink!30]{0,5.4,0}{1.4}
    \cube[fill=orange!30]{0,6.8,0}{1.2}
    \cube[fill=violet!30]{0,8,0}{1}
    \cube[fill=brown!30]{0,9,0}{.8}
    \cube[fill=purple!30]{0,9.8,0}{.6}
    \cube[fill=cyan!30]{0,10.4,0}{.4}


\begin{scope}[xshift=3cm]
    \cube[fill=red!30]{0,0,0}{2}
    \cube[fill=green!30]{-.2,2,-.2}{1.8}
    \cube[fill=blue!30]{-.4,3.8,-.4}{1.6}
    \cube[fill=pink!30]{-.6,5.4,-.6}{1.4}
    \cube[fill=orange!30]{-.8,6.8,-.8}{1.2}
    \cube[fill=violet!30]{-1,8,-1}{1}
    \cube[fill=brown!30]{-1.2,9,-1.2}{.8}
    \cube[fill=purple!30]{-1.4,9.8,-1.4}{.6}
    \cube[fill=cyan!30]{-1.6,10.4,-1.6}{.4}
\end{scope}

\begin{scope}[xshift=6cm]
    \cube[fill=red!30]{0,0,0}{2}
    \cube[fill=green!30]{-.1,2,-.1}{1.8}
    \cube[fill=blue!30]{-.2,3.8,-.2}{1.6}
    \cube[fill=pink!30]{-.3,5.4,-.3}{1.4}
    \cube[fill=orange!30]{-.4,6.8,-.4}{1.2}
    \cube[fill=violet!30]{-.5,8,-.5}{1}
    \cube[fill=brown!30]{-.6,9,-.6}{.8}
    \cube[fill=purple!30]{-.7,9.8,-.7}{.6}
    \cube[fill=cyan!30]{-.8,10.4,-.8}{.4}
\end{scope}
\end{tikzpicture}\end{document}

enter image description here

Edit with defined commands for each side of the cube

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand\DrawXY[5][white]{\draw[black,fill=#1,shift={#2}] ({-#3/2},{-#4/2},{#5/2}) --({#3/2},{-#4/2},{#5/2}) --({#3/2},{#4/2},{#5/2}) --({-#3/2},{#4/2},{#5/2})-- cycle;}
\newcommand\DrawYZ[5][white]{\draw[black,fill=#1,shift={#2}] ({#3/2},{-#4/2},{#5/2}) --({#3/2},{-#4/2},{-#5/2}) --({#3/2},{#4/2},{-#5/2}) --({#3/2},{#4/2},{#5/2})-- cycle;}
\newcommand\DrawXZ[5][white]{\draw[black,fill=#1,shift={#2}] ({-#3/2},{#4/2},{#5/2}) --({#3/2},{#4/2},{#5/2}) --({#3/2},{#4/2},{-#5/2}) --({-#3/2},{#4/2},{-#5/2}) -- cycle;}
\begin{document}
\begin{tikzpicture}
\xdef\myX{2}
\xdef\myY{2}
\xdef\myZ{2}
\xdef\prevY{0}
\xdef\pscale{1}
\foreach \scale[count=\j from 0] in {1.,0.9,...,0.1}{%
\pgfmathsetmacro\myYY{\prevY+(\pscale*\myY)}
\DrawXY[red]{(0,{\myYY},0)}{\scale*\myX}{\scale*\myY}{\scale*\myZ}
\DrawYZ[red!90]{(0,{\myYY},0)}{\scale*\myX}{\scale*\myY}{\scale*\myZ}
\DrawXZ[red!80]{(0,{\myYY},0)}{\scale*\myX}{\scale*\myY}{\scale*\myZ}
\xdef\prevY{\myYY}%
\xdef\pscale{\scale}
}
\end{tikzpicture}
\end{document}

Output:

enter image description here

Just your code inside scopes and a shift plus scale:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\begin{scope}
    \pgfmathsetmacro{\cubex}{0.4}
    \pgfmathsetmacro{\cubey}{0.4}
    \pgfmathsetmacro{\cubez}{0.4}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{0.6}
    \pgfmathsetmacro{\cubey}{0.6}
    \pgfmathsetmacro{\cubez}{0.6}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{0.8}
    \pgfmathsetmacro{\cubey}{0.8}
    \pgfmathsetmacro{\cubez}{0.8}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.0}
    \pgfmathsetmacro{\cubey}{1.0}
    \pgfmathsetmacro{\cubez}{1.0}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.2}
    \pgfmathsetmacro{\cubey}{1.2}
    \pgfmathsetmacro{\cubez}{1.2}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.4}
    \pgfmathsetmacro{\cubey}{1.4}
    \pgfmathsetmacro{\cubez}{1.4}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.6}
    \pgfmathsetmacro{\cubey}{1.6}
    \pgfmathsetmacro{\cubez}{1.6}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.8}
    \pgfmathsetmacro{\cubey}{1.8}
    \pgfmathsetmacro{\cubez}{1.8}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{2}
    \pgfmathsetmacro{\cubey}{2}
    \pgfmathsetmacro{\cubez}{2}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;
\end{scope}
\begin{scope}[shift={(0,2)},scale=0.9]
    \pgfmathsetmacro{\cubex}{0.4}
    \pgfmathsetmacro{\cubey}{0.4}
    \pgfmathsetmacro{\cubez}{0.4}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{0.6}
    \pgfmathsetmacro{\cubey}{0.6}
    \pgfmathsetmacro{\cubez}{0.6}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{0.8}
    \pgfmathsetmacro{\cubey}{0.8}
    \pgfmathsetmacro{\cubez}{0.8}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.0}
    \pgfmathsetmacro{\cubey}{1.0}
    \pgfmathsetmacro{\cubez}{1.0}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.2}
    \pgfmathsetmacro{\cubey}{1.2}
    \pgfmathsetmacro{\cubez}{1.2}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.4}
    \pgfmathsetmacro{\cubey}{1.4}
    \pgfmathsetmacro{\cubez}{1.4}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.6}
    \pgfmathsetmacro{\cubey}{1.6}
    \pgfmathsetmacro{\cubez}{1.6}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.8}
    \pgfmathsetmacro{\cubey}{1.8}
    \pgfmathsetmacro{\cubez}{1.8}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{2}
    \pgfmathsetmacro{\cubey}{2}
    \pgfmathsetmacro{\cubez}{2}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;
\end{scope}
\begin{scope}[shift={(0,3.8)},scale=0.8]
    \pgfmathsetmacro{\cubex}{0.4}
    \pgfmathsetmacro{\cubey}{0.4}
    \pgfmathsetmacro{\cubez}{0.4}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{0.6}
    \pgfmathsetmacro{\cubey}{0.6}
    \pgfmathsetmacro{\cubez}{0.6}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{0.8}
    \pgfmathsetmacro{\cubey}{0.8}
    \pgfmathsetmacro{\cubez}{0.8}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.0}
    \pgfmathsetmacro{\cubey}{1.0}
    \pgfmathsetmacro{\cubez}{1.0}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.2}
    \pgfmathsetmacro{\cubey}{1.2}
    \pgfmathsetmacro{\cubez}{1.2}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.4}
    \pgfmathsetmacro{\cubey}{1.4}
    \pgfmathsetmacro{\cubez}{1.4}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.6}
    \pgfmathsetmacro{\cubey}{1.6}
    \pgfmathsetmacro{\cubez}{1.6}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{1.8}
    \pgfmathsetmacro{\cubey}{1.8}
    \pgfmathsetmacro{\cubez}{1.8}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;

    \pgfmathsetmacro{\cubex}{2}
    \pgfmathsetmacro{\cubey}{2}
    \pgfmathsetmacro{\cubez}{2}
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
    \draw[black,fill=white] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;
\end{scope}
\end{tikzpicture}
\end{document}

Output:

enter image description here

  • The shifts could be (-0.1,0.9) and (-0.2,3.6) for better result, but I think the scale should be (to) lower value... – koleygr Oct 17 at 6:31
  • For centered: [shift={(-0.05,1.85)},scale=0.9] and [shift={(-0.1,3.5)},scale=0.8] – koleygr Oct 17 at 6:38
  • Hi @koleygr thank you for your response! I am confused as to why you only 3 cubes are showing and why the code needed to be repeated. Any help you can provide is appreciated! – Szcur Oct 17 at 7:05
  • @Szcur, I just show a way... I suppose it can be aded in a foreach loop to avoid repeating code and to repeat the cubes from 1 to 0.1 scale... I will try it later because I have not the time right now... – koleygr Oct 17 at 8:00
  • @Szcur... I have edited till the last comment – koleygr Oct 17 at 23:16

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.