I'm trying to create some blocks in tikz and create some edges between them. It should look like the attached image. (With more blocks obviously) Each block may have an arbitrary number of inputs on its left hand side, and an arbitrary number of outputs on its right hand side. (-> tikz-anchors?)
The block names, inputs and outputs are generated via a python3 script. (among other things)
I tried to create the block on the right first: "just" 2 inputs, 2 outputs. In the tikz manual I read about "anchors", "declareshape" and "circle split", so I tried to create a rectangle with a second label (somewhere).
It looks like I'm to dumb do that...

Edit:
Another question that I have:
Will I be able to use that with automatic layout?
Minimal code included below:
Code: Select all
! Package PGF Math Error: Unknown function `port' (in ' port').
...
! Missing number, treated as zero.
...
! A <box> was supposed to be here.
...
Code: Select all
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes}
\makeatletter
\begin{document}
\newbox\pgfnodepartportbox
\pgfdeclareshape{document}{
\nodeparts{text, port}
\savedanchor\centerpoint{%
\pgf@x=.5\wd\pgfnodeparttextbox%
\pgfmathsetlength{\pgf@y}{10mm}%
\pgf@y=-\pgf@y%
\advance\pgf@y by-\dp\pgfnodeparttextbox%
\advance\pgf@y by-.5\pgflinewidth%
}%
\savedanchor\portanchor{%
\pgf@x=-.5\wd\pgfnodepartportbox%
\advance\pgf@x by.5\wd\pgfnodeparttextbox%
\pgfmathsetlength{\pgf@y}{10mm}%
\pgf@y=-2\pgf@y%
\advance\pgf@y by-\ht\pgfnodepartportbox%
\advance\pgf@y by-.5\pgflinewidth%
\advance\pgf@y by-\dp\pgfnodeparttextbox%
\advance\pgf@y by-.5\pgflinewidth%
}
\inheritsavedanchors[from=rectangle]
\inheritanchorborder[from=rectangle]
\inheritanchor[from=rectangle]{center}
\inheritanchor[from=rectangle]{north}
\inheritanchor[from=rectangle]{south}
\inheritanchor[from=rectangle]{west}
\inheritanchor[from=rectangle]{east}
\inheritbackgroundpath[from=rectangle]
\anchor{port}{\portanchor}
}
\begin{tikzpicture}
\node[draw,shape=circle split] (x) {Remark \nodepart{lower} test};
\node[draw,shape=document] at ([shift=(0:3cm)]x) (x) {test1 \nodepart{port} test2};
\end{tikzpicture}
\end{document}