If you'd be willing to switch to using \pgfkeys then this is quite simple. It's possible to declare a key to be an alias to a list of keys. This is done via:
\tikzset{my key/.style={list,of,other,keys}}
Then the key my key expands to list,of,other,keys in the proper way.
Here's an example of how to do it, based on your code at the linked question. I've added some spaces into the key names to make them easier (which meant that I saw some errors: you had dimy in place of dimz a couple of times). I've replaced the \ifthenelse by a boolean key. I've also condensed the line and fill keys to one single style which gives greater flexibility. You could replace the \filldraw by a simple \path for maximum flexibility here, then the grids could be filled or not filled at leisure.
Here's the code:
\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm,landscape]{geometry}
\usepackage{tikz}
%====================================
%emphasize vertices --> switch and emph style (e.g. thick,black)
%====================================
\newif\ifcuboidshaded
\newif\ifcuboidemphedge
\tikzset{
cuboid/.is family,
cuboid,
shift x/.initial=0,
shift y/.initial=0,
dim x/.initial=3,
dim y/.initial=3,
dim z/.initial=3,
scale/.initial=1,
density x/.initial=1,
density y/.initial=1,
density z/.initial=1,
rotation/.initial=0,
angle x/.initial=0,
angle y/.initial=90,
angle z/.initial=225,
scale x/.initial=1,
scale y/.initial=1,
scale z/.initial=sqrt(0.5),
front/.style={draw=black,fill=white},
top/.style={draw=black,fill=white},
right/.style={draw=black,fill=white},
shaded/.is if=cuboidshaded,
shade color/.initial=black,
shade perc/.initial=25,
emph edge/.is if=cuboidemphedge,
emph style/.style={thick},
}
\newcommand{\tikzcuboidkey}[1]{\pgfkeysvalueof{/tikz/cuboid/#1}}
% Commands
\newcommand{\tikzcuboid}[1]{
\tikzset{cuboid,#1} % Process Keys passed to command
\pgfmathsetmacro{\vectorxx}{\tikzcuboidkey{scale x}*cos(\tikzcuboidkey{angle x})}
\pgfmathsetmacro{\vectorxy}{\tikzcuboidkey{scale x}*sin(\tikzcuboidkey{angle x})}
\pgfmathsetmacro{\vectoryx}{\tikzcuboidkey{scale y}*cos(\tikzcuboidkey{angle y})}
\pgfmathsetmacro{\vectoryy}{\tikzcuboidkey{scale y}*sin(\tikzcuboidkey{angle y})}
\pgfmathsetmacro{\vectorzx}{\tikzcuboidkey{scale z}*cos(\tikzcuboidkey{angle z})}
\pgfmathsetmacro{\vectorzy}{\tikzcuboidkey{scale z}*sin(\tikzcuboidkey{angle z})}
\begin{scope}[xshift=\tikzcuboidkey{shift x}, yshift=\tikzcuboidkey{shift y}, scale=\tikzcuboidkey{scale}, rotate=\tikzcuboidkey{rotation}, x={(\vectorxx,\vectorxy)}, y={(\vectoryx,\vectoryy)}, z={(\vectorzx,\vectorzy)}]
\pgfmathsetmacro{\steppingx}{1/\tikzcuboidkey{density x}}
\pgfmathsetmacro{\steppingy}{1/\tikzcuboidkey{density y}}
\pgfmathsetmacro{\steppingz}{1/\tikzcuboidkey{density z}}
\newcommand{\dimx}{\tikzcuboidkey{dim x}}
\newcommand{\dimy}{\tikzcuboidkey{dim y}}
\newcommand{\dimz}{\tikzcuboidkey{dim z}}
\pgfmathsetmacro{\secondx}{2*\steppingx}
\pgfmathsetmacro{\secondy}{2*\steppingy}
\pgfmathsetmacro{\secondz}{2*\steppingz}
\foreach \x in {\steppingx,\secondx,...,\dimx}
{ \foreach \y in {\steppingy,\secondy,...,\dimy}
{ \pgfmathsetmacro{\lowx}{(\x-\steppingx)}
\pgfmathsetmacro{\lowy}{(\y-\steppingy)}
\filldraw[cuboid/front] (\lowx,\lowy,\dimz) -- (\lowx,\y,\dimz) -- (\x,\y,\dimz) -- (\x,\lowy,\dimz) -- cycle;
}
}
\foreach \x in {\steppingx,\secondx,...,\dimx}
{ \foreach \z in {\steppingz,\secondz,...,\dimz}
{ \pgfmathsetmacro{\lowx}{(\x-\steppingx)}
\pgfmathsetmacro{\lowz}{(\z-\steppingz)}
\filldraw[cuboid/top] (\lowx,\dimy,\lowz) -- (\lowx,\dimy,\z) -- (\x,\dimy,\z) -- (\x,\dimy,\lowz) -- cycle;
}
}
\foreach \y in {\steppingy,\secondy,...,\dimy}
{ \foreach \z in {\steppingz,\secondz,...,\dimz}
{ \pgfmathsetmacro{\lowy}{(\y-\steppingy)}
\pgfmathsetmacro{\lowz}{(\z-\steppingz)}
\filldraw[cuboid/right] (\dimx,\lowy,\lowz) -- (\dimx,\lowy,\z) -- (\dimx,\y,\z) -- (\dimx,\y,\lowz) -- cycle;
}
}
\ifcuboidemphedge
\draw[cuboid/emph style] (0,\dimy,0) -- (\dimx,\dimy,0) -- (\dimx,\dimy,\dimz) -- (0,\dimy,\dimz) -- cycle;%
\draw[cuboid/emph style] (0,\dimy,\dimz) -- (0,0,\dimz) -- (\dimx,0,\dimz) -- (\dimx,\dimy,\dimz);%
\draw[cuboid/emph style] (\dimx,\dimy,0) -- (\dimx,0,0) -- (\dimx,0,\dimz);%
\fi
\end{scope}
}
\makeatother
\begin{document}
\begin{tikzpicture}
\tikzcuboid{shift x=0cm,%
shift y=0cm,%
scale=1.00,%
rotation=30,%
density x=1,%
density y=2,%
density z=3,%
dim x=4,%
dim y=5,%
dim z=2,%
front/.style={draw=yellow!30!black,fill=yellow!30!white},%
top/.style={draw=red!30!black,fill=red!30!white},%
right/.style={draw=blue!30!black,fill=blue!30!white}%
}
\tikzcuboid{%
shift x=0cm,%
shift y=8cm,%
scale=1.00,%
rotation=60,%
density x=3,%
density y=2,%
density z=5,%
dim x=4,%
dim y=4,%
dim z=4,%
front/.style={draw=orange!75!black,fill=orange!75!white},%
top/.style={draw=green!75!black,fill=green!75!white},%
right/.style={draw=violet!75!black,fill=violet!75!white}%
}
\tikzcuboid{%
shift x=8cm,%
shift y=8cm,%
scale=1.00,%
rotation=45,%
density x=1,%
density y=(2/3),%
density z=2,%
dim x=3,%
dim y=3,%
dim y=3,%
front/.style={draw=white!15!black,fill=black!15!white},%
top/.style={draw=white!30!black,fill=black!30!white},%
right/.style={draw=white!45!black,fill=black!45!white}%
}
\tikzcuboid{%
shift x=8cm,%
shift y=0cm,%
scale=1.00,%
rotation=75,%
density x=2,%
density y=3,%
density z=2,%
dim x=6,%
dim y=8,%
dim z=1,%
front/.style={draw=red!75!black,fill=red!25!white},%
top/.style={draw=red!50!black,fill=red!50!white},%
right/.style={draw=red!25!black,fill=red!75!white}%
}
\tikzcuboid{%
shift x=16cm,%
shift y=8cm,%
scale=1.00,%
rotation=0,%
density x=2,%
density y=2,%
density z=2,%
dim x=4,%
dim y=4,%
dim y=4,%
front/.style={draw=green!75!black,fill=green!25!white},%
top/.style={draw=green!50!black,fill=green!50!white},%
right/.style={draw=green!25!black,fill=green!75!white},%
emph edge,%
emph style/.style={very thick},
}
\tikzcuboid{%
shift x=16cm,%
shift y=0cm,%
scale=1.00,%
rotation=0,%
density x=1,%
density y=1,%
density z=1,%
dim x=4,%
dim y=4,%
dim z=4,%
front/.style={draw=blue!75!black,fill=blue!25!white},%
right/.style={draw=blue!25!black,fill=blue!75!white},%
top/.style={draw=blue!50!black,fill=blue!50!white},%
angle x=15,%
angle y=135,%
angle z=225,%
scale x=1,%
scale y=1,%
scale z=1,%
emph edge=false,%
}
\end{tikzpicture}
\end{document}
keyvaland notpgfkeys? Having two different key/value packages used together just causes troubles. You don't provide a MWE so I can't test anything, but when wrapping the comma separated list in{ }doesn't protect the commas try two sets of braces, e.g.emphstyle={{very thick, red, dashed}}. One might be already removed bykeyval. – Martin Scharrer Oct 04 '11 at 12:31keyvalas I had an old.texfile where I used it and thus had a starting point. To be honest, I didn't knowpgfkeysexisted. – Tom Bombadil Oct 04 '11 at 13:06emphstyle={very thick, red, dashed}doesn't work the problem is somewhere in the definition/processing/code of the emphstyle-key. – Ulrike Fischer Oct 04 '11 at 13:23pgfkeysbutxkeyvalis a solution because during a period, in the sources ofTikz,xkeyvalandpgfkeysworked together. Now I'm not sure Ifxkeyvalis not faster thanpgfkeys. – Alain Matthes Oct 04 '11 at 14:48xkeyvalmight be faster aspgfkeysbut IMHO it would be weird to not usepgfkeysfor something TikZ related. – Martin Scharrer Oct 04 '11 at 18:10pgfkeysbut do not forget two arguments: the first is that many packages use xkeyval and the second is that early versions of Tikz too. Some users have become accustomed to usexkeyvalto create their own packages. It's not easy to learnpgfkeys. – Alain Matthes Oct 04 '11 at 20:40