Tikz-复杂形状作为节点

Tikz-复杂形状作为节点

我正在尝试重现以下图片

在此处输入图片描述

在这幅图中,有一些形状是重复的。例如56810和 11.我的想法是使用 来./style定义这些形状并将它们放置在适当的位置。

虽然我知道如何创建简单的样式tikz(比如pipe在我的代码中),但我不知道如何创建更复杂的形状并在我的图片中重复它们。例如,我不能画出形状5原样,但我把它画成一个简单的正交盒子。

关于如何绘制它们并重现图像,您有什么想法吗?

编辑我也尝试创造形状412,但我似乎无法绘制它们并将它们放置在正确的位置。

我到目前为止的代码是

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}

\tikzset{
  pipe/.style = {
    draw,
    minimum width=4cm, 
    minimum height=.1cm, 
    anchor=east,
  },
  source/.style = {
    draw,
    fill=black, 
    minimum width=.8cm, 
    minimum height=.4cm, 
  },
  lenses/.style = {
    draw,
    fill=yellow,
    minimum width=.7cm, 
    minimum height=.1mm, 
  },
  steerer/.style = {
    draw,
    fill=blue,
    minimum width=.7cm, 
    minimum height=.5cm, 
    rounded corners
  }
  }

\begin{document}
 \definecolor{tank}{RGB}{98,190,177}
 \begin{tikzpicture}
  %tank
  \coordinate (tank) at (0,0);
  \draw[tank, fill=tank] (-2,0.5)--(-0.5,1)--(0.5,1)--(2,0.5)--(2,-0.5)--(0.5,-1)--(-0.5,-1)--(-2,-0.5)--cycle;
  %pipes
  \coordinate (pipe1) at (-2,0);
  \node[pipe] at (pipe1) (pipe1) {};%left pipe
  \coordinate (pipe2) at (2,0);
  \node[pipe,anchor=west] at (pipe2) (pipe2) {};%right pipe
  \node[pipe, right=0mm of pipe2,rotate=-90] (pipe3) {};
  \node[pipe, right=0mm of pipe3,rotate=-160] (R3) {};
  \node[pipe, right=0mm of pipe3,rotate=-130] (R2) {};
  \node[pipe, right=0mm of pipe3,rotate=-110] (R1) {};
  \node[pipe, right=0mm of pipe3,rotate=-80] (L1) {};
  \node[pipe, right=0mm of pipe3,rotate=-50] (L2) {};
  \node[pipe, right=0mm of pipe3,rotate=-20] (L3) {};
  \node[pipe, left=0mm of pipe1,rotate=-30] (sputter) {};
  \node[pipe, left=0mm of pipe1,rotate=30] (duoplasmatron) {};
  %experimental chamber
  \node[circle,fill=red,right=-1.5mm of L1] {};
  %sources  
  \node[source, left=0mm of sputter,rotate=60,anchor=south] (spusource) {};
  \node[source, left=0mm of duoplasmatron,rotate=-60,anchor=north] (duosource) {};
  %electrostatic lenses
  \node[lenses,rotate=60,fill=yellow] at (sputter) (lenses1) {};
  \node[lenses,rotate=-60,fill=yellow] at (duoplasmatron) (lenses2) {};
  \node[lenses,rotate=90, left=-7.5mm of pipe1, anchor=south,fill=yellow] (lenses3) {};
  \node[lenses,rotate=90, right=-7.5mm of pipe1, anchor=north,fill=yellow] (lenses3) {};
  %steerers
  \node[steerer,rotate=90, right=-15mm of pipe1, anchor=north] (steerer1) {};
  \node[steerer,rotate=90, left=-15mm of pipe2, anchor=south] (steerer2) {};
  %analyser
  \draw[red,fill=white] (5.6,-0.25)--(5.5,-0.25)--(5.5,0.25)--(5.9,0.25)arc(90:0:0.375cm)--+(0,-0.5)--+(-0.5,-0.5)--+(-0.5,-0.3)arc(0:90:0.175cm);
  %inflector
  \draw[red, thick] (-5.95,-0.1cm)--(-5.95,0.1cm)--+(135:0.3cm)--(-6.4,0.33);
  %walls
  \draw[very thick] (-3,-4)--(5,-4)arc(180:270:1)--(6,-8)--(6,-5)arc(270:360:1)--(9,-4);
 \end{tikzpicture}
