Seven segment display with TikZ

A PSTricks solution only for fun purposes. I am really sorry if my algorithm is not so smart, but at least I can save more keystrokes.

Version B

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node}
\newif\ifa\newif\ifb\newif\ifc\newif\ifd\newif\ife\newif\iff\newif\ifg
\def\seg#1{%
    \atrue\btrue\ctrue\dtrue\etrue\ftrue\gtrue
    \ifcase#1
        \gfalse%0
    \or
        \afalse\bfalse\cfalse\dfalse\gfalse%1
    \or
        \bfalse\efalse%2
    \or
        \bfalse\cfalse%3
    \or
        \afalse\cfalse\dfalse%4
    \or 
        \cfalse\ffalse%5
    \or
        \ffalse%6
    \or
        \bfalse\cfalse\dfalse\gfalse%7
    \or
        %8
    \or
        \cfalse%9
    \fi
    \begin{pspicture}[nodesep=12pt,linewidth=12pt,linecap=1,linecolor=red](3,6)
        \pnodes{s}(0,0)(3,0)(3,3)(3,6)(0,6)(0,3)
        \ifa\pcline(s3)(s4)\fi
        \ifb\pcline(s4)(s5)\fi
        \ifc\pcline(s5)(s0)\fi
        \ifd\pcline(s0)(s1)\fi
        \ife\pcline(s1)(s2)\fi
        \iff\pcline(s2)(s3)\fi
        \ifg\pcline(s2)(s5)\fi
    \end{pspicture}}
\begin{document}
\foreach\i in {0,1,...,9}{\seg{\i}}
\end{document}

enter image description here

Version A

A more compact solution.

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node}

\def\o#1#2#3{\expandafter\unless\csname if#1\endcsname\pcline(s#2)(s#3)\fi}
\newif\ifa\newif\ifb\newif\ifc\newif\ifd\newif\ife\newif\iff\newif\ifg

\def\p#1{%
    \ifcase#1
        \gtrue%0
    \or
        \atrue\btrue\ctrue\dtrue\gtrue%1
    \or
        \btrue\etrue%2
    \or
        \btrue\ctrue%3
    \or
        \atrue\ctrue\dtrue%4
    \or 
        \ctrue\ftrue%5
    \or
        \ftrue%6
    \or
        \btrue\ctrue\dtrue\gtrue%7
    \or
        %8
    \or
        \ctrue%9
    \fi
    \begin{pspicture}[nodesep=12pt,linewidth=12pt,linecap=1,linecolor=red](3,6)
        \pnodes{s}(0,0)(3,0)(3,3)(3,6)(0,6)(0,3)
        \o{a}{3}{4}
        \o{b}{4}{5}
        \o{c}{5}{0}
        \o{d}{0}{1}
        \o{e}{1}{2}
        \o{f}{2}{3}
        \o{g}{2}{5}
    \end{pspicture}}
\begin{document}
\foreach\i in {0,1,...,9}{\p\i}
\end{document}

Most likely I do not understand your question. But I'd like to argue that one should first check if the argument is a number (I only check if it is an a but this could be extended) and then use \ifcase for the integer cases.

