summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/pfdicons/pfdicons.sty
blob: 7afe7d8a222b13a80c8f87b67d76c155e6a50948 (plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
% ==============================================================
% pfdicons.sty
% Copyright 2021 Aaron Drews
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status “maintained”.
% 
% The Current Maintainer of this work is Aaron Drews.
%
% This work consists of the files pig.dtx and pig.ins
% and the derived file pig.sty.



\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{pfdicons}[2021/07/23 PFD Icons package, v1.0]

\RequirePackage{tikz}
\RequirePackage{ifthen}

\usetikzlibrary{positioning}
\usetikzlibrary{spath3}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{shapes}
\usetikzlibrary{intersections}


% ========= CUSTOM KEYS ==========
\pgfkeys{/tikz/unit int/.initial = empty}
\pgfkeys{/tikz/unit ext/.initial = none}


% ========= CUSTOM SHAPES ==========
\makeatletter

% ==============================================================
% tube reactor
% ==============================================================
\pgfdeclareshape{tube reactor}{
	% A horizontal rectangle with curved endcaps
	% Shape approved by kiwi
	
	% Saved anchors
	\savedanchor{\bottomleft}{\pgfpoint{-4mm}{-3mm}}
	\savedanchor{\topright}{\pgfpoint{4mm}{3mm}}
	\savedanchor{\farleft}{\pgfpoint{-6mm}{0mm}}
	
	% Normal anchors
	\anchor{center}{\pgfpointorigin}
	\anchor{north}{\topright \pgf@x=0mm}
	\anchor{south}{\bottomleft \pgf@x=0mm}
	\anchor{east}{\farleft \pgf@x=-\pgf@x}
	\anchor{west}{\farleft}
	\anchor{south west}{\bottomleft}
	\anchor{north east}{\topright}
	\anchor{north west}{\topright \pgf@x=-\pgf@x}
	\anchor{south east}{\topright \pgf@y=-\pgf@y}
	\anchor{north north east}{\pgfpoint{3mm}{3mm}}
	\anchor{north north west}{\pgfpoint{-3mm}{3mm}}
	\anchor{south south east}{\pgfpoint{3mm}{-3mm}}
	\anchor{south south west}{\pgfpoint{-3mm}{-3mm}}
	\anchor{east north east}{\pgfpointadd{\pgfpoint{4mm}{0mm}}{\pgfpointpolar{45}{2mm and 3mm}}}
	\anchor{east south east}{\pgfpointadd{\pgfpoint{4mm}{0mm}}{\pgfpointpolar{-45}{2mm and 3mm}}}
	\anchor{west north west}{\pgfpointadd{\pgfpoint{-4mm}{0mm}}{\pgfpointpolar{135}{2mm and 3mm}}}
	\anchor{west south west}{\pgfpointadd{\pgfpoint{-4mm}{0mm}}{\pgfpointpolar{225}{2mm and 3mm}}}
	
	% Special anchors (only useful for certain key=value pairs)
	\anchor{west shell}{\pgfpoint{-3mm}{4mm}}
	\anchor{east shell}{\pgfpoint{3mm}{4mm}}
	\anchor{north shell}{\pgfpoint{-3mm}{4mm}}
	\anchor{south shell}{\pgfpoint{3mm}{-4mm}}
	
	% Draw it
	\backgroundpath{		
		% Main rectangle
		\pgfpathmoveto{\topright}
		\pgfpatharc{90}{-90}{2mm and 3mm}
		\pgfpathlineto{\bottomleft}
		\pgfpatharc{270}{90}{2mm and 3mm}		
		\pgfpathclose
		\pgfsetroundjoin
		\pgfsetroundcap
	}
	\foregroundpath{	
		% Fills based on unit int variable	
		
		% unit int=packed (yields "X" symbol)
		\ifthenelse{\equal{packed}{\pgfkeysvalueof{/tikz/unit int}}}
		{\pgfpathmoveto{\topright}		
			\pgfpathlineto{\bottomleft}
			\pgfpathlineto{\bottomleft \pgf@y=-\pgf@y}
			\pgfpathlineto{\topright \pgf@y=-\pgf@y}
			\pgfpathclose
		}{}
		
		% unit int=fixed (yields diagonal lines)
		\ifthenelse{\equal{fixed}{\pgfkeysvalueof{/tikz/unit int}}}
		{	\pgfpathmoveto{\topright}
			\pgfpathlineto{\topright \pgf@y=-\pgf@y}
			\pgfpathmoveto{\bottomleft}
			\pgfpathlineto{\bottomleft \pgf@y=-\pgf@y}
			
			\foreach \xOne/\yOne/\xTwo/\yTwo in
			{	-4mm/1mm/-2mm/3mm, 
				-4mm/-1mm/0mm/3mm,
				-4mm/-3mm/2mm/3mm,
				-2mm/-3mm/4mm/3mm,
				0mm/-3mm/4mm/1mm,
				2mm/-3mm/4mm/-1mm
			}
			{\pgfpathmoveto{\pgfpoint{\xOne}{\yOne}}
				\pgfpathlineto{\pgfpoint{\xTwo}{\yTwo}}}
		}{}
		
		% unit int=tubular (yields horizontal lines)
		\ifthenelse{\equal{tubular}{\pgfkeysvalueof{/tikz/unit int}}}
		{	\pgfpathmoveto{\topright}
			\pgfpathlineto{\topright \pgf@y=-\pgf@y}
			\pgfpathmoveto{\bottomleft}
			\pgfpathlineto{\bottomleft \pgf@y=-\pgf@y}
			
			\foreach \y in
			{2mm, 1mm, 0mm, -1mm, -2mm} % also west/left
			{\pgfpathmoveto{\pgfpoint{-4mm}{\y}}
				\pgfpathlineto{\pgfpoint{4mm}{\y}}}		
		}{}
		
		% unit ext=cis shell (yields utility stems, both on north side)
		\ifthenelse{\equal{cis shell}{\pgfkeysvalueof{/tikz/unit ext}}}
		{	\pgfpathrectanglecorners{\pgfpoint{-3.5mm}{3mm}}{\pgfpoint{-2.5mm}{4mm}}
			\pgfpathrectanglecorners{\pgfpoint{2.5mm}{4mm}}{\pgfpoint{3.5mm}{3mm}}	
			\pgfpathmoveto{\pgfpoint{-3.8mm}{4mm}}
			\pgfpathlineto{\pgfpoint{-2.2mm}{4mm}}
			\pgfpathmoveto{\pgfpoint{2.2mm}{4mm}}
			\pgfpathlineto{\pgfpoint{3.8mm}{4mm}}
		}{}
	
		% unit ext=trans shell (yields utility stems, one on north and one on south)
		\ifthenelse{\equal{trans shell}{\pgfkeysvalueof{/tikz/unit ext}}}
		{	\pgfpathrectanglecorners{\pgfpoint{-3.5mm}{3mm}}{\pgfpoint{-2.5mm}{4mm}}
			\pgfpathrectanglecorners{\pgfpoint{2.5mm}{-4mm}}{\pgfpoint{3.5mm}{-3mm}}	
			\pgfpathmoveto{\pgfpoint{-3.8mm}{4mm}}
			\pgfpathlineto{\pgfpoint{-2.2mm}{4mm}}
			\pgfpathmoveto{\pgfpoint{2.2mm}{-4mm}}
			\pgfpathlineto{\pgfpoint{3.8mm}{-4mm}}
		}{}
	}
}


% ==============================================================
% tank reactor
% ==============================================================
\pgfdeclareshape{tank reactor}{
	% A squat tank with a mixer and jacket
	
	% Saved anchors
	\savedanchor{\bottomleft}{\pgfpoint{-4mm}{-5mm}}
	\savedanchor{\topright}{\pgfpoint{4mm}{2mm}}
	\savedanchor{\bottom}{\pgfpoint{0mm}{-7mm}}
	\savedanchor{\top}{\pgfpoint{0mm}{4mm}}
	
%	\ifthenelse{\equal{lower jacket}{\pgfkeysvalueof{/tikz/unit ext}}\OR
%				\equal{none}{\pgfkeysvalueof{/tikz/unit ext}} }
%	{% default (none) or unit ext=lower jacket
%	\savedanchor{\westjacket}{\pgfpoint{-5mm}{-4mm}}
%	}
%	{% unit ext=side jacket (or anything else)
%	\savedanchor{\westjacket}{\pgfpoint{-5mm}{-1.5mm}}
%	}

	\savedanchor{\westjacket}{
		\pgf@x=-5mm
		\ifthenelse{\equal{lower jacket}{\pgfkeysvalueof{/tikz/unit ext}}\OR
			\equal{none}{\pgfkeysvalueof{/tikz/unit ext}} }
		{\pgf@y=-4mm} % lower jacket or default
		{\pgf@y=-1.5mm} % side jacket or anything else
	} 
	
	% Normal anchors
	\anchor{center}{\pgfpointorigin}
	\anchor{north}{\top}
	\anchor{south}{\bottom}
	\anchor{east}{\topright \pgf@y=0mm}
	\anchor{west}{\bottomleft \pgf@y=0mm}
	\anchor{south west}{\bottomleft}
	\anchor{north east}{\topright}
	\anchor{north west}{\topright \pgf@x=-\pgf@x}
	\anchor{south east}{\bottomleft \pgf@x=-\pgf@x}
	\anchor{north north east}{\pgfpointadd{\pgfpoint{0mm}{2mm}}{\pgfpointpolar{45}{4mm and 2mm}}}
	\anchor{north north west}{\pgfpointadd{\pgfpoint{0mm}{2mm}}{\pgfpointpolar{135}{4mm and 2mm}}}
	\anchor{west south west}{\pgfpoint{-4mm}{-3mm}}
	\anchor{south south west}{\pgfpointadd{\pgfpoint{0mm}{-5mm}}{\pgfpointpolar{225}{4mm and 2mm}}}
	\anchor{south south east}{\pgfpointadd{\pgfpoint{0mm}{-5mm}}{\pgfpointpolar{315}{4mm and 2mm}}}
	\anchor{east south east}{\pgfpoint{4mm}{-3mm}}
	
	% Special anchors
	% east/west jacket points move but north/south do not (they're essentially undefined for lower jacket but the definitions are retained to avoid errors)
	\anchor{west jacket}{\westjacket}
	\anchor{east jacket}{\westjacket \pgf@x=-\pgf@x}
	\anchor{north west jacket}{\pgfpoint{-5mm}{1mm}}
	\anchor{south west jacket}{\pgfpoint{-5mm}{-4mm}}
	\anchor{north east jacket}{\pgfpoint{5mm}{1mm}}
	\anchor{south east jacket}{\pgfpoint{5mm}{-4mm}}
	\anchor{north motor}{\pgfpoint{0mm}{6.8mm}}
	\anchor{west motor}{\pgfpoint{-1mm}{6.15mm}}
	\anchor{east motor}{\pgfpoint{1mm}{6.15mm}}
	
	% Draw it
	\backgroundpath{		
		% Main rectangle
		\pgfpathmoveto{\topright}
		\pgfpatharc{0}{180}{4mm and 2mm}
		\pgfpathlineto{\bottomleft}
		\pgfpatharc{180}{360}{4mm and 2mm}		
		\pgfpathclose
		\pgfsetroundjoin
		\pgfsetroundcap
		
	}
	\foregroundpath{	
		% Fills based on unit int variable	
		
		% unit int=stirred (yields stirrer with motor)
		\ifthenelse{\equal{stirred}{\pgfkeysvalueof{/tikz/unit int}}}
		{	% Motor:
			\pgfpathmoveto{\pgfpoint{-1mm}{5.5mm}}
			\pgfpathlineto{\pgfpoint{-1mm}{6.8mm}}
			\pgfpathlineto{\pgfpoint{1mm}{6.8mm}}
			\pgfpathlineto{\pgfpoint{1mm}{5.5mm}}
			\pgfpathlineto{\pgfpoint{0.6mm}{5mm}}
			\pgfpathlineto{\pgfpoint{-0.6mm}{5mm}}
			\pgfpathclose
			\pgfpathmoveto{\pgfpoint{-1mm}{5.5mm}}
			\pgfpathlineto{\pgfpoint{1mm}{5.5mm}}
			
			% Shaft and mixer: squared
			\pgfpathmoveto{\pgfpoint{0mm}{5mm}}
			\pgfpathlineto{\pgfpoint{0mm}{-4mm}}
			\pgfpathmoveto{\pgfpoint{-1.5mm}{-4mm}}
			\pgfpathlineto{\pgfpoint{1.5mm}{-4mm}}
			\pgfpathrectanglecorners{\pgfpoint{-1.5mm}{-4.8mm}}{\pgfpoint{-2mm}{-3.2mm}}
			\pgfpathrectanglecorners{\pgfpoint{1.5mm}{-4.8mm}}{\pgfpoint{2mm}{-3.2mm}}
		
			% Shaft and mixer: rounded (removed because I thought squared looked better)
%			\pgfpathmoveto{\pgfpoint{0mm}{5mm}}
%			\pgfpathlineto{\pgfpoint{0mm}{-4mm}}
%			\pgfpathlineto{\pgfpoint{1.5mm}{-3.25mm}}
%			\pgfpatharc{90}{-90}{0.75mm}
%			\pgfpathlineto{\pgfpoint{-1.5mm}{-3.25mm}}
%			\pgfpatharc{90}{270}{0.75mm}		
%			\pgfpathlineto{\pgfpoint{0mm}{-4mm}}
		}{}
		
			
		% unit int=liquid (liquid indicator from west to east)
		\ifthenelse{\equal{liquid}{\pgfkeysvalueof{/tikz/unit int}}}
		{	% Use arcs because they scale more easily (see note in VESSEL shape)
			\pgfpathmoveto{\pgfpoint{-4mm}{0mm}}
			\foreach \x in {-2.4mm,-0.8mm,...,4mm}{ 
				\pgfpatharcto{1.6mm}{5mm}{0}{0}{1}{\pgfpoint{\x}{0mm}}
			}
		}{}
	
	
		% unit int=stirred liquid (yields stirrer with motor and liquid level)
		\ifthenelse{\equal{stirred liquid}{\pgfkeysvalueof{/tikz/unit int}}}
		{	% Motor:
			\pgfpathmoveto{\pgfpoint{-1mm}{5.5mm}}
			\pgfpathlineto{\pgfpoint{-1mm}{6.8mm}}
			\pgfpathlineto{\pgfpoint{1mm}{6.8mm}}
			\pgfpathlineto{\pgfpoint{1mm}{5.5mm}}
			\pgfpathlineto{\pgfpoint{0.6mm}{5mm}}
			\pgfpathlineto{\pgfpoint{-0.6mm}{5mm}}
			\pgfpathclose
			\pgfpathmoveto{\pgfpoint{-1mm}{5.5mm}}
			\pgfpathlineto{\pgfpoint{1mm}{5.5mm}}
			
			% Shaft and mixer:
			\pgfpathmoveto{\pgfpoint{0mm}{5mm}}
			\pgfpathlineto{\pgfpoint{0mm}{-4mm}}
			\pgfpathmoveto{\pgfpoint{-1.5mm}{-4mm}}
			\pgfpathlineto{\pgfpoint{1.5mm}{-4mm}}
			\pgfpathrectanglecorners{\pgfpoint{-1.5mm}{-4.8mm}}{\pgfpoint{-2mm}{-3.2mm}}
			\pgfpathrectanglecorners{\pgfpoint{1.5mm}{-4.8mm}}{\pgfpoint{2mm}{-3.2mm}}
			
			% Use arcs because they scale more easily (see note in VESSEL shape)
			\pgfpathmoveto{\pgfpoint{-4mm}{0mm}}
			\foreach \x in {-2.4mm,-0.8mm,...,4mm}{ 
				\pgfpatharcto{1.6mm}{5mm}{0}{0}{1}{\pgfpoint{\x}{0mm}}
			}
		}{}
	
	
		% unit ext=lower jacket (yields jacket on lower portion)
		\ifthenelse{\equal{lower jacket}{\pgfkeysvalueof{/tikz/unit ext}}}
		{	\pgfpathmoveto{\pgfpoint{-4mm}{-2mm}}
			\pgfpathlineto{\pgfpoint{-5mm}{-2.5mm}}
			\pgfpathlineto{\pgfpoint{-5mm}{-5mm}}
			\pgfpatharc{180}{360}{5mm and 3mm}
			\pgfpathlineto{\pgfpoint{5mm}{-2.5mm}}
			\pgfpathlineto{\pgfpoint{4mm}{-2mm}}
			
			\pgfpathlineto{\bottomleft \pgf@x=-\pgf@x}
			\pgfpatharc{0}{-180}{4mm and 2mm}
			\pgfpathclose
		}{}
	
		% unit ext=side jacket (yields jacket sides)
		\ifthenelse{\equal{side jacket}{\pgfkeysvalueof{/tikz/unit ext}}}
		{	\pgfpathmoveto{\pgfpoint{-4mm}{-5mm}}
			\pgfpathlineto{\pgfpoint{-5mm}{-4.5mm}}
			\pgfpathlineto{\pgfpoint{-5mm}{1.5mm}}
			\pgfpathlineto{\pgfpoint{-4mm}{2mm}}
			\pgfpathclose
			
			\pgfpathmoveto{\pgfpoint{4mm}{-5mm}}
			\pgfpathlineto{\pgfpoint{5mm}{-4.5mm}}
			\pgfpathlineto{\pgfpoint{5mm}{1.5mm}}
			\pgfpathlineto{\pgfpoint{4mm}{2mm}}
			\pgfpathclose
		}{}
		
	}
}


% ==============================================================
% Column
% ==============================================================
\pgfkeys{/tikz/top tray/.initial = none}
\pgfkeys{/tikz/feed tray/.initial = none}
\pgfkeys{/tikz/bottom tray/.initial = none}
\pgfdeclareshape{column}{
	% A vertical rectangle with curved endcaps
	
	% Saved anchors
	\savedanchor{\bottomleft}{\pgfpoint{-3mm}{-12mm}}
	\savedanchor{\topright}{\pgfpoint{3mm}{12mm}}
	\savedanchor{\farnorth}{\pgfpoint{0mm}{14mm}}
	
	% The distillate and bottoms anchors move based on whether the column has simple heat exchangers or not. They're stored as saved anchors so that they don't move when subsequent columns are placed.
	\savedanchor{\distillate}{
		\pgf@y=12mm
		\ifthenelse{\equal{simple hx}{\pgfkeysvalueof{/tikz/unit ext}}}
		{\pgf@x=6mm} % simple hx
		{\pgf@x=3mm} % anything else (same as north east)
	} 
	\savedanchor{\bottoms}{
		\ifthenelse{\equal{simple hx}{\pgfkeysvalueof{/tikz/unit ext}}}
		{\pgf@x=6mm % simple hx
			\pgf@y=-18mm} 
		{\pgf@x=3mm % anything else (same as south east)
			\pgf@y=-12mm} 
	} 
	
	% Normal anchors
	\anchor{center}{\pgfpointorigin}
	\anchor{north}{\farnorth}
	\anchor{south}{\farnorth \pgf@y=-\pgf@y}
	\anchor{east}{\topright \pgf@y=0mm}
	\anchor{west}{\bottomleft \pgf@y=0mm}
	\anchor{south west}{\bottomleft}
	\anchor{north east}{\topright}
	\anchor{north west}{\topright \pgf@x=-\pgf@x}
	\anchor{south east}{\topright \pgf@y=-\pgf@y}
	\anchor{west north west}{\pgfpoint{-3mm}{7mm}}
	\anchor{east north east}{\pgfpoint{3mm}{7mm}}
	\anchor{west south west}{\pgfpoint{-3mm}{-7mm}}
	\anchor{east south east}{\pgfpoint{3mm}{-7mm}}
	\anchor{south south east}{\pgfpointadd{\pgfpoint{0mm}{-12mm}}{\pgfpointpolar{315}{3mm and 2mm}}}
	\anchor{south south west}{\pgfpointadd{\pgfpoint{0mm}{-12mm}}{\pgfpointpolar{225}{3mm and 2mm}}}
	\anchor{north north east}{\pgfpointadd{\pgfpoint{0mm}{12mm}}{\pgfpointpolar{45}{3mm and 2mm}}}
	\anchor{north north west}{\pgfpointadd{\pgfpoint{0mm}{12mm}}{\pgfpointpolar{135}{3mm and 2mm}}}
	
	
	% Special anchors
	\anchor{distillate}{\distillate} % distillate product
	\anchor{bottoms}{\bottoms} % bottoms product
	\anchor{feed tray}{\pgfpoint{0mm}{0mm}} % feed tray label anchor
	\anchor{top tray}{\pgfpoint{0mm}{10mm}} % top tray label anchor
	\anchor{bottom tray}{\pgfpoint{0mm}{-10mm}} % bottom tray label anchor
	
	% Draw it
	\backgroundpath{		
		% Main rectangle
		\pgfpathmoveto{\bottomleft \pgf@x=-\pgf@x}
		\pgfpatharc{0}{-180}{3mm and 2mm}
		\pgfpathlineto{\bottomleft \pgf@y=-\pgf@y}
		\pgfpatharc{180}{0}{3mm and 2mm}		
		\pgfpathclose
		\pgfsetroundjoin
		\pgfsetroundcap
		
	}
	\foregroundpath{
		% Fills based on unit int variable
		
		% unit int=tray OR dashed tray (yields horizontal, dashed lines)
		% I didn't like how \pgfsetdash changed when drawings were scaled so I drew the lines manually to always have two openings
		\ifthenelse{\equal{tray}{\pgfkeysvalueof{/tikz/unit int}}\OR
			\equal{dashed tray}{\pgfkeysvalueof{/tikz/unit int}}}
		{	%\pgfsetdash{{1.333mm}{1mm}}{0mm}
			\foreach \y in {10mm,8mm,...,-12mm} % also west/left
			{\pgfpathmoveto{\pgfpoint{-3mm}{\y}}
				\pgfpathlineto{\pgfpoint{-1.6mm}{\y}}
				\pgfpathmoveto{\pgfpoint{-0.6mm}{\y}}
				\pgfpathlineto{\pgfpoint{0.6mm}{\y}}
				\pgfpathmoveto{\pgfpoint{1.6mm}{\y}}
				\pgfpathlineto{\pgfpoint{3mm}{\y}}}			
			\pgfsetroundjoin
		}{}
		
		% unit int=weir tray (yields trays which alternate sides with small 
		%weirs)
		\ifthenelse{\equal{weir tray}{\pgfkeysvalueof{/tikz/unit int}}}
		{\foreach \y in {8mm,4mm,...,-12mm}
			{\pgfpathmoveto{\pgfpoint{-3mm}{\y}}
				\pgfpathlineto{\pgfpoint{1.5mm}{\y}}
				\pgfpathlineto{\pgfpointadd{\pgfpoint{1.5mm}{\y}}{\pgfpoint{0mm}{0.6mm}}}
			}
			\foreach \y in {10mm,6mm,...,-12mm} 
			{\pgfpathmoveto{\pgfpoint{3mm}{\y}}
				\pgfpathlineto{\pgfpoint{-1.5mm}{\y}}
				\pgfpathlineto{\pgfpointadd{\pgfpoint{-1.5mm}{\y}}{\pgfpoint{0mm}{0.6mm}}}
			}				
			\pgfsetroundjoin
		}{}
		
		
		% unit int=numbered tray (yields horizontal, dashed lines at bottom, 
		%middle, top only)
		\ifthenelse{\equal{numbered tray}{\pgfkeysvalueof{/tikz/unit int}}}
		{	\foreach \y in {10mm,0mm,-10mm} % also west/left
			{\pgfpathmoveto{\pgfpoint{-3mm}{\y}}
				\pgfpathlineto{\pgfpoint{-1.6mm}{\y}}
				\pgfpathmoveto{\pgfpoint{-0.6mm}{\y}}
				\pgfpathlineto{\pgfpoint{0.6mm}{\y}}
				\pgfpathmoveto{\pgfpoint{1.6mm}{\y}}
				\pgfpathlineto{\pgfpoint{3mm}{\y}}}						
			\pgfsetroundjoin

		}{}		
		% Add text if unit int=numbered tray and numbers given
		\ifthenelse{ % top tray
			\equal{numbered tray}{\pgfkeysvalueof{/tikz/unit int}}\AND
			\NOT\equal{none}{\pgfkeysvalueof{/tikz/top tray}}
		}{\pgftext[bottom, at={\pgfpoint{0mm}{10mm}}, y=1pt] {\footnotesize \pgfkeysvalueof{/tikz/top tray}}}
		{}
		\ifthenelse{ % feed tray
			\equal{numbered tray}{\pgfkeysvalueof{/tikz/unit int}}\AND
			\NOT\equal{none}{\pgfkeysvalueof{/tikz/feed tray}}
		}{\pgftext[bottom, y=1pt] {\footnotesize \pgfkeysvalueof{/tikz/feed tray}}}
		{}
		\ifthenelse{ % bottom tray
			\equal{numbered tray}{\pgfkeysvalueof{/tikz/unit int}}\AND
			\NOT\equal{none}{\pgfkeysvalueof{/tikz/bottom tray}}
		}{\pgftext[bottom, at={\pgfpoint{0mm}{-10mm}}, y=1pt] {\footnotesize \pgfkeysvalueof{/tikz/bottom tray}}}
		{}
		
		
		% unit int=packed (yields X)
		\ifthenelse{\equal{packed}{\pgfkeysvalueof{/tikz/unit int}}}
		{	\pgfpathmoveto{\pgfpoint{-3mm}{-10mm}}
			\pgfpathlineto{\pgfpoint{3mm}{10mm}}
			\pgfpathlineto{\pgfpoint{-3mm}{10mm}}
			\pgfpathlineto{\pgfpoint{3mm}{-10mm}}
			\pgfpathclose
			\pgfsetroundjoin
		}{}
	
	
		% unit int= double packed (yields two X segments)
		\ifthenelse{\equal{double packed}{\pgfkeysvalueof{/tikz/unit int}}}
		{	\pgfpathmoveto{\pgfpoint{-3mm}{10mm}}
			\pgfpathlineto{\pgfpoint{3mm}{10mm}}
			\pgfpathlineto{\pgfpoint{-3mm}{1mm}}
			\pgfpathlineto{\pgfpoint{3mm}{1mm}}
			\pgfpathclose
			
			\pgfpathmoveto{\pgfpoint{-3mm}{-1mm}}
			\pgfpathlineto{\pgfpoint{3mm}{-1mm}}
			\pgfpathlineto{\pgfpoint{-3mm}{-10mm}}
			\pgfpathlineto{\pgfpoint{3mm}{-10mm}}
			\pgfpathclose
			\pgfsetroundjoin
		}{}				
	
		% Exterior add-ons based on unit ext variable
		% unit ext=simple hx (gives simple circles for condenser, reboiler)
		% To prevent the interiors from being filled the "pen" has to be moved after *each* straight line segment, which is why there are seeming duplicates of \pgfpathmoveto for this key. 
		\ifthenelse{\equal{simple hx}{\pgfkeysvalueof{/tikz/unit ext}}}
		{	\pgfpathmoveto{\farnorth}
			\pgfpathlineto{\pgfpoint{0mm}{18mm}}
			\pgfpathmoveto{\pgfpoint{0mm}{18mm}} % pen up
			\pgfpathlineto{\pgfpoint{6mm}{18mm}}
			\pgfpathmoveto{\pgfpoint{6mm}{18mm}} % pen up
			\pgfpathlineto{\pgfpoint{6mm}{16mm}}
			\pgfpathmoveto{\pgfpoint{6mm}{14mm}} % pen up
			\pgfpathlineto{\pgfpoint{6mm}{12mm}}
			\pgfpathmoveto{\pgfpoint{6mm}{12mm}} % pen up
			\pgfpathlineto{\pgfpoint{3mm}{12mm}}
			\pgfpathmoveto{\pgfpoint{3mm}{12mm}} % pen up
			\pgfpathcircle{\pgfpoint{6mm}{15mm}}{1mm}
			
			\pgfpathmoveto{\farnorth \pgf@y=-\pgf@y}
			\pgfpathlineto{\pgfpoint{0mm}{-18mm}}
			\pgfpathmoveto{\pgfpoint{0mm}{-18mm}} % pen up
			\pgfpathlineto{\pgfpoint{6mm}{-18mm}}
			\pgfpathmoveto{\pgfpoint{6mm}{-18mm}} % pen up
			\pgfpathlineto{\pgfpoint{6mm}{-16mm}}
			\pgfpathmoveto{\pgfpoint{6mm}{-14mm}}
			\pgfpathlineto{\pgfpoint{6mm}{-12mm}}
			\pgfpathmoveto{\pgfpoint{6mm}{-12mm}} % pen up
			\pgfpathlineto{\pgfpoint{3mm}{-12mm}}
			\pgfpathmoveto{\pgfpoint{3mm}{-12mm}} % pen up
			\pgfpathcircle{\pgfpoint{6mm}{-15mm}}{1mm}
			\pgfsetroundjoin
		}{}	
	}
}

% ==============================================================
% Basic Heat Exchanger
% ==============================================================
\pgfdeclareshape{basic hx}{
	% Circular hx with straight or U-tube pipes, stems optional
	% Saved anchors
	\savedanchor{\center}{\pgfpointorigin}
	\savedanchor{\north}{\pgfpoint{0mm}{3mm}}
	\savedanchor{\east}{\pgfpoint{3mm}{0mm}}
	\savedanchor{\northeast}{\pgfpointpolar{45}{3mm}}
	
	% Normal anchors
	\anchor{center}{\center}
	\anchor{east}{\east}
	\anchor{north east}{\northeast}
	\anchor{north}{\north}
	\anchor{north west}{\northeast \pgf@x=-\pgf@x}
	\anchor{west}{\east \pgf@x=-\pgf@x}
	\anchor{south west}{\northeast \pgf@x=-\pgf@x \pgf@y=-\pgf@y}
	\anchor{south}{\north \pgf@y=-\pgf@y}
	\anchor{south east}{\northeast \pgf@y=-\pgf@y}
	
	% Special anchors (only useful for certain key=value pairs)
	\anchor{north util}{\pgfpoint{0mm}{5mm}}
	\anchor{south util}{\pgfpoint{0mm}{-5mm}}
	\anchor{east util}{\pgfpointadd
		{\northeast \pgf@y=-\pgf@y}
		{\pgfpoint{0mm}{-2mm}}
	}
	\anchor{west util}{
		\pgfpointadd
		{\northeast \pgf@y=-\pgf@y \pgf@x=-\pgf@x}
		{\pgfpoint{0mm}{-2mm}}
	}
	
	% Draw it
	\backgroundpath{		
		% Main circle = 3mm
		\pgfpathcircle{\pgfpointorigin}{3mm}
		\pgfsetroundjoin
		\pgfsetroundcap
	}
	\foregroundpath{	
		% Fills based on unit int variable
		% Straight-thru	
		\ifthenelse{\equal{straight}{\pgfkeysvalueof{/tikz/unit int}}\OR
			\equal{empty}{\pgfkeysvalueof{/tikz/unit int}}}
		{	\pgfpathmoveto{\pgfpoint{0mm}{-3mm}}
			\pgfpathlineto{\pgfpoint{-2mm}{-1mm}}
			\pgfpathlineto{\pgfpoint{2mm}{1mm}}
			\pgfpathlineto{\pgfpoint{0mm}{3mm}} 			
		}{}
		
		% U-tube
		\ifthenelse{\equal{U tube}{\pgfkeysvalueof{/tikz/unit int}}}
		{	\pgfpathmoveto{\northeast \pgf@x=-\pgf@x \pgf@y=-\pgf@y} 
			\pgfpathlineto{\northeast \pgf@x=-\pgf@x \pgf@y=1mm}
			\pgfpathlineto{\pgfpoint{0mm}{-1mm}}
			\pgfpathlineto{\northeast \pgf@y=1mm}
			\pgfpathlineto{\northeast \pgf@y=-\pgf@y} 			
		}{}
		
		% Stems based on both unit int and unit ext
		% Straight util
		\ifthenelse{{\equal{straight}{\pgfkeysvalueof{/tikz/unit int}}}\OR
			{\equal{empty}{\pgfkeysvalueof{/tikz/unit int}}}
			\AND
			\equal{util}{\pgfkeysvalueof{/tikz/unit ext}}}
		{	\pgfpathmoveto{\pgfpoint{0mm}{-5mm}}
			\pgfpathlineto{\pgfpoint{0mm}{-3mm}}
			\pgfpathmoveto{\pgfpoint{0mm}{3mm}}
			\pgfpathlineto{\pgfpoint{0mm}{5mm}}			
		}{}
		
		% U-tube util
		\ifthenelse{\equal{U tube}{\pgfkeysvalueof{/tikz/unit int}}\AND
			\equal{util}{\pgfkeysvalueof{/tikz/unit ext}}}
		{	\pgfpathmoveto{\northeast \pgf@x=-\pgf@x \pgf@y=-\pgf@y}
			\pgfpathlineto{\pgfpointadd
				{\northeast \pgf@x=-\pgf@x \pgf@y=-\pgf@y}
				{\pgfpoint{0mm}{-2mm}}
			}
			\pgfpathmoveto{\northeast \pgf@y=-\pgf@y} % 2.236 = sqrt(5) 
			\pgfpathlineto{\pgfpointadd
				{\northeast \pgf@y=-\pgf@y}
				{\pgfpoint{0mm}{-2mm}}
			}			
		}{}
	}
}


% ==============================================================
% Fired heat exchanger
% ==============================================================
\pgfdeclareshape{fired hx}{
	% Box with chimney, flame, and through tube
	% Three unit int keys--single, double, or triple--for process tubes
	
	% Saved anchors
	\savedanchor{\chimneynorth}{\pgfpoint{1mm}{11mm}}
	\savedanchor{\chimneysouth}{\pgfpoint{1mm}{7mm}}
	\savedanchor{\northeast}{\pgfpoint{5mm}{4mm}}
	\savedanchor{\southwest}{\pgfpoint{-5mm}{-6mm}}
	
	% Normal anchors
	\anchor{center}{\pgfpointorigin}
	\anchor{east}{\northeast \pgf@y=0mm}
	\anchor{north east}{\northeast}
	\anchor{north}{\chimneynorth \pgf@x=0mm}
	\anchor{north west}{\northeast \pgf@x=-\pgf@x}
	\anchor{west}{\southwest \pgf@y=0mm}
	\anchor{south west}{\southwest}
	\anchor{south}{\southwest \pgf@x=0mm}
	\anchor{south east}{\southwest \pgf@x=-\pgf@x}
	
	% Half-cardinals which align with double/triple tubes:
	\anchor{north north east}{\pgfpoint{1mm}{9mm}}
	\anchor{north north west}{\pgfpoint{-1mm}{9mm}}
	\anchor{east north east}{\pgfpoint{5mm}{3mm}}
	\anchor{west north west}{\pgfpoint{-5mm}{3mm}}
	\anchor{east south east}{\pgfpoint{5mm}{-1mm}}
	\anchor{west south west}{\pgfpoint{-5mm}{-1mm}}
	
	% Remaining half-cardinals distributed across base
	\anchor{south south east}{\pgfpoint{3mm}{-6mm}}
	\anchor{south south west}{\pgfpoint{-3mm}{-6mm}}
	
	% Draw it			
	\backgroundpath{		
		% Main outline
		\pgfpathmoveto{\chimneynorth}
		\pgfpathlineto{\chimneysouth}
		\pgfpathlineto{\northeast}
		\pgfpathlineto{\southwest \pgf@x=-\pgf@x}
		\pgfpathlineto{\southwest}
		\pgfpathlineto{\northeast \pgf@x=-\pgf@x}
		\pgfpathlineto{\chimneysouth \pgf@x=-\pgf@x}
		\pgfpathlineto{\chimneynorth \pgf@x=-\pgf@x}
		
		\pgfsetroundjoin
		\pgfsetroundcap
	}
	\foregroundpath{	
		% Thru-tubes and burner based on unit int keys
		% Single or empty (default)
		\ifthenelse{{\equal{single}{\pgfkeysvalueof{/tikz/unit int}}}\OR
			{\equal{empty}{\pgfkeysvalueof{/tikz/unit int}}}
		}{
			\pgfpathmoveto{\southwest \pgf@y=0mm}
			\pgfpathlineto{\pgfpoint{-2mm}{0mm}}
			\pgfpathlineto{\pgfpoint{-1mm}{2mm}}
			\pgfpathlineto{\pgfpoint{1mm}{-2mm}}
			\pgfpathlineto{\pgfpoint{2mm}{0mm}}
			\pgfpathlineto{\northeast \pgf@y=0mm}
			
			% Burner
			\pgfpathmoveto{\southwest \pgf@x=0mm}
			\pgfpathlineto{\pgfpoint{0mm}{-4mm}}
			\pgfpathcircle{\pgfpoint{0mm}{-3.5mm}}{0.5mm}
		}{}
		
		% Double (two process tubes)
		\ifthenelse{\equal{double}{\pgfkeysvalueof{/tikz/unit int}}
		}{
			% Lower line
			\pgfpathmoveto{\pgfpoint{-5mm}{-1mm}}
			\pgfpathlineto{\pgfpoint{-2mm}{-1mm}}
			\pgfpathlineto{\pgfpoint{-1mm}{1mm}}
			\pgfpathlineto{\pgfpoint{1mm}{-3mm}}
			\pgfpathlineto{\pgfpoint{2mm}{-1mm}}
			\pgfpathlineto{\pgfpoint{5mm}{-1mm}}
			% Upper line
			\pgfpathmoveto{\pgfpoint{-5mm}{3mm}}
			\pgfpathlineto{\pgfpoint{-2mm}{3mm}}
			\pgfpathlineto{\pgfpoint{-1mm}{5mm}}
			\pgfpathlineto{\pgfpoint{1mm}{1mm}}
			\pgfpathlineto{\pgfpoint{2mm}{3mm}}
			\pgfpathlineto{\pgfpoint{5mm}{3mm}}
			
			% Burner
			\pgfpathmoveto{\southwest \pgf@x=0mm}
			\pgfpathlineto{\pgfpoint{0mm}{-5mm}}
			\pgfpathcircle{\pgfpoint{0mm}{-4.5mm}}{0.5mm}
		}{}
	
		% Triple (three process tubes)
		\ifthenelse{\equal{triple}{\pgfkeysvalueof{/tikz/unit int}}
		}{
			% Lower line
			\pgfpathmoveto{\pgfpoint{-5mm}{-1mm}}
			\pgfpathlineto{\pgfpoint{-2mm}{-1mm}}
			\pgfpathlineto{\pgfpoint{-1mm}{1mm}}
			\pgfpathlineto{\pgfpoint{1mm}{-3mm}}
			\pgfpathlineto{\pgfpoint{2mm}{-1mm}}
			\pgfpathlineto{\pgfpoint{5mm}{-1mm}}
			% Middle line
			\pgfpathmoveto{\pgfpoint{-5mm}{3mm}}
			\pgfpathlineto{\pgfpoint{-2mm}{3mm}}
			\pgfpathlineto{\pgfpoint{-1mm}{5mm}}
			\pgfpathlineto{\pgfpoint{1mm}{1mm}}
			\pgfpathlineto{\pgfpoint{2mm}{3mm}}
			\pgfpathlineto{\pgfpoint{5mm}{3mm}}
			% Upper line
			\pgfpathmoveto{\pgfpoint{-1mm}{9mm}}
			\pgfpathlineto{\pgfpoint{-0.5mm}{10mm}}
			\pgfpathlineto{\pgfpoint{0.5mm}{8mm}}
			\pgfpathlineto{\pgfpoint{1mm}{9mm}}
			
			% Burner
			\pgfpathmoveto{\southwest \pgf@x=0mm}
			\pgfpathlineto{\pgfpoint{0mm}{-5mm}}
			\pgfpathcircle{\pgfpoint{0mm}{-4.5mm}}{0.5mm}
		}{}
	}
}

% ==============================================================
% Shell and tube heat exchanger
% ==============================================================
\pgfdeclareshape{shell and tube hx}{
	% Box with horizontal lines for tubes
	
	% Saved anchors
	\savedanchor{\northeast}{\pgfpoint{6mm}{3mm}}
	\savedanchor{\southwest}{\pgfpoint{-6mm}{-3mm}}
	\savedanchor{\shellnortheast}{\pgfpoint{3mm}{3mm}}
	
	% Normal anchors
	\anchor{center}{\pgfpointorigin}
	\anchor{north}{\northeast \pgf@x=0mm}
	\anchor{south}{\northeast \pgf@x=0mm \pgf@y=-\pgf@y}
	\anchor{east}{\northeast \pgf@y=0mm}
	\anchor{west}{\southwest \pgf@y=0mm}
	\anchor{north east}{\pgfpoint{5mm}{3mm}}
	\anchor{south east}{\pgfpoint{5mm}{-3mm}}
	\anchor{north west}{\pgfpoint{-5mm}{3mm}}
	\anchor{south west}{\pgfpoint{-5mm}{-3mm}}
	
	\anchor{north north east}{\shellnortheast}
	\anchor{north north west}{\shellnortheast \pgf@x=-\pgf@x}
	\anchor{south south east}{\shellnortheast \pgf@y=-\pgf@y}
	\anchor{south south west}{\shellnortheast \pgf@x=-\pgf@x \pgf@y=-\pgf@y}
	\anchor{east north east}{\pgfpoint{6mm}{2mm}}
	\anchor{east south east}{\pgfpoint{6mm}{-2mm}}
	\anchor{west north west}{\pgfpoint{-6mm}{2mm}}
	\anchor{west south west}{\pgfpoint{-6mm}{-2mm}}
	
	% Special anchors	
	\anchor{west shell}{\pgfpoint{-3mm}{4mm}}
	\anchor{east shell}{\pgfpoint{3mm}{4mm}}
	\anchor{north shell}{\pgfpoint{-3mm}{4mm}}
	\anchor{south shell}{\pgfpoint{3mm}{-4mm}}
	
	% Draw it
	\backgroundpath{		
		% Main outline
		\pgfpathmoveto{\northeast}
		\pgfpathlineto{\northeast \pgf@x=-\pgf@x}
		\pgfpathlineto{\southwest}
		\pgfpathlineto{\northeast \pgf@y=-\pgf@y}
		\pgfpathclose
		
		% Vertical lines for tube sheets
		\pgfpathmoveto{\pgfpoint{-4mm}{3mm}}
		\pgfpathlineto{\pgfpoint{-4mm}{-3mm}}
		\pgfpathmoveto{\pgfpoint{4mm}{3mm}}
		\pgfpathlineto{\pgfpoint{4mm}{-3mm}}
		
		% Horizontal lines for pipes
		\foreach \y in {3mm,2mm,...,-3mm} 
		{\pgfpathmoveto{\pgfpoint{-4mm}{\y}}
			\pgfpathlineto{\pgfpoint{4mm}{\y}}}
		
		\pgfsetroundjoin
		\pgfsetroundcap
		
	}
	\foregroundpath{
	% Two pass: adds a horizontal line on shell side
	\ifthenelse{\equal{two pass}{\pgfkeysvalueof{/tikz/unit int}}
	}{
		\pgfpathmoveto{\pgfpoint{-6mm}{0mm}}
		\pgfpathlineto{\pgfpoint{-4mm}{0mm}}
	}{}

	% Four pass: adds three horizontal line on shell sides
	\ifthenelse{\equal{four pass}{\pgfkeysvalueof{/tikz/unit int}}
	}{	% east-side line
		\pgfpathmoveto{\pgfpoint{4mm}{0mm}}
		\pgfpathlineto{\pgfpoint{6mm}{0mm}}
		% west-side line, top
		\pgfpathmoveto{\pgfpoint{-6mm}{1.5mm}}
		\pgfpathlineto{\pgfpoint{-4mm}{1.5mm}}
		% west-side line, bottom
		\pgfpathmoveto{\pgfpoint{-6mm}{-1.5mm}}
		\pgfpathlineto{\pgfpoint{-4mm}{-1.5mm}}
	}{}

	% unit ext=cis shell (yields utility stems, both on north side)
	\ifthenelse{\equal{cis shell}{\pgfkeysvalueof{/tikz/unit ext}}}
	{	\pgfpathrectanglecorners{\pgfpoint{-3.5mm}{3mm}}{\pgfpoint{-2.5mm}{4mm}}
		\pgfpathrectanglecorners{\pgfpoint{2.5mm}{4mm}}{\pgfpoint{3.5mm}{3mm}}	
		\pgfpathmoveto{\pgfpoint{-3.8mm}{4mm}}
		\pgfpathlineto{\pgfpoint{-2.2mm}{4mm}}
		\pgfpathmoveto{\pgfpoint{2.2mm}{4mm}}
		\pgfpathlineto{\pgfpoint{3.8mm}{4mm}}
	}{}
	
	% unit ext=trans shell (yields utility stems, one on north and one on south)
	\ifthenelse{\equal{trans shell}{\pgfkeysvalueof{/tikz/unit ext}}}
	{	\pgfpathrectanglecorners{\pgfpoint{-3.5mm}{3mm}}{\pgfpoint{-2.5mm}{4mm}}
		\pgfpathrectanglecorners{\pgfpoint{2.5mm}{-4mm}}{\pgfpoint{3.5mm}{-3mm}}	
		\pgfpathmoveto{\pgfpoint{-3.8mm}{4mm}}
		\pgfpathlineto{\pgfpoint{-2.2mm}{4mm}}
		\pgfpathmoveto{\pgfpoint{2.2mm}{-4mm}}
		\pgfpathlineto{\pgfpoint{3.8mm}{-4mm}}
	}{}
	}
}

% ==============================================================
% Plate heat exchanger
% ==============================================================
\pgfdeclareshape{plate hx}{
	% Box with vertical lines for plates
	
	% Saved anchors
	\savedanchor{\northeast}{\pgfpoint{4mm}{3mm}}
	\savedanchor{\southwest}{\pgfpoint{-4mm}{-3mm}}
	\savedanchor{\northeastanchor}{\pgfpoint{4mm}{3mm}}
	
	% Normal anchors
	\anchor{center}{\pgfpointorigin}
	\anchor{north}{\northeast \pgf@x=0mm}
	\anchor{south}{\southwest \pgf@x=0mm}
	\anchor{east}{\northeast \pgf@y=0mm}
	\anchor{west}{\southwest \pgf@y=0mm}
	\anchor{north east}{\northeastanchor}
	\anchor{north west}{\northeastanchor \pgf@x=-\pgf@x}
	\anchor{south east}{\northeastanchor \pgf@y=-\pgf@y}
	\anchor{south west}{\northeastanchor \pgf@x=-\pgf@x \pgf@y=-\pgf@y}
	
	\anchor{north north east}{\pgfpoint{3mm}{3mm}}
	\anchor{north north west}{\pgfpoint{-3mm}{3mm}}
	\anchor{south south east}{\pgfpoint{3mm}{-3mm}}
	\anchor{south south west}{\pgfpoint{-3mm}{-3mm}}
	\anchor{east north east}{\pgfpoint{4mm}{2mm}}
	\anchor{east south east}{\pgfpoint{4mm}{-2mm}}
	\anchor{west north west}{\pgfpoint{-4mm}{2mm}}
	\anchor{west south west}{\pgfpoint{-4mm}{-2mm}}
	
	% Draw it
	\backgroundpath{		
		% Main outline
		\pgfpathmoveto{\northeast}
		\pgfpathlineto{\northeast \pgf@x=-\pgf@x}
		\pgfpathlineto{\southwest}
		\pgfpathlineto{\northeast \pgf@y=-\pgf@y}
		\pgfpathclose
		
		% Vertical lines for tube sheets
		\foreach \x in {3mm,2mm,...,-4mm} 
		{\pgfpathmoveto{\pgfpoint{\x}{-3mm}}
			\pgfpathlineto{\pgfpoint{\x}{3mm}}}
		
		\pgfsetroundjoin
		\pgfsetroundcap
	}
}

% ==============================================================
% Vessel
% ==============================================================
\pgfdeclareshape{vessel}{
	% A small cylinder for storage, flash, phase separation, etc
	
	% Saved anchors
	\savedanchor{\bottomleft}{\pgfpoint{-3mm}{-5mm}}
	\savedanchor{\topright}{\pgfpoint{3mm}{5mm}}
	\savedanchor{\top}{\pgfpoint{0mm}{7mm}}
	
	% Normal anchors
	\anchor{center}{\pgfpointorigin}
	\anchor{north}{\top}
	\anchor{south}{\top \pgf@y=-\pgf@y}
	\anchor{east}{\topright \pgf@y=0mm}
	\anchor{west}{\bottomleft \pgf@y=0mm}
	\anchor{south west}{\bottomleft}
	\anchor{north east}{\topright}
	\anchor{north west}{\topright \pgf@x=-\pgf@x}
	\anchor{south east}{\bottomleft \pgf@x=-\pgf@x}
	
	\anchor{east north east}{\pgfpoint{3mm}{3mm}}
	\anchor{east south east}{\pgfpoint{3mm}{-3mm}}
	\anchor{west north west}{\pgfpoint{-3mm}{3mm}}
	\anchor{west south west}{\pgfpoint{-3mm}{-3mm}}
	\anchor{south south east}{\pgfpointadd{\pgfpoint{0mm}{-5mm}}{\pgfpointpolar{315}{3mm and 2mm}}}
	\anchor{south south west}{\pgfpointadd{\pgfpoint{0mm}{-5mm}}{\pgfpointpolar{225}{3mm and 2mm}}}
	\anchor{north north east}{\pgfpointadd{\pgfpoint{0mm}{5mm}}{\pgfpointpolar{45}{3mm and 2mm}}}
	\anchor{north north west}{\pgfpointadd{\pgfpoint{0mm}{5mm}}{\pgfpointpolar{135}{3mm and 2mm}}}
	
	% Special anchors (only useful for unit ext=hx)
	\anchor{north hx}{\pgfpoint{5mm}{-2mm}}
	\anchor{south hx}{\pgfpoint{5mm}{-5mm}}	
	
	% Draw it
	\backgroundpath{		
		% Main tank
		\pgfpathmoveto{\topright}
		\pgfpatharc{0}{180}{3mm and 2mm}
		\pgfpathlineto{\bottomleft}
		\pgfpatharc{180}{360}{3mm and 2mm}		
		\pgfpathclose
		\pgfsetroundjoin
		\pgfsetroundcap
	}
	\foregroundpath{
		% Fills based on unit int variable	

		% unit int=liquid (liquid indicator from west to east)
		\ifthenelse{\equal{liquid}{\pgfkeysvalueof{/tikz/unit int}}}
		{	% Use arcs because they scale more easily (see note below)
			\pgfpathmoveto{\pgfpoint{-3mm}{0mm}}
			\foreach \x in {-1.5mm,0mm,...,3mm}{ 
				\pgfpatharcto{1.5mm}{5mm}{0}{0}{1}{\pgfpoint{\x}{0mm}}
			}		
			% Previously this drawing was attempted with decorations but it was hard to get the decorations to scale correctly when the shape was scaled (read: I couldn't get it to work). Thus the various arc operations above were used instead, which had the ancillary benefit of being easier to get to start and stop at specific locations.
		}{}
	
	
		% unit int=liquid rotated (liquid indicator from north to south)
		% To be used with \node[vessel, rotate=90, unit int=liquid rot] {}
		\ifthenelse{\equal{liquid rotated}{\pgfkeysvalueof{/tikz/unit int}}}
		{	% Use arcs because they scale more easily (see note below)
			\pgfpathmoveto{\pgfpoint{0mm}{7mm}}
			\foreach \y in {5mm,3mm,...,-9mm}{ 
				\pgfpatharcto{5mm}{2mm}{0}{0}{1}{\pgfpoint{0mm}{\y}}
			}	
		}{}
		
		% unit int=phase sep (demister and knock-down)
		\ifthenelse{\equal{phase sep}{\pgfkeysvalueof{/tikz/unit int}}}
		{	% knock-down
			\pgfpathmoveto{\pgfpoint{-3mm}{1mm}}
			\pgfpathlineto{\pgfpoint{-2mm}{1mm}}
			\pgfpathlineto{\pgfpoint{-1mm}{-1mm}}
			
			% demister (avoid "dashed")
			\pgfpathmoveto{\topright}
			\pgfpathlineto{\topright \pgf@x=2.1mm}
			\pgfpathmoveto{\topright \pgf@x=1.3mm}
			\pgfpathlineto{\topright \pgf@x=0.4mm}
			\pgfpathmoveto{\topright \pgf@x=-0.4mm}
			\pgfpathlineto{\topright \pgf@x=-1.3mm}
			\pgfpathmoveto{\topright \pgf@x=-2.1mm}
			\pgfpathlineto{\topright \pgf@x=-\pgf@x}
		
		}{}
				
		% unit ext=simple hx (yields hx on lower portion)
		\ifthenelse{\equal{simple hx}{\pgfkeysvalueof{/tikz/unit ext}}}
		{	% An additional \pgfpathmoveto is used after each stroke to "raise the pen" and prevent fill inside the hx stems
			\pgfpathmoveto{\pgfpoint{5mm}{-2mm}}
			\pgfpathlineto{\pgfpoint{-1mm}{-2mm}}
			\pgfpathmoveto{\pgfpoint{-1mm}{-2mm}} % pen up
			\pgfpathlineto{\pgfpoint{1mm}{-3.5mm}}
			\pgfpathmoveto{\pgfpoint{1mm}{-3.5mm}} % pen up
			\pgfpathlineto{\pgfpoint{-1mm}{-5mm}}
			\pgfpathmoveto{\pgfpoint{-1mm}{-5mm}} % pen up
			\pgfpathlineto{\pgfpoint{5mm}{-5mm}}
		}{}
		
	}
}


% ==============================================================
% Centrifugal pump
% ==============================================================
\pgfdeclareshape{centrifugal pump}{
	% Plain or with stylized inlets, outlets
			
	\savedanchor{\center}{\pgfpointorigin}
	\savedanchor{\north}{\pgfpoint{0mm}{3mm}}
	\savedanchor{\east}{\pgfpoint{3mm}{0mm}}
	\savedanchor{\northeast}{\pgfpointpolar{45}{3mm}}
	
	% The outlet anchor defaults to north but is otherwise selected based on unit ext
	\savedanchor{\outlet}{
		\ifthenelse{\equal{none}{\pgfkeysvalueof{/tikz/unit ext}}} % default to north
			{\pgf@x=0mm \pgf@y=3mm}{}
		\ifthenelse{\equal{outlet east}{\pgfkeysvalueof{/tikz/unit ext}}}
			{\pgf@x=4mm \pgf@y=2mm}{}
		\ifthenelse{\equal{outlet west}{\pgfkeysvalueof{/tikz/unit ext}}}
			{\pgf@x=-4mm \pgf@y=2mm}{}
		\ifthenelse{\equal{outlet north east}{\pgfkeysvalueof{/tikz/unit ext}}}
			{\pgf@x=2mm \pgf@y=4mm}{}
		\ifthenelse{\equal{outlet north west}{\pgfkeysvalueof{/tikz/unit ext}}}
			{\pgf@x=-2mm \pgf@y=4mm}{}		
	} 	
	
	% Normal anchors
	\anchor{center}{\center}
	\anchor{east}{\east}
	\anchor{north east}{\northeast}
	\anchor{north}{\north}
	\anchor{north west}{\northeast \pgf@x=-\pgf@x}
	\anchor{west}{\east \pgf@x=-\pgf@x}
	\anchor{south west}{\northeast \pgf@x=-\pgf@x \pgf@y=-\pgf@y}
	\anchor{south}{\pgf@x=0mm \pgf@y=-4mm}
	\anchor{south east}{\northeast \pgf@y=-\pgf@y}
	
	% Special anchors (only useful for certain key=value pairs)
	\anchor{outlet}{\outlet}
	
	% Draw it
	\backgroundpath{				
		\pgfsetroundjoin
		\pgfsetroundcap
		% Draw plain circle if UNITEXTERIOR is not set
		\ifthenelse{\equal{none}{\pgfkeysvalueof{/tikz/unit ext}}}
		{	\pgfpathcircle{\pgfpointorigin}{3mm} % Main circle = 3mm			
		}{}
		
		% Outlets based on unit ext variable
		% Outlet to east	
		\ifthenelse{\equal{outlet east}{\pgfkeysvalueof{/tikz/unit ext}}}
		{	\pgfpathmoveto{\north}
			\pgfpatharc{-270}{19.4712}{3mm} % 19.4712 = asin(1/3)
			\pgfpathlineto{\pgfpoint{4mm}{1mm}}
			\pgfpathlineto{\pgfpoint{4mm}{3mm}}
			\pgfpathclose
		}{}

		% Outlet to west	
		\ifthenelse{\equal{outlet west}{\pgfkeysvalueof{/tikz/unit ext}}}
		{	\pgfpathmoveto{\north}
			\pgfpatharc{90}{-199.4712}{3mm} % -199.4712 = rad2deg(asin(1/3))-180
			\pgfpathlineto{\pgfpoint{-4mm}{1mm}}
			\pgfpathlineto{\pgfpoint{-4mm}{3mm}}
			\pgfpathclose		
		}{}
		% Outlet to north west
		\ifthenelse{\equal{outlet north west}{\pgfkeysvalueof{/tikz/unit ext}}}
		{	\pgfpathmoveto{\east \pgf@x=-\pgf@x} % west point
			\pgfpatharc{-180}{109.4712}{3mm} % 109.4712 = 180-rad2deg(acos(1/3))
			\pgfpathlineto{\pgfpoint{-1mm}{4mm}}
			\pgfpathlineto{\pgfpoint{-3mm}{4mm}}
			\pgfpathclose	
		}{}
		% Outlet to north east
		\ifthenelse{\equal{outlet north east}{\pgfkeysvalueof{/tikz/unit ext}}}
		{	\pgfpathmoveto{\east}
			\pgfpatharc{0}{-289.4712}{3mm} % -289.4712 = rad2deg(acos(1/3))-360
			\pgfpathlineto{\pgfpoint{1mm}{4mm}}
			\pgfpathlineto{\pgfpoint{3mm}{4mm}}
			\pgfpathclose
		}{}
	

	}
	\foregroundpath{
		% Inlets are in FOREGROUNDPATH so that when a fill color is used they don't produce an unfilled region.
		
		% Fills based on unit int variable

		% Inlet from north	
		\ifthenelse{\equal{inlet north}{\pgfkeysvalueof{/tikz/unit int}}}
		{	\pgfpathmoveto{\pgfpoint{-1mm}{0mm}}
			\pgfpatharc{180}{360}{1mm}			
		}{}
	
		% Inlet from west	
		\ifthenelse{\equal{inlet west}{\pgfkeysvalueof{/tikz/unit int}}}
		{	\pgfpathmoveto{\pgfpoint{0mm}{1mm}}
			\pgfpatharc{90}{-90}{1mm}			
		}{}
		
		% Inlet from east	
		\ifthenelse{\equal{inlet east}{\pgfkeysvalueof{/tikz/unit int}}}
		{	\pgfpathmoveto{\pgfpoint{0mm}{1mm}}
			\pgfpatharc{90}{270}{1mm}			
		}{}
		
		% Inlet from south	
		\ifthenelse{\equal{inlet south}{\pgfkeysvalueof{/tikz/unit int}}}
		{	\pgfpathmoveto{\pgfpoint{1mm}{0mm}}
			\pgfpatharc{0}{180}{1mm}			
		}{}

	}

	\behindbackgroundpath{
		% The base goes here so that when a fill color is used it doesn't produce an unfilled region. It's always drawn.
		\pgfpathmoveto{\pgfpointpolar{225}{3mm}}
		\pgfpathlineto{\pgfpoint{-3mm}{-4mm}}
		\pgfpathlineto{\pgfpoint{3mm}{-4mm}}
		\pgfpathlineto{\pgfpointpolar{315}{3mm}}
		\pgfpatharc{315}{225}{3mm}
		\pgfpathclose	
	}
		
}


% ==============================================================
% Reciprocating pump
% ==============================================================
\pgfdeclareshape{reciprocating pump}{
	% Two squares connected by a shaft
	
	% Saved anchors
	\savedanchor{\bottomleft}{\pgfpoint{-2mm}{-8mm}}
	\savedanchor{\topright}{\pgfpoint{2mm}{2mm}}
	
	% Normal anchors
	\anchor{center}{\pgfpointorigin}
	\anchor{north}{\topright \pgf@x=0mm}
	\anchor{south}{\bottomleft \pgf@x=0mm}
	\anchor{east}{\topright \pgf@y=0mm}
	\anchor{west}{\bottomleft \pgf@y=0mm}
	\anchor{south west}{\bottomleft}
	\anchor{north east}{\topright}
	\anchor{north west}{\topright \pgf@x=-\pgf@x}
	\anchor{south east}{\bottomleft \pgf@x=-\pgf@x}
	
	% Special anchors
	% OUTLET defined only so that switching between centrifugal and reciprocating doesn't break
	\anchor{outlet}{\topright \pgf@x=0mm}
	
	% Draw it
	\backgroundpath{		
		% Pump head
		\pgfpathrectanglecorners{\topright}{\topright \pgf@x=-\pgf@x \pgf@y=-\pgf@y}
		% Shaft
		\pgfpathrectanglecorners{\pgfpoint{-0.3mm}{-2mm}}{\pgfpoint{0.3mm}{-4mm}}
		% Motor
		\pgfpathrectanglecorners{\bottomleft}{\pgfpoint{2mm}{-4mm}}

		\pgfsetroundjoin
		\pgfsetroundcap
	}
}




% ==============================================================
% Compressor
% ==============================================================
\pgfdeclareshape{compressor}{
	% Squashed quadrilateral
	
	% Saved anchors
	\savedanchor{\center}{\pgfpointorigin}
	\savedanchor{\north}{\pgfpoint{0mm}{2mm}}
	\savedanchor{\northeast}{\pgfpoint{3mm}{1mm}}
	\savedanchor{\southwest}{\pgfpoint{-3mm}{-3mm}}
	
	% Normal anchors
	\anchor{center}{\center}
	\anchor{east}{\northeast \pgf@y=0mm}
	\anchor{north east}{\northeast}
	\anchor{north}{\north}
	\anchor{north west}{\southwest \pgf@y=-\pgf@y}
	\anchor{west}{\southwest \pgf@y=0mm}
	\anchor{south west}{\southwest}
	\anchor{south}{\north \pgf@y=-\pgf@y}
	\anchor{south east}{\northeast \pgf@y=-\pgf@y}
	
	\anchor{north north west}{\pgfpointlineatdistance{1mm}{\southwest \pgf@y=-\pgf@y}{\north}}
	\anchor{north north east}{\pgfpointlineatdistance{1mm}{\northeast}{\north}}
	\anchor{south south west}{\pgfpointlineatdistance{1mm}{\southwest}{\north \pgf@y=-\pgf@y}}
	\anchor{south south east}{\pgfpointlineatdistance{1mm}{\northeast \pgf@y=-\pgf@y}{\north \pgf@y=-\pgf@y}}
	\anchor{west north west}{\pgfpointlineatdistance{1mm}{\southwest \pgf@y=-\pgf@y}{\southwest}}
	\anchor{west south west}{\pgfpointlineatdistance{1mm}{\southwest}{\southwest \pgf@y=0mm}}
	
	% Spacing is tight on the outlet side so these anchors placed partway between cardinals and off-cardinals
	\anchor{east north east}{\pgfpointlineattime{0.5}{\northeast}{\northeast \pgf@y=0mm}}
	\anchor{east south east}{\pgfpointlineattime{0.5}{\northeast \pgf@y=-\pgf@y}{\northeast \pgf@y=0mm}}
	
	% Draw it
	\backgroundpath{
		% Main circle
		\pgfpathmoveto{\northeast}
		\pgfpathlineto{\southwest \pgf@y=-\pgf@y}
		\pgfpathlineto{\southwest}
		\pgfpathlineto{\northeast \pgf@y=-\pgf@y}
		\pgfpathclose
		\pgfsetroundjoin
		\pgfsetroundcap
	}
}


% ==============================================================
% Turbine
% ==============================================================
\pgfdeclareshape{turbine}{
	% Squashed quadrilateral (simple mirror of compressor)
	
	% Saved anchors
	\savedanchor{\center}{\pgfpointorigin}
	\savedanchor{\north}{\pgfpoint{0mm}{2mm}}
	\savedanchor{\northeast}{\pgfpoint{3mm}{3mm}}
	\savedanchor{\southwest}{\pgfpoint{-3mm}{-1mm}}
	
	% Normal anchors
	\anchor{center}{\center}
	\anchor{east}{\northeast \pgf@y=0mm}
	\anchor{north east}{\northeast}
	\anchor{north}{\north}
	\anchor{north west}{\southwest \pgf@y=-\pgf@y}
	\anchor{west}{\southwest \pgf@y=0mm}
	\anchor{south west}{\southwest}
	\anchor{south}{\north \pgf@y=-\pgf@y}
	\anchor{south east}{\northeast \pgf@y=-\pgf@y}
	
	\anchor{north north west}{\pgfpointlineatdistance{1mm}{\southwest \pgf@y=-\pgf@y}{\north}}
	\anchor{north north east}{\pgfpointlineatdistance{1mm}{\northeast}{\north}}
	\anchor{south south west}{\pgfpointlineatdistance{1mm}{\southwest}{\north \pgf@y=-\pgf@y}}
	\anchor{south south east}{\pgfpointlineatdistance{1mm}{\northeast \pgf@y=-\pgf@y}{\north \pgf@y=-\pgf@y}}
	\anchor{east north east}{\pgfpointlineatdistance{1mm}{\northeast}{\northeast \pgf@y=0mm}}
	\anchor{east south east}{\pgfpointlineatdistance{1mm}{\northeast \pgf@y=-\pgf@y}{\northeast \pgf@y=0mm}}
	
	% Spacing is tight on the inlet side so these anchors placed partway between cardinals and off-cardinals
	\anchor{west north west}{\pgfpointlineattime{0.5}{\southwest \pgf@y=-\pgf@y}{\southwest \pgf@y=0mm}}
	\anchor{west south west}{\pgfpointlineattime{0.5}{\southwest}{\southwest \pgf@y=0mm}}
	
	% Draw it
	\backgroundpath{
		% Main circle
		\pgfpathmoveto{\northeast}
		\pgfpathlineto{\southwest \pgf@y=-\pgf@y}
		\pgfpathlineto{\southwest}
		\pgfpathlineto{\northeast \pgf@y=-\pgf@y}
		\pgfpathclose
		\pgfsetroundjoin
		\pgfsetroundcap
	}
}


% ==============================================================
% Valve
% ==============================================================
\pgfdeclareshape{valve}{
	% General valve with or without unspecified actuator
	
	% Saved anchors
	\savedanchor{\center}{\pgfpointorigin}
	\savedanchor{\northeast}{\pgfpoint{1.5mm}{1mm}}
	\savedanchor{\southwest}{\pgfpoint{-1.5mm}{-1mm}}
	
	% Normal anchors
	\anchor{center}{\center}
	\anchor{east}{\northeast \pgf@y=0mm}
	\anchor{north east}{\northeast}
	\anchor{north}{\northeast \pgf@x=0mm}
	\anchor{north west}{\southwest \pgf@y=-\pgf@y}
	\anchor{west}{\southwest \pgf@y=0mm}
	\anchor{south west}{\southwest}
	\anchor{south}{\southwest \pgf@x=0mm}
	\anchor{south east}{\northeast \pgf@y=-\pgf@y}
	
	% Special anchors
	\anchor{actuator}{\pgfpoint{0mm}{3mm}}
	
	% Draw it
	\backgroundpath{
		\pgfpathmoveto{\northeast}
		\pgfpathlineto{\southwest}
		\pgfpathlineto{\southwest \pgf@y=-\pgf@y}
		\pgfpathlineto{\northeast \pgf@y=-\pgf@y}
		\pgfpathclose
		\pgfsetroundjoin
		\pgfsetroundcap
	}
	\foregroundpath{
		% Actuator based on unit ext key
		% Unspecified actuator	
		\ifthenelse{\equal{actuator}{\pgfkeysvalueof{/tikz/unit ext}}}
		{	\pgfpathmoveto{\center}
			\pgfpathlineto{\pgfpoint{0mm}{2mm}}
			\pgfpathlineto{\pgfpoint{-1mm}{2mm}}
			\pgfpatharc{180}{0}{1mm}
			\pgfpathlineto{\pgfpoint{0mm}{2mm}}
			\pgfpathclose % unnecessary for stroke purposes but removes 
			%arrowheads since used inside paths			
		}{}	
	}
}




% ==============================================================
% Feed
% ==============================================================
\pgfdeclareshape{feed}{
	% Half-filled circle, radius = 1.5 mm
	
	% Saved anchors
	\savedanchor{\center}{\pgfpointorigin}
	\savedanchor{\north}{\pgfpoint{0mm}{1.5mm}}
	\savedanchor{\east}{\pgfpoint{1.5mm}{0mm}}
	\savedanchor{\northeast}{\pgfpointpolar{45}{1.5mm}}
	
	% Normal anchors
	\anchor{center}{\center}
	\anchor{east}{\east}
	\anchor{north east}{\northeast}
	\anchor{north}{\north}
	\anchor{north west}{\northeast \pgf@x=-\pgf@x}
	\anchor{west}{\east \pgf@x=-\pgf@x}
	\anchor{south west}{\northeast \pgf@x=-\pgf@x \pgf@y=-\pgf@y}
	\anchor{south}{\north \pgf@y=-\pgf@y}
	\anchor{south east}{\northeast \pgf@y=-\pgf@y}
	
	% Special anchors (only useful for certain key=value pairs)
	\anchor{stream}{\east}
	
	% Draw it
	\backgroundpath{
		% Main circle
		\pgfpathcircle{\pgfpointorigin}{1.5mm}
	}
	\beforebackgroundpath{		
		% Filled half uses stroke color as fill
		% Procedure for this derived from tex.stackexchange.com/questions/218968
		\expandafter\global\expandafter\let\expandafter\pgfmysavedstrokecolor\csname\string\color@pgfstrokecolor\endcsname%
		\expandafter\pgf@setfillcolor\pgfmysavedstrokecolor
		\pgfpathmoveto{\north}
		\pgfpatharc{90}{270}{1.5mm}
		\pgfusepath{stroke, fill}
	}
}


% ==============================================================
% Product
% ==============================================================
\pgfdeclareshape{product}{
	% Half-filled circle, radius = 1.5 mm
	
	% Saved anchors
	\savedanchor{\center}{\pgfpointorigin}
	\savedanchor{\north}{\pgfpoint{0mm}{1.5mm}}
	\savedanchor{\east}{\pgfpoint{1.5mm}{0mm}}
	\savedanchor{\northeast}{\pgfpointpolar{45}{1.5mm}}
	
	% Normal anchors
	\anchor{center}{\center}
	\anchor{east}{\east}
	\anchor{north east}{\northeast}
	\anchor{north}{\north}
	\anchor{north west}{\northeast \pgf@x=-\pgf@x}
	\anchor{west}{\east \pgf@x=-\pgf@x}
	\anchor{south west}{\northeast \pgf@x=-\pgf@x \pgf@y=-\pgf@y}
	\anchor{south}{\north \pgf@y=-\pgf@y}
	\anchor{south east}{\northeast \pgf@y=-\pgf@y}
	
	% Special anchors (only useful for certain key=value pairs)
	\anchor{stream}{\east \pgf@x=-\pgf@x}
	
	% Draw it
	\backgroundpath{
		% Main circle
		\pgfpathcircle{\pgfpointorigin}{1.5mm}
	}
	\beforebackgroundpath{
		% Filled half uses stroke color as fill
		% Procedure for this derived from tex.stackexchange.com/questions/218968
		\expandafter\global\expandafter\let\expandafter\pgfmysavedstrokecolor\csname\string\color@pgfstrokecolor\endcsname%
		\expandafter\pgf@setfillcolor\pgfmysavedstrokecolor
		% Filled half
		\pgfpathmoveto{\north}
		\pgfpatharc{90}{-90}{1.5mm}
		\pgfusepath{stroke, fill}
	}
}



\makeatother



% ========= ADDITIONAL SHAPES ==========
% These shapes do not require custom PGF shapes; they're modifications of 
%existing shapes.
\tikzset{>=Triangle} % see section 16.5 for other arrowheads (arrow tips)
\tikzstyle{sid} = [diamond, draw, solid, fill=white, text badly centered,inner 
sep=1pt, font=\footnotesize]
\tikzstyle{elec} = [circle, draw, solid, fill=white, text badly centered,inner 
sep=1pt, font=\footnotesize]



% ========= DEFAULT TIKZSTYLES ==========
% The following TIKZSTYLES set all custom shapes to, by default, be drawn with a stroke in black and no fill.
\tikzset{tube reactor/.style={shape=tube reactor, draw=black}}
\tikzset{tank reactor/.style={shape=tank reactor, draw=black}}
\tikzset{column/.style={shape=column, draw=black}}
\tikzset{vessel/.style={shape=vessel, draw=black}}
\tikzset{basic hx/.style={shape=basic hx, draw=black}}
\tikzset{fired hx/.style={shape=fired hx, draw=black}}
\tikzset{shell and tube hx/.style={shape=shell and tube hx, draw=black}}
\tikzset{plate hx/.style={shape=plate hx, draw=black}}
\tikzset{centrifugal pump/.style={shape=centrifugal pump, draw=black}}
\tikzset{reciprocating pump/.style={shape=reciprocating pump, draw=black}}
\tikzset{compressor/.style={shape=compressor, draw=black}}
\tikzset{turbine/.style={shape=turbine, draw=black}}
\tikzset{feed/.style={shape=feed, draw=black}}
\tikzset{product/.style={shape=product, draw=black}}
\tikzset{valve/.style={shape=valve, draw=black, fill=white}} % fill=white since usually placed on paths



% ========= ANCHOR ALIASING ==========
% Command for aliasing anchors (tex.stackexchange.com/questions/145134)
%\pgfdeclareanchoralias{<shape>}{<anchor>}{<alias>}
\newcommand*\pgfdeclareanchoralias[3]{%
	\expandafter\def\csname pgf@anchor@#1@#3\expandafter\endcsname
	\expandafter{\csname pgf@anchor@#1@#2\endcsname}}

% In general, all compass directions are aliased with their abbreviations: north=n, south east = se, etc.
% Sure would be nice if this could be done in a for loop :/ but some are different.

% Tank reactor
\pgfdeclareanchoralias{tank reactor}{north}{n}
\pgfdeclareanchoralias{tank reactor}{south}{s}
\pgfdeclareanchoralias{tank reactor}{east}{e}
\pgfdeclareanchoralias{tank reactor}{west}{w}
\pgfdeclareanchoralias{tank reactor}{north east}{ne}
\pgfdeclareanchoralias{tank reactor}{north west}{nw}
\pgfdeclareanchoralias{tank reactor}{south east}{se}
\pgfdeclareanchoralias{tank reactor}{south west}{sw}
\pgfdeclareanchoralias{tank reactor}{north north east}{nne}
\pgfdeclareanchoralias{tank reactor}{north north west}{nnw}
\pgfdeclareanchoralias{tank reactor}{south south west}{ssw}
\pgfdeclareanchoralias{tank reactor}{south south east}{sse}
\pgfdeclareanchoralias{tank reactor}{east south east}{ese}
\pgfdeclareanchoralias{tank reactor}{west south west}{wsw}

% Tube reactor
\pgfdeclareanchoralias{tube reactor}{north}{n}
\pgfdeclareanchoralias{tube reactor}{south}{s}
\pgfdeclareanchoralias{tube reactor}{east}{e}
\pgfdeclareanchoralias{tube reactor}{west}{w}
\pgfdeclareanchoralias{tube reactor}{north east}{ne}
\pgfdeclareanchoralias{tube reactor}{north west}{nw}
\pgfdeclareanchoralias{tube reactor}{south east}{se}
\pgfdeclareanchoralias{tube reactor}{south west}{sw}
\pgfdeclareanchoralias{tube reactor}{north north east}{nne}
\pgfdeclareanchoralias{tube reactor}{north north west}{nnw}
\pgfdeclareanchoralias{tube reactor}{south south west}{ssw}
\pgfdeclareanchoralias{tube reactor}{south south east}{sse}
\pgfdeclareanchoralias{tube reactor}{east south east}{ese}
\pgfdeclareanchoralias{tube reactor}{west south west}{wsw}
\pgfdeclareanchoralias{tube reactor}{west north west}{wnw}
\pgfdeclareanchoralias{tube reactor}{east north east}{ene}

% Basic hx
\pgfdeclareanchoralias{basic hx}{north}{n}
\pgfdeclareanchoralias{basic hx}{south}{s}
\pgfdeclareanchoralias{basic hx}{east}{e}
\pgfdeclareanchoralias{basic hx}{west}{w}
\pgfdeclareanchoralias{basic hx}{north east}{ne}
\pgfdeclareanchoralias{basic hx}{north west}{nw}
\pgfdeclareanchoralias{basic hx}{south east}{se}
\pgfdeclareanchoralias{basic hx}{south west}{sw}

% Shell and tube hx
\pgfdeclareanchoralias{shell and tube hx}{north}{n}
\pgfdeclareanchoralias{shell and tube hx}{south}{s}
\pgfdeclareanchoralias{shell and tube hx}{east}{e}
\pgfdeclareanchoralias{shell and tube hx}{west}{w}
\pgfdeclareanchoralias{shell and tube hx}{north east}{ne}
\pgfdeclareanchoralias{shell and tube hx}{north west}{nw}
\pgfdeclareanchoralias{shell and tube hx}{south east}{se}
\pgfdeclareanchoralias{shell and tube hx}{south west}{sw}
\pgfdeclareanchoralias{shell and tube hx}{north north east}{nne}
\pgfdeclareanchoralias{shell and tube hx}{north north west}{nnw}
\pgfdeclareanchoralias{shell and tube hx}{south south west}{ssw}
\pgfdeclareanchoralias{shell and tube hx}{south south east}{sse}
\pgfdeclareanchoralias{shell and tube hx}{east south east}{ese}
\pgfdeclareanchoralias{shell and tube hx}{west south west}{wsw}
\pgfdeclareanchoralias{shell and tube hx}{west north west}{wnw}
\pgfdeclareanchoralias{shell and tube hx}{east north east}{ene}

% Plate hx
\pgfdeclareanchoralias{plate hx}{north}{n}
\pgfdeclareanchoralias{plate hx}{south}{s}
\pgfdeclareanchoralias{plate hx}{east}{e}
\pgfdeclareanchoralias{plate hx}{west}{w}
\pgfdeclareanchoralias{plate hx}{north east}{ne}
\pgfdeclareanchoralias{plate hx}{north west}{nw}
\pgfdeclareanchoralias{plate hx}{south east}{se}
\pgfdeclareanchoralias{plate hx}{south west}{sw}
\pgfdeclareanchoralias{plate hx}{north north east}{nne}
\pgfdeclareanchoralias{plate hx}{north north west}{nnw}
\pgfdeclareanchoralias{plate hx}{south south west}{ssw}
\pgfdeclareanchoralias{plate hx}{south south east}{sse}
\pgfdeclareanchoralias{plate hx}{east south east}{ese}
\pgfdeclareanchoralias{plate hx}{west south west}{wsw}
\pgfdeclareanchoralias{plate hx}{west north west}{wnw}
\pgfdeclareanchoralias{plate hx}{east north east}{ene}

% Fired hx
\pgfdeclareanchoralias{fired hx}{north}{n}
\pgfdeclareanchoralias{fired hx}{south}{s}
\pgfdeclareanchoralias{fired hx}{east}{e}
\pgfdeclareanchoralias{fired hx}{west}{w}
\pgfdeclareanchoralias{fired hx}{north east}{ne}
\pgfdeclareanchoralias{fired hx}{north west}{nw}
\pgfdeclareanchoralias{fired hx}{south east}{se}
\pgfdeclareanchoralias{fired hx}{south west}{sw}
\pgfdeclareanchoralias{fired hx}{north north east}{nne}
\pgfdeclareanchoralias{fired hx}{north north west}{nnw}
\pgfdeclareanchoralias{fired hx}{south south west}{ssw}
\pgfdeclareanchoralias{fired hx}{south south east}{sse}
\pgfdeclareanchoralias{fired hx}{east south east}{ese}
\pgfdeclareanchoralias{fired hx}{west south west}{wsw}
\pgfdeclareanchoralias{fired hx}{west north west}{wnw}
\pgfdeclareanchoralias{fired hx}{east north east}{ene}

% Column
\pgfdeclareanchoralias{column}{north}{n}
\pgfdeclareanchoralias{column}{south}{s}
\pgfdeclareanchoralias{column}{east}{e}
\pgfdeclareanchoralias{column}{west}{w}
\pgfdeclareanchoralias{column}{north east}{ne}
\pgfdeclareanchoralias{column}{north west}{nw}
\pgfdeclareanchoralias{column}{south east}{se}
\pgfdeclareanchoralias{column}{south west}{sw}
\pgfdeclareanchoralias{column}{north north east}{nne}
\pgfdeclareanchoralias{column}{north north west}{nnw}
\pgfdeclareanchoralias{column}{south south west}{ssw}
\pgfdeclareanchoralias{column}{south south east}{sse}
\pgfdeclareanchoralias{column}{east south east}{ese}
\pgfdeclareanchoralias{column}{west south west}{wsw}
\pgfdeclareanchoralias{column}{west north west}{wnw}
\pgfdeclareanchoralias{column}{east north east}{ene}

% Vessel
\pgfdeclareanchoralias{vessel}{north}{n}
\pgfdeclareanchoralias{vessel}{south}{s}
\pgfdeclareanchoralias{vessel}{east}{e}
\pgfdeclareanchoralias{vessel}{west}{w}
\pgfdeclareanchoralias{vessel}{north east}{ne}
\pgfdeclareanchoralias{vessel}{north west}{nw}
\pgfdeclareanchoralias{vessel}{south east}{se}
\pgfdeclareanchoralias{vessel}{south west}{sw}
\pgfdeclareanchoralias{vessel}{north north east}{nne}
\pgfdeclareanchoralias{vessel}{north north west}{nnw}
\pgfdeclareanchoralias{vessel}{south south west}{ssw}
\pgfdeclareanchoralias{vessel}{south south east}{sse}
\pgfdeclareanchoralias{vessel}{east south east}{ese}
\pgfdeclareanchoralias{vessel}{west south west}{wsw}
\pgfdeclareanchoralias{vessel}{west north west}{wnw}
\pgfdeclareanchoralias{vessel}{east north east}{ene}

% Centrifugal pump
\pgfdeclareanchoralias{centrifugal pump}{north}{n}
\pgfdeclareanchoralias{centrifugal pump}{south}{s}
\pgfdeclareanchoralias{centrifugal pump}{east}{e}
\pgfdeclareanchoralias{centrifugal pump}{west}{w}
\pgfdeclareanchoralias{centrifugal pump}{north east}{ne}
\pgfdeclareanchoralias{centrifugal pump}{north west}{nw}
\pgfdeclareanchoralias{centrifugal pump}{south east}{se}
\pgfdeclareanchoralias{centrifugal pump}{south west}{sw}

% Reciprocating pump
\pgfdeclareanchoralias{reciprocating pump}{north}{n}
\pgfdeclareanchoralias{reciprocating pump}{south}{s}
\pgfdeclareanchoralias{reciprocating pump}{east}{e}
\pgfdeclareanchoralias{reciprocating pump}{west}{w}
\pgfdeclareanchoralias{reciprocating pump}{north east}{ne}
\pgfdeclareanchoralias{reciprocating pump}{north west}{nw}
\pgfdeclareanchoralias{reciprocating pump}{south east}{se}
\pgfdeclareanchoralias{reciprocating pump}{south west}{sw}

% Compressor
\pgfdeclareanchoralias{compressor}{north}{n}
\pgfdeclareanchoralias{compressor}{south}{s}
\pgfdeclareanchoralias{compressor}{east}{e}
\pgfdeclareanchoralias{compressor}{west}{w}
\pgfdeclareanchoralias{compressor}{north east}{ne}
\pgfdeclareanchoralias{compressor}{north west}{nw}
\pgfdeclareanchoralias{compressor}{south east}{se}
\pgfdeclareanchoralias{compressor}{south west}{sw}
\pgfdeclareanchoralias{compressor}{north north east}{nne}
\pgfdeclareanchoralias{compressor}{north north west}{nnw}
\pgfdeclareanchoralias{compressor}{south south west}{ssw}
\pgfdeclareanchoralias{compressor}{south south east}{sse}
\pgfdeclareanchoralias{compressor}{east south east}{ese}
\pgfdeclareanchoralias{compressor}{west south west}{wsw}
\pgfdeclareanchoralias{compressor}{west north west}{wnw}
\pgfdeclareanchoralias{compressor}{east north east}{ene}

% Turbine
\pgfdeclareanchoralias{turbine}{north}{n}
\pgfdeclareanchoralias{turbine}{south}{s}
\pgfdeclareanchoralias{turbine}{east}{e}
\pgfdeclareanchoralias{turbine}{west}{w}
\pgfdeclareanchoralias{turbine}{north east}{ne}
\pgfdeclareanchoralias{turbine}{north west}{nw}
\pgfdeclareanchoralias{turbine}{south east}{se}
\pgfdeclareanchoralias{turbine}{south west}{sw}
\pgfdeclareanchoralias{turbine}{north north east}{nne}
\pgfdeclareanchoralias{turbine}{north north west}{nnw}
\pgfdeclareanchoralias{turbine}{south south west}{ssw}
\pgfdeclareanchoralias{turbine}{south south east}{sse}
\pgfdeclareanchoralias{turbine}{east south east}{ese}
\pgfdeclareanchoralias{turbine}{west south west}{wsw}
\pgfdeclareanchoralias{turbine}{west north west}{wnw}
\pgfdeclareanchoralias{turbine}{east north east}{ene}

% Valve
\pgfdeclareanchoralias{valve}{north}{n}
\pgfdeclareanchoralias{valve}{south}{s}
\pgfdeclareanchoralias{valve}{east}{e}
\pgfdeclareanchoralias{valve}{west}{w}
\pgfdeclareanchoralias{valve}{north east}{ne}
\pgfdeclareanchoralias{valve}{north west}{nw}
\pgfdeclareanchoralias{valve}{south east}{se}
\pgfdeclareanchoralias{valve}{south west}{sw}

% Feed
\pgfdeclareanchoralias{feed}{north}{n}
\pgfdeclareanchoralias{feed}{south}{s}
\pgfdeclareanchoralias{feed}{east}{e}
\pgfdeclareanchoralias{feed}{west}{w}
\pgfdeclareanchoralias{feed}{north east}{ne}
\pgfdeclareanchoralias{feed}{north west}{nw}
\pgfdeclareanchoralias{feed}{south east}{se}
\pgfdeclareanchoralias{feed}{south west}{sw}

% Product
\pgfdeclareanchoralias{product}{north}{n}
\pgfdeclareanchoralias{product}{south}{s}
\pgfdeclareanchoralias{product}{east}{e}
\pgfdeclareanchoralias{product}{west}{w}
\pgfdeclareanchoralias{product}{north east}{ne}
\pgfdeclareanchoralias{product}{north west}{nw}
\pgfdeclareanchoralias{product}{south east}{se}
\pgfdeclareanchoralias{product}{south west}{sw}

% SID (Stream identification)
\pgfdeclareanchoralias{sid}{north}{n}
\pgfdeclareanchoralias{sid}{south}{s}
\pgfdeclareanchoralias{sid}{east}{e}
\pgfdeclareanchoralias{sid}{west}{w}
\pgfdeclareanchoralias{sid}{north east}{ne}
\pgfdeclareanchoralias{sid}{north west}{nw}
\pgfdeclareanchoralias{sid}{south east}{se}
\pgfdeclareanchoralias{sid}{south west}{sw}


% ======================================
% Code from SPATH3 documentation for creating line breaks

%\AtBeginDocument{\tikz[overlay] \path[spath/save=arc] (0,0) arc[radius=1cm, start angle=180, delta angle=-180];}

% Updated to eliminate occasional whitespace per tex.stackexchange.com/questions/605800
\AtBeginDocument{\sbox0{\tikz[overlay] \path[spath/save global=myarc] (0,0) arc[radius=1cm, start angle=180, delta angle=-180];}}

\tikzset{
	bridge path/.initial=myarc,
	bridge radius/.initial=0pt,
	bridge gap/.initial=4pt,
	bridge/.style 2 args={
		spath/split at intersections with={#1}{#2},
		spath/insert gaps after
		components={#1}{\pgfkeysvalueof{/tikz/bridge radius}},
		spath/join components upright
		with={#1}{\pgfkeysvalueof{/tikz/bridge path}},
		spath/split at intersections with={#2}{#1},
		spath/insert gaps after
		components={#2}{\pgfkeysvalueof{/tikz/bridge gap}},
	}
}