\end{document}

我的输出是

在此处输入图片描述

编辑在@Symbol 回答之后,代码已被修改

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}

\tikzset{
  pipe/.style = {
    draw,
    minimum width=4cm, 
    minimum height=.1cm, 
    anchor=east,
  },
  steerer/.style = {
    draw,
    fill=white,
    minimum width=.2cm, 
    minimum height=.5cm, 
    anchor=east,
    rounded corners=0.5mm
  }
}

\begin{document}
 \definecolor{tank}{RGB}{98,190,177}
 \makeatletter

\pgfdeclareshape{slits}{
    \savedanchor\centerpoint{\pgf@x=0cm \pgf@y=0cm}
    \saveddimen\halfwidth{
        \pgf@x=.25cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum width}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \saveddimen\halfheight{
        \pgf@x=.25cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum height}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \anchor{center}\centerpoint
    \anchor{north}{
        \pgf@process\halfheight
        \pgf@x=0cm
        \pgf@y=.2cm\advance\pgf@y by\halfheight}
    \anchorborder{\centerpoint}
    \backgroundpath{
        \draw[rounded corners=.1cm, fill=white](-\halfwidth,-\halfheight)rectangle(\halfwidth,\halfheight);
        \draw[rounded corners=.04cm](-.8*\halfwidth,-.4*\halfheight)rectangle(.8*\halfwidth,-.8*\halfheight)(-.8*\halfwidth,.4*\halfheight)rectangle(.8*\halfwidth,.8*\halfheight);}}

\pgfdeclareshape{quadrapole}{
    \savedanchor\centerpoint{\pgf@x=0cm \pgf@y=0cm}
    \saveddimen\halfwidth{
        \pgf@x=.25cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum width}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \saveddimen\halfheight{
        \pgf@x=.25cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum height}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \anchor{center}\centerpoint
    \anchor{north}{
        \pgf@process\halfheight
        \pgf@x=0cm
        \pgf@y=.2cm\advance\pgf@y by\halfheight}
    \anchorborder{\centerpoint}
    \backgroundpath{
        \draw[rounded corners=.1cm,fill=white](-\halfwidth,-\halfheight)rectangle(\halfwidth,\halfheight);
        \filldraw[rounded corners=.04cm,fill=red](-.8*\halfwidth,-.4*\halfheight)rectangle(.8*\halfwidth,-.8*\halfheight)(-.8*\halfwidth,-.2*\halfheight)rectangle(.8*\halfwidth,.2*\halfheight)(-.8*\halfwidth,.4*\halfheight)rectangle(.8*\halfwidth,.8*\halfheight);}}

\pgfdeclareshape{lens}{
    \savedanchor\centerpoint{\pgf@x=0cm \pgf@y=0cm}
    \saveddimen\halfwidth{
        \pgf@x=.05cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum width}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \saveddimen\halfheight{
        \pgf@x=.3cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum height}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \anchor{center}\centerpoint
    \anchor{north}{
        \pgf@process\halfheight
        \pgf@x=0cm
        \pgf@y=.2cm\advance\pgf@y by\halfheight}
    \anchorborder{\centerpoint}
    \backgroundpath{
        \draw(0,-1.2*\halfheight)--(0,-\halfheight);
        \draw(0,\halfheight)--(0,1.2*\halfheight);
        \draw[fill=white](-\halfwidth,-\halfheight)rectangle(\halfwidth,\halfheight);
        }}

\pgfdeclareshape{pump}{
    \savedanchor\centerpoint{\pgf@x=0cm \pgf@y=0cm}
    \saveddimen\halfwidth{
        \pgf@x=.025cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum width}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \saveddimen\halfheight{
        \pgf@x=.2cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum height}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \anchor{center}\centerpoint
    \anchor{north}{
        \pgf@process\halfheight
        \pgf@x=0cm
        \pgf@y=.18cm\advance\pgf@y by\halfheight}
    \anchorborder{\centerpoint}
    \backgroundpath{
        \draw[fill=black](-\halfwidth,-\halfheight)rectangle(\halfwidth,\halfheight);
        \draw[fill=white](0,-1.8*\halfheight)circle(0.75*\halfheight);
        }}

