Tikz: パスに触れずにノードを作成した後にコードを実行する

Tikz: パスに触れずにノードを作成した後にコードを実行する

何らかの理由で (ノードが tikzcd でそのノードを指す矢印のスタイルに影響を与えるようにするため)、\tikzlastnodetikz(cd) マトリックスの現在の位置の名前を取得するコードを実行する必要がありますが、これはノードの作成後にのみ定義されます。残念ながら、append after commandパスが必要です (空のパスは有効な入力ではないようです)。そのため、パスを実行するためだけに偽の空のノードを作成する必要がありますが、これは非常に汚いように聞こえ、問題 (スペースの追加、次のパスの妨害など) が発生するのではないかと心配しています。append after commandパスをまったく妨害せずに実行 (または同等のもの) できますか?

MWE:

ここに画像の説明を入力してください

\documentclass{article}

\usepackage{tikz}
\usepackage{tikz-cd}

\begin{document}
\makeatletter
\begin{tikzcd}
  A \rar[/utils/exec={\message{BBBBB The message above (AAAA) should be equal to \tikzcd@ar@target}}, draw=\myfillcolor] & |[append after command={
    %%% Creating an empty node + /utils/exec sounds really dirty:
    node[/utils/exec={%
      \message{AAAA I need to have access to the name of the current node \tikzlastnode}%
      \gdef\myfillcolor{red}
    }%
    ] {}
  }
  ]| B
\end{tikzcd}
\end{document}

編集

誰かが提案してくれ\pgfextra ... \endpgfextraて、うまくいきました! ありがとう!

\documentclass{article}

\usepackage{tikz}
\usepackage{tikz-cd}

\begin{document}
\makeatletter
\begin{tikzcd}
  A \rar[/utils/exec={\message{BBBBB The message above (AAAA) should be equal to \tikzcd@ar@target}}, draw=\myfillcolor] & |[append after command={%
    \pgfextra% this syntax with \endpgfextra completely turns off the tikz syntax, that might be safer than \pgfextra{...}.
      \message{AAAA I need to have access to the name of the current node \tikzlastnode}%
      \gdef\myfillcolor{red}%
    \endpgfextra%
    }]| B
\end{tikzcd}
\end{document}

関連情報