%!TEX pdflatex

\documentclass[a4paper]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{pgf,pgffor}
\usepackage{simplekv}
\usepackage{listofitems}
\usepackage{siunitx}
\sisetup{locale=FR}

\begin{document}

\defKV[paramscube]{%
	longueur=\xdef\PFCubeLg{#1},%
	angle=\xdef\PFCubeAngl{#1},%
	fuite=\xdef\PFCubeFuite{#1},%
	sommets=\def\PFCubeSommets{#1},%
	epaisseur=\xdef\PFCubeThick{#1}
	
}
\setKVdefault[paramscube]{%
	aff=false,%
	plein=false,%
	longueur=1,%
	angle=30,%
	fuite=0.5,%
	epaisseur=thick,%
	sommets=A§B§C§D§E§F§G§H
}

\newcommand\cubePL[1][]{%
	\useKVdefault[paramscube]%
	\setKV[paramscube]{#1}%
	\setsepchar{§}%
	\readlist\PFListeSommets\PFCubeSommets
	\itemtomacro\PFListeSommets[1]\CubeA
	\itemtomacro\PFListeSommets[2]\CubeB
	\itemtomacro\PFListeSommets[3]\CubeC
	\itemtomacro\PFListeSommets[4]\CubeD
	\itemtomacro\PFListeSommets[5]\CubeE
	\itemtomacro\PFListeSommets[6]\CubeF
	\itemtomacro\PFListeSommets[7]\CubeG
	\itemtomacro\PFListeSommets[8]\CubeH
	%les nœuds du cube
	\coordinate (\CubeA) at (0,0) ;
	\coordinate (\CubeB) at ({\PFCubeLg},0) ;
	\coordinate (\CubeC) at ($(\CubeB) + ({\PFCubeAngl}:{\PFCubeFuite*\PFCubeLg})$) ;
	\coordinate (\CubeD) at ($(\CubeA) + ({\PFCubeAngl}:{\PFCubeFuite*\PFCubeLg})$) ;
	\coordinate (\CubeE) at ($(\CubeA) + (0,{\PFCubeLg})$) ;
	\coordinate (\CubeF) at ($(\CubeB) + (0,{\PFCubeLg})$) ;
	\coordinate (\CubeG) at ($(\CubeC) + (0,{\PFCubeLg})$) ;
	\coordinate (\CubeH) at ($(\CubeD) + (0,{\PFCubeLg})$) ;
	\ifboolKV[paramscube]{aff}
	{\draw (\CubeA) node[below left] {\CubeA} ;
		\draw (\CubeB) node[below right] {\CubeB} ;
		\draw (\CubeC) node[above right] {\CubeC} ;
		\ifboolKV[paramscube]{plein}
			{}
			{\draw (\CubeD) node[above left] {\CubeD} ;}
		\draw (\CubeE) node[below left] {\CubeE} ;
		\draw (\CubeF) node[below right] {\CubeF} ;
		\draw (\CubeG) node[above right] {\CubeG} ;
		\draw (\CubeH) node[above left] {\CubeH} ;}
	{}%on affiche rien
	\draw[\PFCubeThick] (\CubeA)--(\CubeB)--(\CubeF)--(\CubeE)--cycle
	                    (\CubeB)--(\CubeC)--(\CubeG)--(\CubeF)--cycle
	                    (\CubeG)--(\CubeH)--(\CubeE) ;
	\ifboolKV[paramscube]{plein}
		{}
		{\draw[dashed,\PFCubeThick] (\CubeA)--(\CubeD)--(\CubeC)
	                                (\CubeD)--(\CubeH) ;}
}

\defKV[paramspave]{%
	largeur=\xdef\PFPaveLg{#1},%
	profondeur=\xdef\PFPavePf{#1},%
	hauteur=\xdef\PFPaveHt{#1},%
	angle=\xdef\PFPaveAngl{#1},%
	fuite=\xdef\PFPaveFuite{#1},%
	sommets=\def\PFPaveSommets{#1},%
	epaisseur=\xdef\PFPaveThick{#1}
	
}
\setKVdefault[paramspave]{%
	aff=false,%
	plein=false,%
	largeur=2,%
	profondeur=1,%
	hauteur=1.25,%
	angle=30,%
	fuite=0.5,%
	epaisseur=thick,%
	sommets=A§B§C§D§E§F§G§H,%
	cube=false
}

\newcommand\pavePL[1][]{%
	\useKVdefault[paramspave]%
	\setKV[paramspave]{#1}%
	\ifboolKV[paramspave]{cube}
		{\xdef\PFPavePf{\PFPaveLg}%
		\xdef\PFPaveHt{\PFPaveLg}}
		{}
	\setsepchar{§}%
	\readlist\PFListeSommets\PFPaveSommets
	\itemtomacro\PFListeSommets[1]\PaveA
	\itemtomacro\PFListeSommets[2]\PaveB
	\itemtomacro\PFListeSommets[3]\PaveC
	\itemtomacro\PFListeSommets[4]\PaveD
	\itemtomacro\PFListeSommets[5]\PaveE
	\itemtomacro\PFListeSommets[6]\PaveF
	\itemtomacro\PFListeSommets[7]\PaveG
	\itemtomacro\PFListeSommets[8]\PaveH
	%les nœuds du pave
	\coordinate (\PaveA) at (0,0) ;
	\coordinate (\PaveB) at ({\PFPaveLg},0) ;
	\coordinate (\PaveC) at ($(\PaveB) + ({\PFPaveAngl}:{\PFPaveFuite*\PFPavePf})$) ;
	\coordinate (\PaveD) at ($(\PaveA) + ({\PFPaveAngl}:{\PFPaveFuite*\PFPavePf})$) ;
	\coordinate (\PaveE) at ($(\PaveA) + (0,{\PFPaveHt})$) ;
	\coordinate (\PaveF) at ($(\PaveB) + (0,{\PFPaveHt})$) ;
	\coordinate (\PaveG) at ($(\PaveC) + (0,{\PFPaveHt})$) ;
	\coordinate (\PaveH) at ($(\PaveD) + (0,{\PFPaveHt})$) ;
	\ifboolKV[paramspave]{aff}
	{\draw (\PaveA) node[below left] {\PaveA} ;
		\draw (\PaveB) node[below right] {\PaveB} ;
		\draw (\PaveC) node[above right] {\PaveC} ;
		\ifboolKV[paramspave]{plein}
		{}
		{\draw (\PaveD) node[above left] {\PaveD} ;}
		\draw (\PaveE) node[below left] {\PaveE} ;
		\draw (\PaveF) node[below right] {\PaveF} ;
		\draw (\PaveG) node[above right] {\PaveG} ;
		\draw (\PaveH) node[above left] {\PaveH} ;}
	{}%on affiche rien
	\draw[\PFPaveThick] (\PaveA)--(\PaveB)--(\PaveF)--(\PaveE)--cycle
	(\PaveB)--(\PaveC)--(\PaveG)--(\PaveF)--cycle
	(\PaveG)--(\PaveH)--(\PaveE) ;
	\ifboolKV[paramspave]{plein}
	{}
	{\draw[dashed,\PFPaveThick] (\PaveA)--(\PaveD)--(\PaveC)
		(\PaveD)--(\PaveH) ;}
}

\verb|\begin{tikzpicture}[line join=bevel]|
	
	\verb|    \cubePL|

\verb|\end{tikzpicture}|

\medskip

\begin{tikzpicture}[line join=bevel]
	\cubePL
\end{tikzpicture}

\medskip

\hrule

\medskip

\verb|\begin{tikzpicture}[line join=bevel]|

\verb|    \cubePL[longueur=4,sommets={C§D§E§F§H§G§I§J},aff=true]|

\verb|\end{tikzpicture}|

\medskip

\begin{tikzpicture}[line join=bevel]
	\cubePL[longueur=4,sommets={C§D§E§F§H§G§I§J},aff=true]
\end{tikzpicture}

\medskip

\hrule

\medskip

\verb|\cubePL[longueur=4,sommets={C§D§E§F§H§G§I§J}]|

\medskip

\begin{tikzpicture}[line join=bevel]
	\cubePL[longueur=4,sommets={C§D§E§F§H§G§I§J}]
\end{tikzpicture}

\medskip

\hrule

\medskip

\verb|\cubePL[longueur=5,aff=true,epaisseur={very thick},angle=45,fuite=0.717]|

\medskip

\begin{tikzpicture}[line join=bevel]
	\cubePL[longueur=5,aff=true,epaisseur={very thick},angle=45,fuite=0.717]
\end{tikzpicture}

\pagebreak

\hrule

\medskip

\verb|\cubePL[longueur=3,aff=true,plein=true]|

\medskip

\begin{tikzpicture}[line join=bevel]
	\cubePL[longueur=3,aff=true,plein=true]
\end{tikzpicture}

\medskip

\hrule

\medskip

\verb|\cubePL[longueur=3,plein=true]|

\medskip

\begin{tikzpicture}[line join=bevel]
	\cubePL[longueur=3,plein=true]
\end{tikzpicture}

\medskip

\hrule

\medskip

\verb|\pavePL|

\medskip

\begin{tikzpicture}[line join=bevel]
	\pavePL
\end{tikzpicture}

\medskip

\hrule

\medskip

\verb|\pavePL[aff=true,largeur=4,profondeur=2,hauteur=3]|

\medskip

\begin{tikzpicture}[line join=bevel]
	\pavePL[aff=true,largeur=4,profondeur=2,hauteur=3]
\end{tikzpicture}

\medskip

\hrule

\medskip

\verb|\pavePL[plein=true,aff=true,largeur=4,profondeur=2,hauteur=3,fuite=0.62]|

\medskip

\begin{tikzpicture}[line join=bevel]
	\pavePL[plein=true,aff=true,largeur=4,profondeur=2,hauteur=3,fuite=0.62]
\end{tikzpicture}

\pagebreak

\hrule

\medskip

\verb|\pavePL[aff=true,largeur=4,cube=true]|

\medskip

\begin{tikzpicture}[line join=bevel]
	\pavePL[aff=true,largeur=4,cube=true]
\end{tikzpicture}

\end{document}