Could you help me with drawing of the transformer (see below)? I haven't enough experience with tikz to achieve this alone.
Asked
Active
Viewed 225 times
-3
Bast
- 59
-
4You should always post what have you tried – hola Jan 14 '19 at 10:17
-
1You can start something with: https://tex.stackexchange.com/questions/33951/tikzpicture-of-several-springs and then draw a line and two-triangles at the corner. – Raaja_is_at_topanswers.xyz Jan 14 '19 at 10:22
3 Answers
3
In addition to @user177954's nice answer using straight lines, you can also achieve it using decorations options available in the TikZ library.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,
decorations.pathmorphing,
decorations.markings}
\begin{document}
\begin{tikzpicture}
\draw[help lines, step=1] (-2,-1)grid(2,2);
\tikzstyle{spring}=[thick,decorate,decoration={zigzag,pre length=0cm,post
length=0cm,segment length=8}]
% the line
\path (-2,1) node (p1) {};
\path (2,1) node (p2) {};
\draw[very thick] (p1) to (p2);
%the triangles
\draw (-1.86,0.975)
-- (-1.96,0.875)-- (-1.76,0.875)
-- cycle;
\draw (1.86,0.975)
-- (1.96,0.875)-- (1.76,0.875)
-- cycle;
\draw[spring] ($(p1.east)-(-0.3,0)$) -- ( $(p1.east)-(-0.3,1)$);
\draw[spring] ($(p2.west)-(0.3,0)$) -- ( $(p2.west)-(0.3,1)$);
% ground
\draw[very thick] ($(p1.east)-(0,1)$) to ($(p1.east)-(-0.6,1)$);
\fill [pattern = north east lines] ($(p1.east)-(0,1)$) rectangle ($(p1.east)-(-0.6,1.3)$);
\draw[very thick] ($(p2.west)-(0,1)$) to ($(p2.west)-(0.6,1)$);
\fill [pattern = north east lines] ($(p2.west)-(0,1)$) rectangle ($(p2.west)-(0.6,1.3)$);
\end{tikzpicture}
\end{document}
which would give you:
For easy reference, you can also use grid lines in the environment for assitive plotting and referencing your nodes. As you get a hold of it, you can always skip (which unfortunately, I don't ;)).
Raaja_is_at_topanswers.xyz
- 648
- 4
- 20
- 53
3
Really just for fun (because I wanted to try out how much one can abuse /.list.)
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{shapes.geometric,patterns}
\begin{document}
\begin{tikzpicture}[trian/.style={anchor=north,regular polygon,regular polygon
sides=3},zig/.style={insert path={-- ++(-#1,-#1) -- ++(#1,0)}}]
\draw[very thick] (0,0) node[trian,thin,draw,anchor=north]{} -- (9,0)
node[trian,thin,draw,anchor=north]{};
\draw[thick] (3,0) [zig/.list={0.5,0.5,0.5,0.5}] node[below,pattern=north east
lines,minimum width=0.5cm,minimum height=0.3cm,xshift=-0.25cm]{};
\draw[thick] (6,0) [zig/.list={0.5,0.5,0.5,0.5}] node[below,pattern=north east
lines,minimum width=0.5cm,minimum height=0.3cm,xshift=-0.25cm]{};
\end{tikzpicture}
\end{document}
1
Simple straight lines, don't require any experience in tikz:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0.9840,6.7461) -- (0.7801,6.4168) -- (1.2036,6.4168) -- (0.9840,6.7461);
\draw (2.7719,6.7461) -- (2.4426,6.2756) -- (2.7876,6.2700) -- (2.4426,5.8992) -- (2.7876,5.8992) -- (2.4426,5.5709) -- (2.7876,5.5698) -- (2.4426,5.2405) -- (2.7876,5.2405);
\draw (2.4426,5.2405) -- (2.3245,5.0793);
\draw (2.5609,5.2405) -- (2.4428,5.0793);
\draw (2.6792,5.2405) -- (2.5611,5.0793);
\draw (2.7975,5.2405) -- (2.6794,5.0793);
\draw (6.1885,6.7461) -- (6.3924,6.4168) -- (5.9690,6.4168) -- (6.1885,6.7461);
\draw(4.5091,6.7461) -- (4.1798,6.2756) -- (4.5248,6.2700) -- (4.1798,5.8992) -- (4.5248,5.8992) -- (4.1798,5.5709) -- (4.5248,5.5698) -- (4.1798,5.2405) -- (4.5248,5.2405);
\draw (4.1798,5.2405) -- (4.0617,5.0793);
\draw (4.2981,5.2405) -- (4.1800,5.0793);
\draw (4.4164,5.2405) -- (4.2983,5.0793);
\draw (4.5347,5.2405) -- (4.4166,5.0793);
\draw (0.9840,6.7461) -- (6.1885,6.7461);
\end{tikzpicture}
\end{document}



