# Intersecting boxes in pst-solides3d

I need to make a picture of some 3D boxes (i.e., parallelepipeds) that intersect themselves in some complicated ways, so I tried pst-solides3d.

Here's the minimal working example: A long and thin blue box should pierce a flat yellow box at its center.

\documentclass{standalone}
\usepackage{pstricks,pst-solides3d}
\begin{document}
\begin{pspicture}(-5,-5)(5,5)
\psset{viewpoint=20 25 15,Decran=50,solidmemory}
\axesIIID(0,0,0)(2,2,2)
\psSolid[name=longbox,
object=parallelepiped,
a=3,b=.2,c=.2,
fillcolor=blue](.5,.5,.5)
\psSolid[
name=flatbox,
object=parallelepiped,
a=.25,b=2,c=2,
fillcolor=yellow](.5,.5,.5)
\psSolid[object=fusion,
action=draw,
base=flatbox longbox]
(0,0,0)
\composeSolid
\end{pspicture}
\end{document}


The output is very strange: A piece of the thin box became yellow. It seems that the package is unable to determine which pieces of surfaces are in front.

With the option action=draw**, the result is even worse:

Am I doing something wrong?

You need more than the six polygon shapes of the blue cube to draw hidden surfaces. And, of course, all objects must be calculated with action=none except of the last one:

\documentclass{standalone}
\usepackage{pst-solides3d}
\begin{document}
\begin{pspicture}(-3,-2)(3,3)
\psset{viewpoint=20 25 15,Decran=50,solidmemory,action=none}
\axesIIID(0,0,0)(2,2,2)
\multido{\rA=0.0+0.3,\iA=0+1}{11}{%
\psSolid[name=l\iA, object=parallelepiped,a=0.3,b=.2,c=.2,