-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTikZPatterns.tex
72 lines (36 loc) · 1.62 KB
/
TikZPatterns.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
\documentclass[a4paper]{article}
%%TikZ Begin - for diagrams
\usepackage{pgf}
\usepackage{tikz}
\title{Example Usage}
\begin{document}
\maketitle
\begin{figure}[h]%
\centering
\begin{tikzpicture}
%% Shapes are always 2x their defined size value, I.e. a \TikZValveSize = 0.5 leads to a total valve height of 1
%% The default setting for elements is to have a span of ``1'' across the connecting sides.
%% elements can be rotated using the ``rotate around={angle:(point)}'' keyword, use in 90 degree steps is advised
%% While the rotate option may be inconvenient, it avoids the clutter of requiring multiples of every shape
\def\TikZValveSize{0.5}
\def\TikZPumpSize{0.5} %%% helper value for ``base'' 0.3
\def\TikZValve{%
++(-\TikZValveSize/2,\TikZValveSize) -- ++(\TikZValveSize,0) -- ++(-\TikZValveSize,-2*\TikZValveSize) -- ++(\TikZValveSize,0) -- cycle
}
\def\TikZThreeWayValve{%
-- ++(-\TikZValveSize/2*1,\TikZValveSize) -- ++(\TikZValveSize,0) -- ++(-\TikZValveSize,-2*\TikZValveSize) -- ++(\TikZValveSize,0) -- ++(-\TikZValveSize/2,\TikZValveSize) %
-- ++(\TikZValveSize,\TikZValveSize/2) -- ++(0,-\TikZValveSize) -- ++(-\TikZValveSize,\TikZValveSize/2) %-- cycle
}
\def\TikZPump{%
circle (\TikZPumpSize)
++(-\TikZPumpSize,-\TikZPumpSize) ++(\TikZPumpSize*0.3,\TikZPumpSize*0.3)
-- ++(-\TikZPumpSize*0.3,-\TikZPumpSize*0.3) -- ++(2*\TikZPumpSize,0) -- ++(-\TikZPumpSize*0.3,\TikZPumpSize*0.3)
}
%% Example Use
\draw (1,1) \TikZValve ;
\draw (3,1) \TikZThreeWayValve ;
\draw[rotate around={90:(5,1)}] (5,1) \TikZThreeWayValve ;
\draw (7,1) \TikZPump ;
\end{tikzpicture}
\end{figure}
\end{document}