Is it possible to position an anchor based on the value of a PGF key at the time the node is created? Here is one of my many attempts at getting this to work (all of which have been unsuccessful):
\documentclass{article} \usepackage{tikz} \newif\ifmarkisinside \pgfkeys{% /pgf/port 1 inside/.is if=markisinside, /pgf/port 1 inside/.initial=true, /pgf/port 1 inside/.default=true, } \pgfdeclareshape{mycircle}{% \nodeparts{text}% \inheritsavedanchors[from=circle] \inheritanchor[from=circle]{text}% \inheritanchor[from=circle]{center}% \inheritbackgroundpath[from=circle]% \savedmacro\portoneinside{% \pgfkeysgetvalue{/pgf/port 1 inside}{\portoneinside} }% \anchor{port 1}{% \pgfmathparse{ifthenelse(\portoneinside,0.5,1.5)} \let\portsep\pgfmathresult \pgfpointadd{\centerpoint}{\pgfpoint{\portsep*\radius}{0pt}}% }% %% Also does not work to do this: % \anchor{port 1}{% % \ifmarkisinside % \pgfpointadd{\centerpoint}{\pgfpoint{0.5*\radius}{0pt}}% % \else % \pgfpointadd{\centerpoint}{\pgfpoint{1.5*\radius}{0pt}}% % \fi % }% } \begin{document} \begin{tikzpicture} \node [draw,mycircle,minimum size=2cm] (c1) at (0,0) {}; \fill (c1.port 1) circle(0.05); \node [draw,mycircle,minimum size=2cm,port 1 inside=false] (c2) at (4,0) {}; \fill (c2.port 1) circle(0.05); \end{tikzpicture} \end{document} The desired outcome is that the left-hand dot is inside the circle, but the right-hand dot is outside it. 
I have tried using \ifmarkisinside in the anchor declaration, and I have tried making port 1 a deferred anchor, too, but that does not work either.


pgfkeysworks. the value of your key is alwaystrue. try just\pgfkeys{/pgf/port 1 inside=false} \pgfkeysgetvalue{/pgf/port 1 inside}\tempa\tempawithout any node or picture.\ifmarkisinside [do stuff] \else [do other stuff] \fidoes work ordinarily, just not as an anchor definition. I edited the original post to include the failed code.\savedmacroare not available inside another\savedmacrodefinition, but the PGF keys' current values are available there. Conversely, the PGF key values are not available inside\anchordefinitions, but\savedmacros are! So I can create a saved anchor (or macro, in the MWE here) that sets a multiplier, then use\radiusinside the\anchordefinition and do the multiplication there.