\documentclass{article}
\usepackage{pst-solides3d,pst-node,multido}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}

\makeatletter
\def\psPoint{\def\pst@par{}\pst@object{psPoint}}
\def\psPoint@i(#1)#2{{% coordonnées cartésiennes
  \begin@ClosedObj
\pnode(!
    \tx@optionssolides
    SolidesDict begin
    #1
   3dto2d cm_1 exch cm_1 exch
   end){#2}%
   \end@ClosedObj
  }\ignorespaces%
}
\makeatother
\def\grille{% quadrillage du plan Oxy
\multido{\ix=-6+1}{13}{%
    \psPoint(\ix\space -6 0){A}
    \psPoint(\ix\space 6 0){B}
    \psline(A)(B)}
\multido{\iy=-6+1}{13}{%
    \psPoint(-6 \iy\space 0){A}
    \psPoint(6 \iy\space 0){B}
    \psline(A)(B)}
    \psPoint(0 0 0){O}
    \psPoint(6 0 0){X}
    \psPoint(0 6 0){Y}
    \psPoint(0 0 6){Z}
    \psline[arrowsize=0.3,arrowinset=0.2,linecolor=blue]{->}(O)(X)
    \psline[arrowsize=0.3,arrowinset=0.2,linecolor=blue]{->}(O)(Y)
    \psline[arrowsize=0.3,arrowinset=0.2,linecolor=blue]{->}(O)(Z)
    \uput[r](X){\textcolor{blue}{$x$}}\uput[u](Y){\textcolor{blue}{$y$}}%
    \uput[r](Z){\textcolor{blue}{$z$}}\uput[u](O){\textcolor{blue}{$O$}}}
\pagestyle{empty}
\date{14 octobre 2\,006}
\author{JPV \& ML}
\title{tests grille et parallélépipède}

\begin{document}
\maketitle

\begin{center}
\psset{SphericalCoor=true,viewpoint=50 20 20,Decran=50}
\begin{pspicture}(-6,-3)(6,6)
%\psframe(-6,-2)(6,6)
\grille
\psSolid[object=parallelepiped,a=8,b=8,c=1,color=yellow,lightsrc=1e3 5 20](0,0,c 2 div)
\psSolid[object=grille,base=-4 4 -4 4,action=draw](0,0,1)
\psSolid[object=grille,base=-4 4 -4 4,action=draw](0,0,4)
%\psSolid[object=grille,base=-0.5 0.5 -4 4,RotY=90,action=draw,linecolor=red](4,0,0.5)
\psSolid[object=grille,base=-2 2 -4 4,RotY=90,action=draw](4,0,2)
%\psSolid[object=grille,base=-4 4 -0.5 0.5,RotX=-90,action=draw](0,4,0.5)
\psSolid[object=grille,base=-4 4 -2 2,RotX=-90,action=draw](0,4,2)
\psSolid[object=cube,color=red,a=1,lightsrc=1e3 5 20](3.5,3.5,0.5)
\psSolid[object=parallelepiped,a=8,b=8,c=4,action=draw](0,0,c 2 div)
\psPoint(0 0 1){Z'}
\psline[arrowsize=0.3,arrowinset=0.2,linecolor=blue]{->}(Z')(Z)
\end{pspicture}
\end{center}
\begin{verbatim}
\psSolid[object=parallelepiped,a=8,b=8,c=1,color=yellow,lightsrc=1e3 5 20](0,0,c 2 div)
\psSolid[object=grille,base=-4 4 -4 4](0,0,1)
\psSolid[object=grille,base=-4 4 -4 4,action=draw](0,0,4)
\psSolid[object=grille,base=-2 2 -4 4,RotY=90,action=draw,linecolor=red](4,0,2)
\psSolid[object=grille,base=-4 4 -2 2,RotX=-90,action=draw,linecolor=red](0,4,2)
\psSolid[object=cube,color=red,a=1,lightsrc=1e3 5 20](3.5,3.5,0.5)
\psSolid[object=parallelepiped,a=8,b=8,c=4,action=draw](0,0,c 2 div)
\end{verbatim}
\begin{center}
\psset{lightsrc=1e3 5 20,SphericalCoor=true,viewpoint=50 20 10,Decran=50}
\begin{pspicture}(-6,-2)(6,6)
\psframe(-6,-2)(6,6)
\psSolid[object=cube,ngrid=4,a=4,color=cyan,grid=true](0,0,2)
\end{pspicture}
\end{center}

\begin{center}
\psset{lightsrc=1e3 5 20,SphericalCoor=true,viewpoint=50 20 10,Decran=50}
\begin{pspicture}(-6,-2)(6,6)
%\psframe(-6,-2)(6,6)
\grille
\psSolid[object=parallelepiped,a=1,b=1,c=2,color=cyan](0,0,c 2 div)
\psPoint(0 0 2){Z'}
\psline[arrowsize=0.3,arrowinset=0.2,linecolor=blue]{->}(Z')(Z)
\end{pspicture}
\end{center}
\end{document}
