Advertisement
diaaa

Untitled

Dec 25th, 2020
1,612
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 6.07 KB | None | 0 0
  1. \documentclass[tikz,border=3mm]{standalone}
  2. \usepackage{adjustbox}
  3. \usepackage[american, siunitx , RPvoltages]{circuitikz}
  4. \usetikzlibrary{3d,arrows.meta,bending,calc,decorations.markings,patterns.meta,positioning,shapes.geometric}
  5.  
  6. \pgfdeclarepattern{name=Bricks,
  7.     parameters={\brickwidth,\brickheight,\brickangle,\bricklinewidth},
  8.     bottom left={\pgfpoint{-.1pt}{-.1pt}},
  9.     top right={\pgfpoint{\brickwidth+.1pt}{\brickheight+.1pt}},
  10.     tile size={\pgfpoint{\brickwidth}{\brickheight}},
  11.     tile transformation={\pgftransformrotate{\brickangle}},
  12.     code={
  13.         \pgfsetlinewidth{\bricklinewidth}
  14.         \pgfpathmoveto{\pgfpoint{-.1pt}{0pt}}
  15.         \pgfpathlineto{\pgfpoint{\brickwidth+.1pt}{0pt}}
  16.         \pgfpathmoveto{\pgfpoint{-.1pt}{0.5*\brickheight}}
  17.         \pgfpathlineto{\pgfpoint{\brickwidth+.1pt}{0.5*\brickheight}}
  18.         \pgfpathmoveto{\pgfpoint{0.25*\brickwidth}{0pt}}
  19.         \pgfpathlineto{\pgfpoint{0.27*\brickwidth}{0.5*\brickheight}}
  20.         \pgfpathmoveto{\pgfpoint{0.75*\brickwidth}{0.5*\brickheight}}
  21.         \pgfpathlineto{\pgfpoint{0.75*\brickwidth}{\brickheight}}
  22.         \pgfusepath{stroke}
  23. } }
  24. \tikzset{/pgf/pattern keys/.cd,
  25.     brick width/.store in=\brickwidth,
  26.     brick height/.store in=\brickheight,
  27.     brick angle/.store in=\brickangle,
  28.     brick line width/.store in=\bricklinewidth,
  29.     brick width=1em,
  30.     brick height=1em,
  31.     brick angle=0pt,
  32.     brick line width=.5pt,
  33. }
  34.  
  35. \makeatletter
  36. \tikzset{brick fill/.style={path picture={%
  37.             \tikzset{brick fill keys/.cd,#1}%
  38.             \edef\pgfutil@tmpp{path picture bounding box}
  39.             \edef\pgfutil@tmpw{\pgfkeysvalueof{/tikz/brick fill keys/width}}
  40.             \edef\pgfutil@tmph{\pgfkeysvalueof{/tikz/brick fill keys/height}}
  41.             \path[brick fill keys/style] let \p1=($(\pgfutil@tmpp.north east)-(\pgfutil@tmpp.south west)$),
  42.             \n1={scalar(int(\x1/\pgfutil@tmpw))},
  43.             \n2={scalar(int(\y1/\pgfutil@tmph))+1} in
  44.             foreach \YY in {0,...,\n2}
  45.             {([yshift=(\YY-0.5)*\pgfutil@tmph]\pgfutil@tmpp.south west) -- ([yshift=(\YY-0.5)*\pgfutil@tmph]\pgfutil@tmpp.south east)
  46.                 ([yshift=\YY*\pgfutil@tmph]\pgfutil@tmpp.south west) -- ([yshift=\YY*\pgfutil@tmph]\pgfutil@tmpp.south east)
  47.                 foreach \XX in {0,...,\n1} {
  48.                     ([yshift=(\YY-0.5)*\pgfutil@tmph,xshift=(\XX-0.5)*\pgfutil@tmpw]\pgfutil@tmpp.south west)
  49.                     --([yshift=\YY*\pgfutil@tmph,xshift=(\XX-0.5)*\pgfutil@tmpw]\pgfutil@tmpp.south west)
  50.                     ([yshift=(\YY+0.5)*\pgfutil@tmph,xshift=\XX*\pgfutil@tmpw]\pgfutil@tmpp.south west)
  51.                     --([yshift=\YY*\pgfutil@tmph,xshift=\XX*\pgfutil@tmpw]\pgfutil@tmpp.south west)
  52.             }};}},
  53.     brick fill keys/.cd,width/.initial=1em,height/.initial=1em,style/.style={draw}}
  54. \makeatother
  55.  
  56. \tikzset{pics/rotarrow/.style={code={\path (160:0.4) coordinate (tmpex);
  57.             \begin{scope}[local bounding box=tmp,x={(tmpex)},
  58.                 canvas is xy plane at z=0]
  59.                 \clip (-0.41,-0.41) rectangle (0.41,0.41);
  60.                 \pgflowlevelsynccm
  61.                 \draw[thick,-{Stealth[bend]}] (-150:0.4) arc[start angle=-150,end
  62.                 angle=150,radius=0.4];
  63.             \end{scope}
  64.             \path (tmp.north) node [above] {\tikzpictext};
  65.     }},pics/bar/.style={code={\draw[pic actions] (0,-#1) -- (0,#1);}},
  66.     pics/bar/.default=0.5}
  67.  
  68.  
  69. % https://topanswers.xyz/transcript?room=1618&id=85298#c85298
  70. \pgfmathsetmacro{\oriex}{1ex}% store the height of an x in normalsize
  71. \pgfmathsetmacro{\oriem}{1em}
  72. \tikzset{every picture/.append style={%
  73.         execute at begin picture={\pgfmathsetmacro{\myscale}{1ex/\oriex}%
  74.             \ctikzset{bipoles/thickness=1,
  75.                 resistors/scale=\myscale, capacitors/scale=\myscale,
  76.                 diodes/scale=\myscale, transistors/scale=\myscale,
  77.                 grounds/scale=\myscale, csources/scale=\myscale,
  78.                 sources/scale=\myscale, batteries/scale=\myscale,
  79.                 instruments/scale=\myscale, inductors/scale=\myscale,
  80.                 electromechanicals/scale=\myscale,
  81.                 %current arrow scale=16*\myscale*\myscale,%<-?
  82.                 mechanicals/scale=\myscale, use fpu reciprocal}%
  83.             \tikzset{line width= {\myscale*0.4pt}, x=1cm*1em/\oriem, y=1cm*1ex/\oriex}}}}
  84.  
  85. \begin{document}
  86.     \tiny
  87.     %\begin{adjustbox}{width=1\linewidth} % don't use with standalone
  88.         \begin{tikzpicture}[
  89.             line width = 0.175ex,% thick
  90.             x=3em, y=3em, %<- this scales with the font size
  91.             %scale = 0.5, transform shape,
  92.             damper/.style={very thick,
  93.                 decorate,
  94.                 decoration={markings,
  95.                     mark connection node=dmp,
  96.                     mark=at position 0.5 with
  97.                     {
  98.                         \node (dmp) [very thick, inner sep=0pt,
  99.                         transform shape,
  100.                         minimum width=2em,
  101.                         minimum height=1.5em, draw=none,
  102.                         #1] {};
  103.                         \draw [very thick] ([xshift=0.5em]dmp.north east) --
  104.                         (dmp.north west) -- (dmp.south west) --
  105.                         ([xshift=0.5em]dmp.south east)
  106.                         ([yshift=-0.25em]dmp.north east) --
  107.                         ([yshift=0.25em]dmp.south east);
  108.             }}},]
  109.             %
  110.             \draw[line width = 0.15ex] (0,2) coordinate[label={[yshift=-0.2ex]below:{$+$}}] (TL)to[ R=$R_a$, o-] ++(2,0)
  111.             to[short,f=$i_a$] ++(0.1,0)
  112.             to[L,cute inductor, l=$L_a$,-.]  ++(2,0)  
  113.             to[Telmech=M, name=M1] ++(0,-2)
  114.             to[short,.-o] (0,0) coordinate[label={[yshift=-0.2ex]above:{$-$}}] (ML);
  115.             \path (TL) -- node[midway]{$E_a$} (ML);
  116.             %
  117.             \path (M1) ++ (2,0) coordinate (N1);
  118.             \draw[very thick] (M1) -- pic[pic text={$T_m,\theta_m$}]{rotarrow} (N1) pic[very thick]{bar};
  119.             %
  120.             \draw[very thick] ([yshift=-4.5em]N1) coordinate (N2) pic[very thick]{bar=0.90}
  121.             -- ++ (-1,0) coordinate (N3) pic[very thick]{bar=0.45};
  122.             %  
  123.             \draw[very thick] ([yshift=-4em]N3) pic[very thick]{bar=0.775}
  124.             -- pic[pic text={$\theta_L$}, pos=0.5 ]{rotarrow} % xscale=-1 to reflect
  125.             ++ (-1,0) node[anchor=top, cylinder, black, shape border rotate=0, draw, minimum height=4em, minimum width=2em, aspect=0.4,
  126.             cylinder uses custom fill, cylinder end fill = gray!20,
  127.             path picture={\draw($(c.before top)!0.5!(c.after top)$) -- (c.top);}]
  128.             (c) {$J_L$};
  129.             %          
  130.             \path (TL|-c) node[draw, rectangle, minimum height=5em, minimum width = 1.5em,  anchor=west, preaction = {fill=gray!10},
  131.             brick fill={height=1.0em, width=1.0em, style/.style={draw=black}}
  132.             %pattern={Bricks[brick width=1.01em, brick height=1.01em]}
  133.             ](bricks) {};
  134.             %
  135.             \draw [damper={label={below:{$D_L$}}}] (c.west) -- (bricks);
  136.             %
  137.         \end{tikzpicture}
  138.     %\end{adjustbox}
  139. \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement