Don't use nodes here; neither to mark positions on the path (you can use a coordinate
for that) nor to get back to the top point on that line, just use the path you already used there (you are allowed to use a path after node
) or just re-calculate the coordinate or use move-tos to there (leave out the --
in your path).
I also provide an antenna
insert path
style that takes one argument, namely the number of the coordinate, the rest is a mix of relative (+
) as well as relative and move-to (++
) operators.
The same is valid for the \MBS
macro. Here I have opted to draw the dart
with an outer sep
of zero, so that the anchors lie in the middle of line (which needs to go against with drawing the antenna part (notice the yshift=.8pt
which comes from the line width used with the thick
style).
I commented the original placement of the \dots
and added another way to place the dots, namely with a label
(\MUE
) and a node on a path (\MBS
).
Feel free to not use this.
Code
\documentclass[tikz]{standalone}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathreplacing,decorations.markings,shapes.geometric}
\tikzset{antenna/.style={insert path={-- coordinate (ant#1) ++(0,0.25) -- + (135:0.25) + (0,0) -- +(45:0.25)}}}
\newcommand{\MUE}[1]{%
\begin{tikzpicture}[every node/.append style={rectangle,minimum width=+0pt}]
\node[draw, shape = rectangle, minimum width=15mm, minimum height=7.5mm,label=\dots] (box) {#1};
\draw ([xshift=.25cm] box.south west) circle (4pt)
([xshift=-.25cm]box.south east) circle (4pt);
\fill ([xshift=.25cm] box.south west) circle (1pt)
([xshift=-.25cm]box.south east) circle (1pt);
\draw ([xshift=.25cm] box.north west) [antenna=1];
\draw ([xshift=-.25cm]box.north east) [antenna=2];
%\node at ($(ant1)!0.5!(ant2)$) {\dots};
\end{tikzpicture}}
\newcommand{\MBS}[1]{%
\begin{tikzpicture}
\node[draw, shape = dart, shape border rotate = 90, minimum width = 10mm, minimum height = 10mm,outer sep=+0pt] (base) {#1};
\draw[line join = bevel] (base.110) -- (base.70) -- (base.north west) -- (base.north east) -- cycle;
\draw[line cap=rect] ([xshift=.5cm,yshift=.8pt] base.north) [antenna=1];
\draw[line cap=rect] ([yshift=.8pt]ant1 |- base.north) -- node[above,shape=rectangle]{\dots} ([xshift=-.5cm,yshift=.8pt]base.north) [antenna=2];
%\node at ($(ant1)!0.5!(ant2)$) {\dots};
\end{tikzpicture}}
\begin{document}
\begin{tikzpicture}
\node[draw, shape = circle, fill = yellow!30] at (0,0) (test1) {\MBS{BS}};
\node[draw, shape = circle, fill = blue!30] at (3,3) (test2) {\MUE{UE1}};
\node[draw, shape = circle, fill = blue!30] at (3,-3) (test3) {\MUE{UE2}};
\draw[->] (test1) -- (test2);
\draw[->] (test1) -- (test3);
\end{tikzpicture}
\end{document}
Output
I don't really get the question so I hope this is what you wanted. If you include a full document (such that we copy paste and see the problem on our systems) things are much more easier.
Here, you can change the default setting within a scope but your block
style had a node distance
which was resetting every time it is issued. I've made it 2mm such that we can see the difference easier.
\documentclass[tikz]{standalone}
\usetikzlibrary{arrows,shapes.geometric,positioning}
\begin{document}
\begin{tikzpicture}[decision/.style={diamond, draw, text width=4.5em, text badly centered, node distance=3.5cm, inner sep=0pt},
block/.style ={rectangle, draw, text width=6em, text centered, rounded corners, minimum height=4em, minimum height=2em},
cloud/.style ={draw, ellipse, minimum height=2em},
line/.style ={draw,-latex'},
node distance = 1cm,
auto]
\node [block] (1st) {1st};
\node [block, right= of 1st] (2nd1) {2nd1};
\begin{scope}[node distance=2mm and 10mm]%Here we change it for everything inside this scope
\node [block, above= of 2nd1] (2nd2) {2nd2};
\node [block, below= of 2nd1] (2nd3) {2nd3};
\node [block, right= of 2nd1] (3rd1) {3rd1};
\node [block, above= of 3rd1] (3rd2) {3rd2};
\node [block, above= of 3rd2] (3rd3) {3rd3};
\end{scope}
\node [block, below= of 3rd1] (3rd4) {3rd4};
\node [block, below= of 3rd4] (3rd5) {3rd5};
\path [line] (1st) -- (2nd1);
\path [line] (2nd1) -- (2nd2);
\path [line] (2nd1) -- (2nd3);
\path [line] (2nd2) -- (3rd3);
\path [line] (2nd1) -- (3rd1);
\path [line] (1st) -- (2nd1);
\end{tikzpicture}
\end{document}
Best Answer
The simplest way IMHO is to typeset the inner
tikzpicture
in a savebox outside the othertikzpicture
and then use the box inside the node. This way no settings of the parenttikzpicture
will be picked up, because the inner one is already rendered.If you want to do this using a macro:
But here the macro is just a short-cut, you can use
\usebox\mybox
directly if you don't mind.