\documentclass[border=5pt,tikz]{standalone}
\usepackage{ifthen}
\newcommand{\binary}[3]{
    \pgfmathtruncatemacro\number{int(#1*2^0+#2*2^1+#3*2^2)}
}
\newcommand{\sieben}[1]{
    \draw[gray,opacity=.3,line width=3pt] (0,0) --+ (0,.5);
    \draw[gray,opacity=.3,line width=3pt] (0,.6) --+ (0,.5);
    \draw[xshift=.7cm,gray,opacity=.3,line width=3pt] (0,0) --+ (0,.5);
    \draw[xshift=.7cm,gray,opacity=.3,line width=3pt] (0,.6) --+ (0,.5);
    \draw[gray,opacity=.3,line width=3pt] (.1,1.18) --+ (.5,0);
    \draw[gray,opacity=.3,line width=3pt] (.1,-.05) --+ (.5,0);
    \draw[gray,opacity=.3,line width=3pt] (.1,.55) --+ (.5,0);
    \ifthenelse{\equal{#1}{a}}{%\typeout{a}
       \draw[red,line width=3pt] (0,0) --+ (0,.5);
       \draw[red,line width=3pt] (0,.6) --+ (0,.5);
       \draw[red,line width=3pt] (.1,1.18) --+ (.5,0);
       \draw[red,line width=3pt] (.1,-.05) --+ (.5,0);
       \draw[red,line width=3pt] (.1,.55) --+ (.5,0);
    }{%
      \ifcase#1
          \draw[red,line width=3pt] (0,0) --+ (0,.5);
          \draw[red,line width=3pt] (0,.6) --+ (0,.5);
          \draw[xshift=.7cm,red,line width=3pt] (0,0) --+ (0,.5);
          \draw[xshift=.7cm,red,line width=3pt] (0,.6) --+ (0,.5);
          \draw[red,line width=3pt] (.1,1.18) --+ (.5,0);
          \draw[red,line width=3pt] (.1,-.05) --+ (.5,0);
      \or
          \draw[xshift=.7cm,red,line width=3pt] (0,0) --+ (0,.5);
          \draw[xshift=.7cm,red,line width=3pt] (0,.6) --+ (0,.5);
      \or
          \draw[red,line width=3pt] (.1,1.18) --+ (.5,0);;
          \draw[xshift=.7cm,red,line width=3pt] (0,.6) --+ (0,.5);
          \draw[red,line width=3pt] (.1,.55) --+ (.5,0);
          \draw[red,line width=3pt] (0,0) --+ (0,.5);
          \draw[red,line width=3pt] (.1,-.05) --+ (.5,0);
      \or
          \draw[xshift=.7cm,red,line width=3pt] (0,0) --+ (0,.5);
          \draw[xshift=.7cm,red,line width=3pt] (0,.6) --+ (0,.5);
          \draw[red,line width=3pt] (.1,1.18) --+ (.5,0);
          \draw[red,line width=3pt] (.1,-.05) --+ (.5,0);
          \draw[red,line width=3pt] (.1,.55) --+ (.5,0);
      \or
          \draw[red,line width=3pt] (0,.6) --+ (0,.5);
          \draw[xshift=.7cm,red,line width=3pt] (0,0) --+ (0,.5);
          \draw[xshift=.7cm,red,line width=3pt] (0,.6) --+ (0,.5);
          \draw[red,line width=3pt] (.1,.55) --+ (.5,0);
      \or
          \draw[red,line width=3pt] (0,.6) --+ (0,.5);
          \draw[xshift=.7cm,red,line width=3pt] (0,0) --+ (0,.5);
          \draw[red,line width=3pt] (.1,1.18) --+ (.5,0);
          \draw[red,line width=3pt] (.1,.55) --+ (.5,0);
          \draw[red,line width=3pt] (.1,-.05) --+ (.5,0);
      \or
          \draw[red,line width=3pt] (0,0) --+ (0,.5);
          \draw[red,line width=3pt] (0,.6) --+ (0,.5);
          \draw[xshift=.7cm,red,line width=3pt] (0,0) --+ (0,.5);
          \draw[red,line width=3pt] (.1,1.18) --+ (.5,0);
          \draw[red,line width=3pt] (.1,-.05) --+ (.5,0);
          \draw[red,line width=3pt] (.1,.55) --+ (.5,0);
      \or
          \draw[xshift=.7cm,red,line width=3pt] (0,0) --+ (0,.5);
          \draw[xshift=.7cm,red,line width=3pt] (0,.6) --+ (0,.5);
          \draw[red,line width=3pt] (.1,1.18) --+ (.5,0);
      \or
          \draw[red,line width=3pt] (0,0) --+ (0,.5);
          \draw[red,line width=3pt] (0,.6) --+ (0,.5);
          \draw[xshift=.7cm,red,line width=3pt] (0,0) --+ (0,.5);
          \draw[xshift=.7cm,red,line width=3pt] (0,.6) --+ (0,.5);
          \draw[red,line width=3pt] (.1,1.18) --+ (.5,0);
          \draw[red,line width=3pt] (.1,-.05) --+ (.5,0);
          \draw[red,line width=3pt] (.1,.55) --+ (.5,0);
      \or
          \draw[red,line width=3pt] (0,.6) --+ (0,.5);
          \draw[xshift=.7cm,red,line width=3pt] (0,0) --+ (0,.5);
          \draw[xshift=.7cm,red,line width=3pt] (0,.6) --+ (0,.5);
          \draw[red,line width=3pt] (.1,1.18) --+ (.5,0);
          \draw[red,line width=3pt] (.1,-.05) --+ (.5,0);
          \draw[red,line width=3pt] (.1,.55) --+ (.5,0);
      \or
          \draw[red,line width=3pt] (0,0) --+ (0,.5);
          \draw[red,line width=3pt] (0,.6) --+ (0,.5);
          \draw[xshift=.7cm,red,line width=3pt] (0,0) --+ (0,.5);
          \draw[xshift=.7cm,red,line width=3pt] (0,.6) --+ (0,.5);
          \draw[red,line width=3pt] (.1,1.18) --+ (.5,0);
          \draw[red,line width=3pt] (.1,.55) --+ (.5,0);
      \or   
    \fi}}
\begin{document}
    \begin{tikzpicture}[xslant=0]
        \sieben{a}
        \begin{scope}[xshift=1.5cm]
            \binary{1}{1}{1} % seven in dual system
            \sieben{\number}
        \end{scope}
    \end{tikzpicture}
\end{document}

enter image description here