\pgfdeclareshape{source}{
    \savedanchor\centerpoint{\pgf@x=0cm \pgf@y=0cm}
    \saveddimen\halfwidth{
        \pgf@x=1cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum width}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \saveddimen\halfheight{
        \pgf@x=.3cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum height}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \anchor{center}\centerpoint
    \anchor{north}{
        \pgf@process\halfheight
        \pgf@x=0cm
        \pgf@y=.2cm\advance\pgf@y by\halfheight}
    \anchor{south}{
        \pgf@process\halfheight
        \pgf@x=0cm
        \pgf@y=-.2cm\advance\pgf@y by-\halfheight}
    \backgroundpath{
        \draw(-\halfwidth,-\halfheight)rectangle(\halfwidth,\halfheight)(-.8*\halfwidth,-1.2*\halfheight)--(-.8*\halfwidth,1.2*\halfheight)(-.4*\halfwidth,-1.2*\halfheight)--(-.4*\halfwidth,1.2*\halfheight)(0,-1.2*\halfheight)--(0,1.2*\halfheight)(.4*\halfwidth,-1.2*\halfheight)--(.4*\halfwidth,1.2*\halfheight)(.8*\halfwidth,-1.2*\halfheight)--(.8*\halfwidth,1.2*\halfheight);}}
 \begin{tikzpicture}
  %tank
  \coordinate (tank) at (0,0);
  \draw[tank, fill=tank] (-2,0.5)--(-0.5,1)--(0.5,1)--(2,0.5)--(2,-0.5)--(0.5,-1)--(-0.5,-1)--(-2,-0.5)--cycle;
  %pipes
  \coordinate (pipe1) at (-2,0);
  \node[pipe] at (pipe1) (pipe1) {};%left pipe
  \coordinate (pipe2) at (2,0);
  \node[pipe,anchor=west] at (pipe2) (pipe2) {};%right pipe
  \node[pipe, right=0mm of pipe2,rotate=-90] (pipe3) {};
  \node[pipe, right=0mm of pipe3,rotate=-160] (R3) {};
  \node[pipe, right=0mm of pipe3,rotate=-130] (R2) {};
  \node[pipe, right=0mm of pipe3,rotate=-110] (R1) {};
  \node[pipe, right=0mm of pipe3,rotate=-80] (L1) {};
  \node[pipe, right=0mm of pipe3,rotate=-50] (L2) {};
  \node[pipe, right=0mm of pipe3,rotate=-20] (L3) {};
  \node[pipe, left=0mm of pipe1,rotate=-30] (sputter) {};
  \node[pipe, left=0mm of pipe1,rotate=30] (duoplasmatron) {};
  %experimental chamber
  \node[circle,fill=red,right=-1.5mm of L1] {};
  %sources  
  \node[source,rotate=-30,above left=8mm and 7mm of sputter,anchor=north] (spusource) {};
  \node[source,rotate=30,above left=-1.75mm and 10.5mm of duoplasmatron,anchor=north] (duosource) {};
  %electrostatic lenses
  \node[lens,rotate=-30] at (sputter) (lenses1) {};
  \node[lens,rotate=30] at (duoplasmatron) (lenses2) {};
  \node[lens,rotate=0] at (-5.5,0) (lenses3) {};
  \node[lens,rotate=0] at (-2.5,0) (lenses4) {};
  %quadrapoles
  \node(st1)at(2.5,0)[quadrapole]{};
  \node(st2)at(6,-3)[quadrapole,rotate=90]{};
  %slits
  \node(sl1)at(-5,0)[slits]{};
  \node(sl2)at(4.5,0)[slits]{};
  \node(sl3)at(6,-1.5)[slits]{};
  %steerers
  \node[steerer] (steerer1)at(-3.5,0) {};
  \node[steerer] (steerer2)at(3.6125,0) {};
  %pumps
  \node(p1)at(-2.15,-0.325)[pump]{};
  \node(p2)at(2.15,-0.325)[pump]{};
  \node(p3)at(5.15,0.325)[pump,rotate=180]{};
  \node(p4)at(5.7,-3.5)[pump,rotate=-90]{};
  \node(p5)at(-8.5,-1.8)[pump,rotate=30]{};
  \node(p6)at(-8.5,1.8)[pump,rotate=150]{};
  %analyser
  \draw[red,fill=white] (5.6,-0.25)--(5.5,-0.25)--(5.5,0.25)--(5.9,0.25)arc(90:0:0.375cm)--+(0,-0.5)--+(-0.5,-0.5)--+(-0.5,-0.3)arc(0:90:0.175cm);
  %inflector  <----------------------------------
  \draw[red, thick] (-5.95,-0.1cm)--(-5.95,0.1cm)--+(135:0.3cm)--(-6.4,0.33);
  %walls
  \draw[very thick] (-3,-4)--(5,-4)arc(180:270:1)--(6,-8)--(6,-5)arc(270:360:1)--(9,-4);
 \end{tikzpicture}
