vendredi 5 décembre 2014

Can coordinates declared inside "append after command+\pgfextra" command be used afterwards?


I would like to add some lines to certain nodes but being declared within node options and I thought using append after command and \pgfextra...\endpgfextra. But new coordinate nodes declared inside this new path are not know outside. What can I do to use them?


Just a little example to show the problem. In next code, the command \draw (a.antenna)--(b.antenna) doesn't work.



\documentclass[tikz,border=2mm]{standalone}

\begin{document}

\tikzset{antenna/.style={append after command={
\pgfextra \draw (\tikzlastnode.north)--++(90:1cm) circle(2pt) coordinate (\tikzlastnode.antenna); \endpgfextra}}}

\begin{tikzpicture}

\draw node[draw, minimum width=2cm, antenna] (a) at (0,0) {A};

\draw node[draw, minimum width=2cm, antenna] (b) at (2,0) {B};

%\draw (a.antenna) -- (b.antenna);
\end{tikzpicture}

\end{document}




Aucun commentaire:

Enregistrer un commentaire