I am trying to define some shapes for TikZ using \pgfdeclareshape. I would like to use options to make their size adjustable, however I do not get it to work. This example compiles, but the size of the circle is not set properly (or at all). What am I doing wrong :?
\documentclass[oneside,12pt]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{shapes}
\makeatletter
\pgfkeys{/tikz/mycirclesize/.code={\pgf@x = #1}}
\pgfkeys{/tikz/mycirclesize/.default = 0.75cm}
\pgfkeysgetvalue{/tikz/mycirclesize}{\macro}
\pgfdeclareshape{mycircle}
{
\savedanchor\centerpoint{
\pgf@x = .5\wd\pgfnodeparttextbox
\pgf@y = .5\ht\pgfnodeparttextbox
}
\anchor{center}{\centerpoint}
\saveddimen\circsize{ \macro }
\backgroundpath{
\centerpoint
\pgfkeys{/pgf/minimum size = \circsize}
\pgfset{inner sep=1pt}
\pgfnode{circle}{center}{}{}{\pgfusepath{draw}}
}
}
\makeatother
\begin{document}
\begin{tikzpicture}
\draw (0,0) node[mycircle, mycirclesize=2cm] {};
\end{tikzpicture}
\end{document}