\end{document}

输出为

在此处输入图片描述

答案1

我没有时间全部做完。下面是一些例子。(忘记了\newcommand

\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\makeatletter

\pgfdeclareshape{slits}{
    \savedanchor\centerpoint{\pgf@x=0cm \pgf@y=0cm}
    \saveddimen\halfwidth{
        \pgf@x=.25cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum width}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \saveddimen\halfheight{
        \pgf@x=.25cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum height}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \anchor{center}\centerpoint
    \anchor{north}{
        \pgf@process\halfheight
        \pgf@x=0cm
        \pgf@y=.2cm\advance\pgf@y by\halfheight}
    \anchorborder{\centerpoint}
    \backgroundpath{
        \draw[rounded corners=.1cm](-\halfwidth,-\halfheight)rectangle(\halfwidth,\halfheight);
        \draw[rounded corners=.04cm](-.8*\halfwidth,-.4*\halfheight)rectangle(.8*\halfwidth,-.8*\halfheight)(-.8*\halfwidth,.4*\halfheight)rectangle(.8*\halfwidth,.8*\halfheight);}}

\pgfdeclareshape{steerer}{
    \savedanchor\centerpoint{\pgf@x=0cm \pgf@y=0cm}
    \saveddimen\halfwidth{
        \pgf@x=.25cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum width}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \saveddimen\halfheight{
        \pgf@x=.25cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum height}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \anchor{center}\centerpoint
    \anchor{north}{
        \pgf@process\halfheight
        \pgf@x=0cm
        \pgf@y=.2cm\advance\pgf@y by\halfheight}
    \anchorborder{\centerpoint}
    \backgroundpath{
        \draw[rounded corners=.1cm](-\halfwidth,-\halfheight)rectangle(\halfwidth,\halfheight);
        \filldraw[rounded corners=.04cm,fill=red](-.8*\halfwidth,-.4*\halfheight)rectangle(.8*\halfwidth,-.8*\halfheight)(-.8*\halfwidth,-.2*\halfheight)rectangle(.8*\halfwidth,.2*\halfheight)(-.8*\halfwidth,.4*\halfheight)rectangle(.8*\halfwidth,.8*\halfheight);}}

\pgfdeclareshape{lens}{
    \savedanchor\centerpoint{\pgf@x=0cm \pgf@y=0cm}
    \saveddimen\halfwidth{
        \pgf@x=.05cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum width}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \saveddimen\halfheight{
        \pgf@x=.3cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum height}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \anchor{center}\centerpoint
    \anchor{south}{
        \pgf@process\halfheight
        \pgf@x=0cm
        \pgfmathsetlength\pgf@y{-1.2*\halfheight-.2cm}}
    \anchorborder{\centerpoint}
    \backgroundpath{
        \draw(0,-1.2*\halfheight)--(0,-\halfheight)(0,\halfheight)--(0,1.2*\halfheight)(-\halfwidth,-\halfheight)rectangle(\halfwidth,\halfheight);}}

\pgfdeclareshape{lollipop}{
    \savedanchor\centerpoint{\pgf@x=0cm \pgf@y=0cm}
    \saveddimen\halfwidth{
        \pgf@x=.1cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum width}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \saveddimen\halfheight{
        \pgf@x=.3cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum height}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \anchor{center}\centerpoint
    \anchor{south}{
        \pgf@process\halfheight
        \pgf@process\halfwidth
        \pgf@x=0cm
        \pgfmathsetlength\pgf@y{-\halfheight-\halfwidth-.2cm}}
    \anchorborder{\centerpoint}
    \backgroundpath{
        \draw[ultra thick](0,0)--(0,-\halfheight);
        \filldraw[fill=white](0,-\halfheight)circle(\halfwidth);}}

\pgfdeclareshape{皿}{
    \savedanchor\centerpoint{\pgf@x=0cm \pgf@y=0cm}
    \saveddimen\halfwidth{
        \pgf@x=1cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum width}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \saveddimen\halfheight{
        \pgf@x=.3cm
        \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum height}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \anchor{center}\centerpoint
    \anchor{north}{
        \pgf@process\halfheight
        \pgf@x=0cm
        \pgf@y=.2cm\advance\pgf@y by\halfheight}
    \anchor{south}{
        \pgf@process\halfheight
        \pgf@x=0cm
        \pgf@y=-.2cm\advance\pgf@y by-\halfheight}
    \backgroundpath{
        \draw(-\halfwidth,-\halfheight)rectangle(\halfwidth,\halfheight)(-.8*\halfwidth,-1.2*\halfheight)--(-.8*\halfwidth,1.2*\halfheight)(-.4*\halfwidth,-1.2*\halfheight)--(-.4*\halfwidth,1.2*\halfheight)(0,-1.2*\halfheight)--(0,1.2*\halfheight)(.4*\halfwidth,-1.2*\halfheight)--(.4*\halfwidth,1.2*\halfheight)(.8*\halfwidth,-1.2*\halfheight)--(.8*\halfwidth,1.2*\halfheight);}}

    \begin{tikzpicture}
        \node(sl1)at(2,2)[slits]{};
        \node(st1)at(3,2)[steerer]{};
        \node(le1)at(5,2)[lens]{};
        \node(lo1)at(6,2)[lollipop]{};
        \node(皿1)at(4,0)[皿]{};
        \draw(sl1.north)node{$6$};
        \draw(st1.north)node{$10$};
        \draw(le1.south)node{$5$};
        \draw(lo1.south)node{$8$};
        \draw(皿1.north)node{$2$};
        \draw(皿1.south)node{$3$};
    \end{tikzpicture}

\end{document}

答案2

我不应该为你做这件事,但……只是为了说明一切皆有可能。我添加了一个新答案,而不是编辑现有答案,因为源代码现在更长,并且包含丑陋的操作。请注意,我修改了一些\pgfdeclareshape

\documentclass[a4,landscape]{article}
\usepackage{tikz}
\begin{document}
\makeatletter

\pgfdeclareshape{slit}{
    \savedanchor\centerpoint{\pgf@x=0cm\pgf@y=0cm}
    \saveddimen\halfwidth{
        \pgf@x=.25cm
        \pgfmathsetlength\pgf@xa{.5*\pgfkeysvalueof{/pgf/minimum width}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \saveddimen\halfheight{
        \pgf@x=.25cm
        \pgfmathsetlength\pgf@xa{.5*\pgfkeysvalueof{/pgf/minimum height}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \anchor{center}\centerpoint
    \anchor{north}{
        \pgf@process\halfheight
        \pgf@x=0cm
        \pgf@y=.2cm\advance\pgf@y by\halfheight}
    \anchorborder{\centerpoint}
    \backgroundpath{
        \draw[rounded corners=.1cm](-\halfwidth,-\halfheight)rectangle(\halfwidth,\halfheight);
        \draw[rounded corners=.04cm](-.8*\halfwidth,-.4*\halfheight)rectangle(.8*\halfwidth,-.8*\halfheight)(-.8*\halfwidth,.4*\halfheight)rectangle(.8*\halfwidth,.8*\halfheight);}}

\pgfdeclareshape{red slit}{
    \savedanchor\centerpoint{\pgf@x=0cm\pgf@y=0cm}
    \saveddimen\halfwidth{
        \pgf@x=.25cm
        \pgfmathsetlength\pgf@xa{.5*\pgfkeysvalueof{/pgf/minimum width}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \saveddimen\halfheight{
        \pgf@x=.25cm
        \pgfmathsetlength\pgf@xa{.5*\pgfkeysvalueof{/pgf/minimum height}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \anchor{center}\centerpoint
    \anchor{north}{
        \pgf@process\halfheight
        \pgf@x=0cm
        \pgf@y=.2cm\advance\pgf@y by\halfheight}
    \anchorborder{\centerpoint}
    \backgroundpath{
        \draw[rounded corners=.1cm,fill=white](-\halfwidth,-\halfheight)rectangle(\halfwidth,\halfheight);
        \draw[rounded corners=.04cm,fill=red](-.8*\halfwidth,-.4*\halfheight)rectangle(.8*\halfwidth,-.8*\halfheight)(-.8*\halfwidth,-.2*\halfheight)rectangle(.8*\halfwidth,.2*\halfheight)(-.8*\halfwidth,.4*\halfheight)rectangle(.8*\halfwidth,.8*\halfheight);}}

\pgfdeclareshape{lens}{
    \savedanchor\centerpoint{\pgf@x=0cm\pgf@y=0cm}
    \saveddimen\halfwidth{
        \pgf@x=.05cm
        \pgfmathsetlength\pgf@xa{.5*\pgfkeysvalueof{/pgf/minimum width}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \saveddimen\halfheight{
        \pgf@x=.2cm
        \pgfmathsetlength\pgf@xa{.5*\pgfkeysvalueof{/pgf/minimum height}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \anchor{center}\centerpoint
    \anchor{south}{
        \pgf@process\halfheight
        \pgf@x=0cm
        \pgfmathsetlength\pgf@y{-1.5*\halfheight-.2cm}}
    \anchorborder{\centerpoint}
    \backgroundpath{
        \draw[fill=white](0,-1.5*\halfheight)--(0,-\halfheight)(0,\halfheight)--(0,1.5*\halfheight)(-\halfwidth,-\halfheight)rectangle(\halfwidth,\halfheight);}}

\pgfdeclareshape{lollipop}{
    \savedanchor\centerpoint{\pgf@x=0cm\pgf@y=0cm}
    \saveddimen\halfwidth{
        \pgf@x=.1cm
        \pgfmathsetlength\pgf@xa{.5*\pgfkeysvalueof{/pgf/minimum width}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \saveddimen\halfheight{
        \pgf@x=.3cm
        \pgfmathsetlength\pgf@xa{.5*\pgfkeysvalueof{/pgf/minimum height}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \anchor{center}\centerpoint
    \anchor{south}{
        \pgf@process\halfheight
        \pgf@process\halfwidth
        \pgf@x=0cm
        \pgfmathsetlength\pgf@y{-\halfheight-\halfwidth-.2cm}}
    \anchorborder{\centerpoint}
    \backgroundpath{
        \draw[ultra thick](0,0)--(0,-\halfheight);
        \draw[fill=white](0,-\halfheight)circle(\halfwidth);}}

\pgfdeclareshape{皿}{
    \savedanchor\centerpoint{\pgf@x=0cm\pgf@y=0cm}
    \saveddimen\halfwidth{
        \pgf@x=.3cm
        \pgfmathsetlength\pgf@xa{.5*\pgfkeysvalueof{/pgf/minimum width}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \saveddimen\halfheight{
        \pgf@x=.1cm
        \pgfmathsetlength\pgf@xa{.5*\pgfkeysvalueof{/pgf/minimum height}}
        \ifdim\pgf@x<\pgf@xa\pgf@x=\pgf@xa\fi}
    \anchor{center}\centerpoint
    \anchor{north}{
        \pgf@process\halfheight
        \pgf@x=0cm
        \pgf@y=.2cm\advance\pgf@y by\halfheight}
    \anchor{south}{
        \pgf@process\halfheight
        \pgf@x=0cm
        \pgf@y=-.2cm\advance\pgf@y by-\halfheight}
    \backgroundpath{
        \draw[fill=white](-\halfwidth,-\halfheight)rectangle(\halfwidth,\halfheight)(-.8*\halfwidth,-1.5*\halfheight)--(-.8*\halfwidth,1.5*\halfheight)(-.4*\halfwidth,-1.5*\halfheight)--(-.4*\halfwidth,1.5*\halfheight)(0,-1.5*\halfheight)--(0,1.5*\halfheight)(.4*\halfwidth,-1.5*\halfheight)--(.4*\halfwidth,1.5*\halfheight)(.8*\halfwidth,-1.5*\halfheight)--(.8*\halfwidth,1.5*\halfheight);}}

\tikzset{steers/.style={fill=white,draw,shape=rectangle,rounded corners=.1cm}}

    \hspace{-5cm}\begin{tikzpicture}
        % grid
        \draw[step=.2cm](-10.4,2.1)grid(-6.6,3.3)(-6,2.7)node{1};
        % slits
        \path[slit,minimum height=.9cm,minimum width=.9cm](-6.5,0)node(sl){}(5.5,0)node{}(8,-2)node[rotate=90]{};
        % lollipops
        \path[lollipop,minimum height=.8cm](-8-1.7320508*.6,.6)node[rotate=150]{}(-8-1.7320508*.6,-.6)node[rotate=30]{};
        \path[lollipop,minimum height=1.3cm,minimum width=.4cm](-3.9,0)node(lo){}(2.3,0)node{}(6.6,0)node[rotate=180]{}(8,-3.1)node[rotate=270]{};
        % The main tubes (is that tube or something? whatever...)
        \draw[thick,double,double distance=.1cm](-9.7320508,-1)--(-8,0)--(-9.7320508,1);
        \draw[thick,double,double distance=.2cm,rounded corners=.4cm](-8,0)-|(8,-5);
        \draw[thick,double,double distance=.3cm,rounded corners=.4cm,line cap=rect](7.1,0)-|node[shift={(.2,.2)}]{11}(8,-.6);
        % rays
        \draw[thick,double,double distance=.1cm,line cap=rect](8,-5.5)--+(-40:3.5)+(0,0)--+(-70:3.5)+(0,0)--+(-110:3.5)+(0,0)--+(-130:3.5)+(0,0)--+(-150:3.5);
        \draw[fill=white](8,-5.5)+(-70:3.5)circle(.4)node[shift={(.5,.5)}]{13};
        % red slits
        \path[red slit,minimum height=.9cm,minimum width=.9cm](3,0)node(re){}(8,-4.3)node[rotate=90]{};
        % lens
        \path[lens](-8-1.7320508*.5,.5)node[rotate=-30]{}(-8-1.7320508*.5,-.5)node[rotate=30]{};
        \path[lens,minimum height=.3cm,minimum width=.1cm](-7.3,0)node(le){}(-4.3,0)node{};
        % 皿s
        \path[皿,minimum height=.4cm,minimum width=1.2cm](-9.7320508,1)node(皿1)[rotate=-30]{}(-9.7320508,-1)node(皿2)[rotate=30]{};
        % steers
        \path(-5.3,0)node[steers](st){\phantom{(}}++(.1,.5)node{7}(4.2,0)node[steers]{\phantom{)}};
        % tank
        \draw[fill=white](-1.8,1.3)--(-3.6,.7)--(-3.6,-.7)--(-1.8,-1.3)rectangle node[shift={(0,1.6)}]{9}(.1,1.3)--(1.9,.7)--(1.9,-.7)--(.1,-1.3);
        % inflector
        \draw[fill=white](-8,0)+(-.1,-.3)--+(-.1,.3)--+(-.3,.3)--+(-.4,.1)--+(-.4,-.1)--+(-.3,-.3)--+(0,-.3)--+(.1,-.1)--+(.1,.1)--+(-.1,.3)node[above]{4};
        % switcher
        \draw[fill=white](8,-5)+(-.5,-.6)--+(.5,-.6)..controls+(.3,-.4)and+(-.3,-.4)..+(-.5,-.6)--+(-.3,0)--+(.3,0)--+(.5,-.6)node[above right]{12};
        % black thick
        \draw[line width=.17cm](3,-5.6)--(6.9,-5.6)arc[start angle=-180,end angle=0,
x radius=1.1cm,y radius=.9cm]--(10.7,-5.6)(8,-6.5)--(8,-10.5);
        % left labels
        \path(sl.north)node{6}(lo.south)node{8}(re.north)node{10}(le.south)node{5}(皿1.north)node{2}(皿2.south)node{3};
    \end{tikzpicture}
\end{document}

相关内容