I want to make a new shape from rectangle, which has only its top and bottom line drawn, but which can be filled. The answer, thank's to Andrew Stacy and percusse look by now as follows:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[twoside,reqno,12pt]{amsart}
\usepackage{a4wide} %% uncomment if a4wide is not installed
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% T i k Z
%% -- packages
%% -- macros & shapes
\usepackage{tikz}
\usetikzlibrary{arrows,backgrounds}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{decorations.markings}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% new shape : iso
%%
\makeatletter
\newif\ifpullback
\pgfkeys{/tikz/pullback/.is if=pullback}
\pgfkeys{/tikz/pullback=false}
\pgfdeclareshape{iso}{%
%
\inheritsavedanchors[from=rectangle]
\inheritanchorborder[from=rectangle]
\inheritanchor[from=rectangle]{north}
\inheritanchor[from=rectangle]{north west}
\inheritanchor[from=rectangle]{north east}
\inheritanchor[from=rectangle]{center}
\inheritanchor[from=rectangle]{west}
\inheritanchor[from=rectangle]{east}
\inheritanchor[from=rectangle]{mid}
\inheritanchor[from=rectangle]{mid west}
\inheritanchor[from=rectangle]{mid east}
\inheritanchor[from=rectangle]{base}
\inheritanchor[from=rectangle]{base west}
\inheritanchor[from=rectangle]{base east}
\inheritanchor[from=rectangle]{south}
\inheritanchor[from=rectangle]{south west}
\inheritanchor[from=rectangle]{south east}
%
\savedanchor\centerpoint
{
\pgf@x=0pt
\pgf@y=0pt
}
\anchor{text}{%
\pgf@x=0pt
% adjust vertical positioning
\pgf@y=0pt
\advance\pgf@y by -0.2\ht\pgfnodeparttextbox
}
%
\backgroundpath{%
\northeast \pgf@xa=\pgf@x \pgf@ya=\pgf@y
\southwest \pgf@xb=\pgf@x \pgf@yb=\pgf@y
\begingroup
\tikz@mode
\iftikz@mode@draw
% -- draw top and bottom line
\pgfpathmoveto\northeast
\pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
\pgfpathmoveto\southwest
\pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
\pgfusepath{stroke}
\fi
\iftikz@mode@fill
% -- fill rectangle if demanded
\pgfsetlinewidth{\pgflinewidth}
\advance\pgf@ya by -0.5\pgflinewidth%
\advance\pgf@yb by 0.5\pgflinewidth%
\pgfpathrectanglecorners{\pgfqpoint{\pgf@xb}{\pgf@yb}}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
\pgfusepath{fill}
\fi
\ifpullback
% -- if option pullback is given draw hook
\northeast \pgf@xa=\pgf@x \pgf@ya=\pgf@y
\southwest \pgf@xb=\pgf@x \pgf@yb=\pgf@y
\pgf@xc=\pgf@xb
\advance\pgf@xc by 3\pgflinewidth
\pgf@yc=\pgf@ya
\advance\pgf@yc by -2\pgflinewidth
\pgfpathmoveto{\pgfqpoint{\pgf@xc}{\pgf@ya}}
\pgfpathlineto{\pgfqpoint{\pgf@xc}{\pgf@yc}}
\pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yc}}
\pgfusepath{stroke}
\fi
\endgroup
}
}
\makeatother
\begin{document}
\begin{tikzpicture}
\draw (0,-2) grid (6,3);
\node[fill=blue!20,line width=2pt,iso,draw,minimum width=2.5cm,inner ysep=0pt] at (2,2){$=$};
\node[fill=green!20,pullback,line width=1.25pt,iso,draw,minimum width=2.5cm,inner ysep=0pt] at (2,1){$=$};
\end{tikzpicture}
\end{document}
This solution also takes care of the fact that the rectangle used to fill the
box overrides part of the top and bottom lines, halving their width. Hence
before drawing the filler rectangle, the northeast and southwest y-coordinates are altered by half \pgflinewidth. On option pullback
is added which draws a small hock in the top left corner. [This shape is meant to depict a iso-2-cell in 2-tangles for 2-categories].