You can use the -|
and |-
operators to form coordinates. Here, you could provide the y value explicity with n.east
by naming the node containing Some input 2
as n
. Another way is to use the to
path operation which automatically sets \tikztostart
to the start coordinate of the to
operation:
\documentclass[tikz, border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}
\node[draw, minimum height=4cm, minimum width=1cm] (node) at (0,0) {ABC};
\draw[->] (-2,1) node[anchor=east] {Some input 1} -- (node);
\draw[->, red] (-2,-1) node[anchor=east] {Some input 2}
to (\tikztostart -| node.west);
\end{tikzpicture}
\end{document}
To address some comments, the following shows that the problem is not well-defined with “general shapes”:
\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{calc, shapes.misc}
\begin{document}
\begin{tikzpicture}
\node[draw, minimum height=2cm,
rounded rectangle, rounded rectangle west arc=concave] (n) {Some stuff};
\node[circle, inner sep=1.5pt] (foo) at (n.west) {foo};
\draw[red!60!black, ->]
let \p1=($(n.north)-(n.center)$) in
(foo) foreach \angle in {-90, -75, ..., 90} { edge +(\angle:\y1) };
\end{tikzpicture}
\end{document}
But what if?..
So, you have a rotated rectangular node and still want to play? The TikZ calc
library can orthogonally project a point p on a line (ab) with its ($(a)!(p)!(b)$)
syntax:
\documentclass[tikz, border=1mm]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\node[draw, rotate=30] (n) {Some stuff};
\node[draw] (foo) at (-1,0.5) {foo bar};
\foreach \anch in {270, 300, 320, 330, 337, 350} {
\draw[very thin, ->] (foo.\anch) --
($(n.north west)!(foo.\anch)!(n.north east)$);
}
\end{tikzpicture}
\end{document}