Update remaining examples for new organization of namespaces
[shapes.git] / examples / showcase / fig2_11.shape
blob3c5aac27179669aa705c41cfc024c4f7f4be6b9f
1 /** This file is part of Shapes.
2  **
3  ** Shapes is free software: you can redistribute it and/or modify
4  ** it under the terms of the GNU General Public License as published by
5  ** the Free Software Foundation, either version 3 of the License, or
6  ** any later version.
7  **
8  ** Shapes is distributed in the hope that it will be useful,
9  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
10  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  ** GNU General Public License for more details.
12  **
13  ** You should have received a copy of the GNU General Public License
14  ** along with Shapes.  If not, see <http://www.gnu.org/licenses/>.
15  **
16  ** Copyright 2008, 2010, 2014 Henrik Tidefelt
17  **/
19 |** preamble \RequirePackage{../sigsysnotation}
21 ##needs valve.shext
22 ##needs demoprefs.shext
23 ##needs ..Applications..Blockdraw
25 ##lookin ..Shapes
26 ##lookin ..Applications..Blockdraw
28 demoprefs & @defaultunit:1%c
32 longblockrx: 1cm
33 longblockry: 5mm
35 tank_W: 3cm
36 tank_H: 1.5cm
37 tank_L: tank_H * 0.76
39 y1: tank_H + 1cm
40 y2: tank_H + 1mm
41 r: 5mm
43 inflow: \ •dst x1 x2 txt doValve →
45   d: [normalized x2 - x1]
46   •dst << [stroke (x1,y1+@pipe_width/2)--(x2-d*(r+@pipe_width/2),y1+@pipe_width/2)>(^[angle (d,0)])--(^90°)<(x2+d*@pipe_width/2,y1-@pipe_width/2-r)--(x2+d*@pipe_width/2,y2)]
47   •dst << [stroke (x1,y1-@pipe_width/2)--(x2-d*(r+@pipe_width/2),y1-@pipe_width/2)>(^[angle (d,0)])--(^90°)<(x2-d*@pipe_width/2,y1-@pipe_width/2-r)--(x2-d*@pipe_width/2,y2)]
48   p: (x2-d*(r+7mm),y1)--(x2-d*(r+2mm),y1)
49   •dst <<[stroke p head:Graphics..ShapesArrow]
50   •dst << [[shift (x1+d*3mm,y1-@pipe_width/2-3mm)] [Layout..center [TeX txt] (0,1)]]
51   •dst << [if doValve
52         [[shift ([Layout..mediate 0.4 x1 x2],y1)]*[rotate 90°] [valve]]
53   null]
56 [inflow •page ~2.5cm tank_W/3 `Acid process flow´ false]
57 [inflow •page tank_W+2.5cm tank_W*2/3 `NaOH solution´ true]
59 •page << @nonstroking: [gray 0.8] |
60  [fill (0cm,0cm)--(tank_W,0cm)--(tank_W,tank_L)--(0cm,tank_L)--cycle]
62     hdl: (3mm^45°)
63     lambda: (tank_W) / 4
64     •page << @width: 0.5bp & @dash: [dashpattern 3mm 1mm] | [stroke (0,tank_L)>hdl--(^)<(lambda,tank_L)>hdl--(^)<(2*lambda,tank_L)>hdl--(^)<(3*lambda,tank_L)>hdl--(^)<(4*lambda,tank_L)>hdl]
68  r: 6mm
69  xc: tank_W*0.5
70  yc: 5mm
71  a: 60°
72  •page << [stroke (xc,y1+5mm)--(xc,yc)>(^a)--(^180°-a)<(xc+r,yc)>(^180°+a)--(^~a)<(xc,yc)>(^180°-a)--(^a)<(xc-r,yc)>(^~a)--(^180°+a)<(xc,yc)]
75 •page << [stroke (0cm,tank_H)--(0cm,0cm)--(tank_W,0cm)--(tank_W,tank_H)]
76 •page << [stroke (tank_W/2,0cm)--(tank_W/2,~1.5cm)]
77 •page << [stroke (tank_W/2+@pipe_width,0cm)--(tank_W/2+@pipe_width,~1.5cm)]
79  p: (tank_W/2+@pipe_width/2,~5mm)--(tank_W/2+@pipe_width/2,~10mm)
80  •page << [stroke p head:Graphics..ShapesArrow]
81  •page << [putlabelRight [TeX `Flow with desired pH´] [p 0.5].p+(@pipe_width/2,0) 0]