Positioning of nodes not exact?
try the following:
\documentclass[crop,tikz]{standalone}
\usetikzlibrary{positioning,calc}
\begin{document}
\tikzset{
block/.style = {draw, rectangle, minimum size=1cm},
halfblock/.style = {draw, rectangle, minimum height=0.5cm, minimum width=1cm}
}
\begin{tikzpicture}
\node [block](A) {A};
\node [halfblock,align=center,above right=-0.5cm and 1cm of A](B) {B};
\draw [->] (A.east |- B) -- (B); % <---
\end{tikzpicture}
\end{document}
changes is indicated by % <---
or probably you looking for the following:
for this result you should add to each node style definition outer sep=0pt
or for example define common style, which contain option outer sep=0pt
:
\documentclass[crop,tikz]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\tikzset{
base/.style = {draw, align=center, % <---
outer sep=0pt}, % <---
block/.style = {base,minimum size=1cm},
halfblock/.style = {base, minimum height=0.5cm, minimum width=1cm}
}
\begin{tikzpicture}
\node [block](A) {A};
\node [halfblock,above right=-0.5cm and 1cm of A](B) {B};
\draw [->] (A.east |- B) -- (B); % <---
\end{tikzpicture}
\end{document}
If you want the upper lines to be at the same y values, you could just use appropriate anchors. The advantage of this procedure is that it will still work if the heights exceed the minimal values.
\documentclass[crop,tikz]{standalone}
\begin{document}
\tikzset{block/.style={draw, rectangle, minimum height=1cm, minimum width=1cm},
halfblock/.style={draw, rectangle, minimum height=0.5cm, minimum width=1cm}}
\begin{tikzpicture}
\node [block,align=center](A) {A};
\node [halfblock,align=center,anchor=north west] (B) at ([xshift=1cm]A.north
east) {B};
\draw [<-] (B.west) -- (A.east |-B.west);
\end{tikzpicture}
\end{document}