Pikchr Diagram Examples

André Leite

2024-09-27

Disclaimer Some of the examples below are derived from the Pikchr project.

Example 1

/*
 Example 1. André Leite (leite@castlab.org)
 */
/*  1 */ dimen_ = 1
/*  2 */ Origem: (0,0) 
/*  3 */ B1:box "Microfone";
/*  4 */ L1:line from B1.e right dimen_/2;
/*  5 */ L2:line -> up dimen_/3.2 then right dimen_/2;
/*  6 */ L3:line -> from L1.end down dimen_/3.2 then right dimen_/2; 
/*  7 */ B2:box "Filtro PF" "em f₀" with .w at L2.end;
/*  8 */ B3:box "Filtro PF" "em f₁" with .w at L3.end;
/*  9 */ L4:line -> from B2.e right dimen_/2 then down dimen_/3.2 \
/* 10 */     then right dimen_/2 
/* 11 */ L4:line -> from B3.e right dimen_/2 then up dimen_/3.2 \
/* 12 */     then right dimen_/2 
/* 13 */ B4: box "Rede" "Neural" with .w at (L4.end.x,L1.end.y)         
Microfone Filtro PF em f₀ Filtro PF em f₁ Rede Neural

Example 2

/*
 Example 2. André Leite (leite@castlab.org)
 */
dimen_= .75
Origem:(0,0) 
B1:box "Agente" "Externo";
L1:line -> from B1.s down dimen_/4 then left 1.5*dimen_ then down dimen_/4; 
B2:box wid 1 "Sensores" "Digitais";
L2:line -> from B1.s down dimen_/4 then right 1.5*dimen_ then down dimen_/4;
B3:box wid 1 "Sensores" "Analógicos";
L3:line -> from B2.s down dimen_/2;
B4:box wid 1 "Transmissor" "FSK";
L4:line -> from B3.s down dimen_/2; 
B5:box wid 1 "Transmissor" "FM"; 
L5:line -> from B4.s down dimen_/2; 
B6:box wid 1 "Receptor" "FSK";
L6:line -> from B5.s down dimen_/2; 
B7:box wid 1 "Receptor" "FM";
L7:line -> from B6.s down .5*dimen_ then right 4.5*dimen_ \  
    then up 3*dimen_ then right .5*dimen_ 
L8:line -> from B7.s down .25*dimen_ then right 1.25*dimen_ \  
    then up 3*dimen_  then right .75*dimen_
B8:box wid 1 "Rede" big "Neural" big with .w at 1/2<L7.end, L8.end> fill lightblue
L9:line -> from B8.e right dimen_;
B9:box wid 1 "Sistema de" "Controle" "de Acesso";
L10:line -> from B8.e+(0,boxht/6) right dimen_/2 then up dimen_ then right dimen_/2; 
B10:box wid 1 "Sistema de" "Alarme";
L11:line -> from B8.e-(0,boxht/6) right dimen_/2 then down dimen_ then right dimen_/2; 
B11:box wid 1 "Sistema de" "Anúncio";         
Agente Externo Sensores Digitais Sensores Analógicos Transmissor FSK Transmissor FM Receptor FSK Receptor FM Rede Neural Sistema de Controle de Acesso Sistema de Alarme Sistema de Anúncio

Example 3

/*
 Example 3. André Leite (leite@castlab.org)
 */
               $len = 175px;
               margin = 20px;
/* First Stage */
          B1E: box rad 5px wid 2*$len fill white;
    LineCusto: line <- from B1E.n - ((2/3)*$len,0) up .25*$len;
     BoxCusto: box rad 5px "Custo" wid .5*$len ht .25*$len fill 0xFFD320;
LineDistancia: line <- thick from BoxCusto.w + (0,.25*$len/6) left .25*$len/2 \  
                    then up .25*$len/6 then left .15*$len/2;
               box rad 10px "Distância" fit wid .35*$len fill 0xFFD320;
    LineTempo: line <- thick  from BoxCusto.w - (0,.25*$len/6) left .25*$len/2 \  
                    then down .25*$len/6  then left .15*$len/2 color gray;
               box rad 10px "Tempo" fit wid .35*$len fill 0xFFD320;
               text "Primeiro Estágio" bold at B1E.c  color black;
   LineNumMat: line <- from B1E.n - ((0)*$len,0) up .25*$len;
           NM: box rad 10px fill 0x004586 ht .25*$len wid .6*$len;
 LineDemRisco: line <- from B1E.n + ((2/3)*$len,0) up .25*$len;
           NR: box rad 10px  wid .6*$len fill 0x7E0021 ht .25*$len;
               text "Número de Novas" "Maternidades" at NM.c color white;
               text "Nascimentos" "de risco" at NR.c color white;
/*Second Stage */
          B2E: box rad 5px with .n at B1E.s - (0, (.6)*$len) wid 2*$len fill white;
    LineOfeta: line <- from B2E.n up .2*$len;
           OF: box rad 10px "Nascimentos" "no município" fit wid .5*$len fill 0xFF420E;
  LineDemanda: line <- from B2E.n - ((2/3)*$len,0) up .2*$len;
           DM: box rad 10px "Nascimentos" "de residentes" fit wid .5*$len fill 0x83CAFF;
LineResultado: line -> "Polos" aligned above italic from B2E.e right .35*$len;
           RS: file "Resultado" bold ht .25*$len wid .5*$len fill 0x579D1C;
   LineSegEst: line -> "Macropolos" above italic aligned from B1E.s + \
                      ((2/3)*$len,0) down .6*$len; 
               text "Segundo Estágio" bold at B2E.c color black;
           BX: box thin dashed with .c at 1/2<OF.c,DM.c> wid 1.35*$len ht OF.height + .2;
               text "Município" above at BX.n;
/* Fim */          
Custo Distância Tempo Primeiro Estágio Número de Novas Maternidades Nascimentos de risco Nascimentos no município Nascimentos de residentes Polos Resultado Macropolos Segundo Estágio Município

Example 4

/*
 Example 4. André Leite (leite@castlab.org)
 */
dimen_ = .75
L1:line -> right dimen_/2; 
"RF" rjust at L1.w - (.05,0)
C1:circle radius dimen_/4 with .w at L1.e 
L2:line -> from C1.e right dimen_/2
B1:box " A " wid dimen_ ht dimen_*3/4
L3:line -> right dimen_;
L4:line -> from L3.c down dimen_*1 then left dimen_/2; 
B4:box "B" wid dimen_ ht dimen_*3/4
L7:line -> left (B4.w.x-C1.c.x) then up to C1.s
"+" at C1.c
B2:box with .w at L3.e "Detetor de" "envelope" wid dimen_ ht dimen_*3/4
L5:line -> from B2.e right dimen_/2; 
"BF" ljust at L5.end + (.05,0)
L6:line <- from B1.n up dimen_/2;
B3:box "oscilador" ht dimen_/2 wid dimen_*3/4         
RF  A  B + Detetor de envelope BF oscilador

Example 5

/*
 Example 5. André Leite (leite@castlab.org)
 */
linethick *= 1.5 
dimen_ = 1 
j = dimen_*sqrt(3)/2 
i = dimen_/2
define cell { 
    move to ($2,$3)
    A:line up dimen_*sqrt(3)/2 right dimen_/2 
    B:line right dimen_ 
    C:line down dimen_*sqrt(3)/2 right dimen_/2 
    D:line down dimen_*sqrt(3)/2 left dimen_/2
    E:line left dimen_
    F:line up dimen_*sqrt(3)/2 left dimen_/2 
    text $1 at A.start + (dimen_,0)
    move to C.end
}

cell("",0,0)
dimen_ *= 0.5 
cell("",0,0)
cell("",3*i/2,j/2)
cell(,3*i/2,-j/2)         

Example 6

/*
 Example 6. Original from pikchr.org and fossil-scm.org
 */
     scale = 0.8
     fill = white
     linewid *= 0.5
C0:  circle "C₀" fit
     circlerad = previous.radius
     arrow
C1:  circle "C₁"
     arrow
C2:  circle "C₂"
     arrow
C4:  circle "C₄"
     arrow
C6:  circle "C₆"
C3:  circle "C₃" at dist(C2,C4) heading 30 from C2
     arrow
C5:  circle "C₅"
     arrow from C2 to C3 chop
C3P: circle "C₃\'" at dist(C4,C6) heading 30 from C6
     arrow right from C3P.e
C5P: circle "C₅\'"
     arrow from C6 to C3P chop

     box height C3.y-C2.y \  
        width (C5P.e.x-C0.w.x)+linewid \  
        with .w at 0.5*linewid west of C0.w \  
        behind C0 \  
        fill 0xc6e2ff thin color gray
        
     box same width previous.e.x - C2.w.x \  
        with .se at previous.ne \  
        fill 0x9accfc
        "trunk" below at 2nd last box.s
        "feature branch" above at last box.n
C₀ C₁ C₂ C₄ C₆ C₃ C₅ C₃' C₅' trunk feature branch

Example 7

/*
 Example 7. Original from pikchr.org and fossil-scm.org
 */
linewid *= 0.5
circle "C0" fit
circlerad = previous.radius
arrow
circle "C1"
arrow
circle "C2"
arrow
circle "C4"
arrow
circle "C6"
circle "C3" at dist(C2,C4) heading 30 from C2

d1 = dist(C2,C3.ne)+2mm
line thin color gray from d1 heading 30 from C2 \  
   to d1+1cm heading 30 from C2
line thin color gray from d1 heading 0 from C2 \  
   to d1+1cm heading 0 from C2
spline thin color gray <-> \  
   from d1+8mm heading 0 from C2 \  
   to d1+8mm heading 10 from C2 \  
   to d1+8mm heading 20 from C2 \  
   to d1+8mm heading 30 from C2 \  
   "30&deg;" aligned below small

X1: line thin color gray from circlerad+1mm heading 300 from C3 \  
        to circlerad+6mm heading 300 from C3
X2: line thin color gray from circlerad+1mm heading 300 from C2 \  
        to circlerad+6mm heading 300 from C2
line thin color gray <-> from X2 to X1 "distância" aligned above small \  
    "C2 para C4" aligned below small
C0 C1 C2 C4 C6 C3 30° distância C2 para C4

Example 8

/*
 Example 8. Original from pikchr.org and fossil-scm.org
 */
lineht *= 0.4
$margin = lineht*2.5
scale = 0.75
fontscale = 1.1
charht *= 1.15
down

In: box "Interface" wid 150% ht 75% fill white
    arrow
CP: box same "SQL Command" "Processor"
    arrow
VM: box same "Virtual Machine"
    arrow down 1.25*$margin
BT: box same "B-Tree"
    arrow
    box same "Pager"
    arrow
OS: box same "OS Interface"
    box same with .w at 1.25*$margin east of 1st box.e "Tokenizer"
    arrow
    box same "Parser"
    arrow
CG: box same ht 200% "Code" "Generator"
UT: box same as 1st box at (Tokenizer,Pager) "Utilities"
    move lineht
TC: box same "Test Code"
    arrow from CP to 1/4<Tokenizer.sw,Tokenizer.nw> chop
    arrow from 1/3<CG.nw,CG.sw> to CP chop

    box ht (In.n.y-VM.s.y)+$margin wid In.wid+$margin \  
       at CP fill 0xd8ecd0 behind In
    line invis from 0.25*$margin east of last.sw up last.ht \  
        "Core" italic aligned

    box ht (BT.n.y-OS.s.y)+$margin wid In.wid+$margin \  
       at Pager fill 0xd0ece8 behind In
    line invis from 0.25*$margin east of last.sw up last.ht \  
       "Backend" italic aligned

    box ht (Tokenizer.n.y-CG.s.y)+$margin wid In.wid+$margin \  
       at 1/2<Tokenizer.n,CG.s> fill 0xe8d8d0 behind In
    line invis from 0.25*$margin west of last.se up last.ht \  
       "SQL Compiler" italic aligned

    box ht (UT.n.y-TC.s.y)+$margin wid In.wid+$margin \  
       at 1/2<UT,TC> fill 0xe0ecc8 behind In
    line invis from 0.25*$margin west of last.se up last.ht \  
      "Accessories" italic aligned
Interface SQL Command Processor Virtual Machine B-Tree Pager OS Interface Tokenizer Parser Code Generator Utilities Test Code Core Backend SQL Compiler Accessories

Example 9

/*
 Example 9. Original from pikchr.org and fossil-scm.org
 */         
$r = 0.2in
linerad = 0.75*$r
linewid = 0.25

# Start and end blocks
#
box "element" bold fit
line down 50% from last box.sw
dot rad 250% color black
X0: last.e + (0.3,0)
arrow from last dot to X0
move right 3.9in
box wid 5% ht 25% fill black
X9: last.w - (0.3,0)
arrow from X9 to last box.w


# The main rule that goes straight through from start to finish
#
box "object-definition" italic fit at 11/16 way between X0 and X9
arrow to X9
arrow from X0 to last box.w

# The LABEL: rule
#
arrow right $r from X0 then down 1.25*$r then right $r
oval " LABEL " fit
arrow 50%
oval "':'" fit
arrow 200%
box "position" italic fit
arrow
line right until even with X9 - ($r,0) \  
  then up until even with X9 then to X9
arrow from last oval.e right $r*0.5 then up $r*0.8 right $r*0.8
line up $r*0.45 right $r*0.45 then right

# The VARIABLE = rule
#
arrow right $r from X0 then down 2.5*$r then right $r
oval " VARIABLE " fit
arrow 70%
box "assignment-operator" italic fit
arrow 70%
box "expr" italic fit
line right until even with X9 - ($r,0) \  
  then up until even with X9 then to X9

# The PRINT rule
#
arrow right $r from X0 then down 3.75*$r then right $r
oval "'print'" fit
arrow
box "print-args" italic fit
line right until even with X9 - ($r,0) \  
  then up until even with X9 then to X9
element object-definition  LABEL  ':' position  VARIABLE  assignment-operator expr 'print' print-args

Example 10

/*
 Example 10. Original from pikchr.org and fossil-scm.org
 */
    $laneh = 0.75

    # Draw the lanes
    down
    box width 3.5in height $laneh fill 0xacc9e3
    box same fill 0xc5d8ef
    box same as first box
    box same as 2nd box
    line from 1st box.sw+(0.2,0) up until even with 1st box.n \  
      "Alan" above aligned
    line from 2nd box.sw+(0.2,0) up until even with 2nd box.n \  
      "Betty" above aligned
    line from 3rd box.sw+(0.2,0) up until even with 3rd box.n \  
      "Charlie" above aligned
    line from 4th box.sw+(0.2,0) up until even with 4th box.n \  
       "Darlene" above aligned

    # fill in content for the Alice lane
    right
A1: circle rad 0.1in at end of first line + (0.2,-0.2) \  
       fill white thickness 1.5px "1" 
    arrow right 50%
    circle same "2"
    arrow right until even with first box.e - (0.65,0.0)
    ellipse "future" fit fill white height 0.2 width 0.5 thickness 1.5px
A3: circle same at A1+(0.8,-0.3) "3" fill 0xc0c0c0
    arrow from A1 to last circle chop "fork!" below aligned

    # content for the Betty lane
B1: circle same as A1 at A1-(0,$laneh) "1"
    arrow right 50%
    circle same "2"
    arrow right until even with first ellipse.w
    ellipse same "future"
B3: circle same at A3-(0,$laneh) "3"
    arrow right 50%
    circle same as A3 "4"
    arrow from B1 to 2nd last circle chop

    # content for the Charlie lane
C1: circle same as A1 at B1-(0,$laneh) "1"
    arrow 50%
    circle same "2"
    arrow right 0.8in "goes" "offline"
C5: circle same as A3 "5"
    arrow right until even with first ellipse.w \  
      "back online" above "pushes 5" below "pulls 3 &amp; 4" below
    ellipse same "future"

    # content for the Darlene lane
D1: circle same as A1 at C1-(0,$laneh) "1"
    arrow 50%
    circle same "2"
    arrow right until even with C5.w
    circle same "5"
    arrow 50%
    circle same as A3 "6"
    arrow right until even with first ellipse.w
    ellipse same "future"
D3: circle same as B3 at B3-(0,2*$laneh) "3"
    arrow 50%
    circle same "4"
    arrow from D1 to D3 chop
Alan Betty Charlie Darlene 1 2 future 3 fork! 1 2 future 3 4 1 2 goes offline 5 back online pushes 5 pulls 3 & 4 future 1 2 5 6 future 3 4

Example 11

/*
 Example 11. Original from pikchr.org and fossil-scm.org
 */         
        arrow "source" "code"
LA:     box "lexical" "analyzer"
        arrow "tokens" above
P:      box "parser"
        arrow "intermediate" "code" wid 200%
Sem:    box "semantic" "checker"
        arrow
        arrow <-> up from top of LA
LC:     box "lexical" "corrector"
        arrow <-> up from top of P
Syn:    box "syntactic" "corrector"
        arrow up
DMP:    box "diagnostic" "message" "printer"
        arrow <-> right  from east of DMP
ST:     box "symbol" "table"
        arrow from LC.ne to DMP.sw
        arrow from Sem.nw to DMP.se
        arrow <-> from Sem.top to ST.bot
source code lexical analyzer tokens parser intermediate code semantic checker lexical corrector syntactic corrector diagnostic message printer symbol table
/*
 Exemplo 11. Original em pikchr.org e fossil-scm.org
 */
          filewid *= 1.2
Src:      file "pikchr.y"; move
LemonSrc: file "lemon.c"; move
Lempar:   file "lempar.c"; move
          arrow down from LemonSrc.s
CC1:      oval "C-Compiler" ht 50%
          arrow " generates" ljust above
Lemon:    oval "lemon" ht 50%
          arrow from Src chop down until even with CC1 \  
            then to Lemon.nw rad 20px
         "Pikchr source " rjust "code input " rjust \  
            at 2nd vertex of previous
          arrow from Lempar chop down until even with CC1 \  
            then to Lemon.ne rad 20px
          " parser template" ljust " resource file" ljust \  
            at 2nd vertex of previous
PikSrc:   file "pikchr.c" with .n at lineht below Lemon.s
          arrow from Lemon to PikSrc chop
          arrow down from PikSrc.s
CC2:      oval "C-Compiler" ht 50%
          arrow
Out:      file "pikchr.o" "or" "pikchr.exe" wid 110%  
pikchr.y lemon.c lempar.c C-Compiler  generates lemon Pikchr source  code input   parser template  resource file pikchr.c C-Compiler pikchr.o or pikchr.exe

Example 12

/*
 Example 12 André Leite (leite@castlab.org)
 */

margin = .25cm
$gr = 1.618
$height = .25
$width = 2

B1: box "Arrival" rad .5 width $width height $height
L1: line -> down .25 from B1.s + ($width/4,0)
B2: box "Regulation" rad .05 fit
L2: line -> down .25 from B1.s - ($width/4,0)
B3: box "Spontaneous" rad .05 fit
L3: line from B2.s down .25 then left until even with B3.s then to B3.s
D1: dot at L3.s
L4: line down .25 -> 
 X: diamond wid .25 ht .25
L5: line "Yes" small above ljust left from X.w ->
B4: box "Emergency Room" rad .05 fit  wid .6*$width
L6: line -> down .25 from B4.s 
B5: box "Immediate Medical" "Assistance" bold fit rad .05 \
      fill 0xff6b6b color none wid .6*$width
L7: line from X.e right -> "No" small above rjust
B6: box "Reception" fit rad .05  wid .6*$width
L8: line -> from B6.s down until even with B5.n 
B7: box "Vital Signs" "Nurse Assistant" small bold fit rad .1  wid .6*$width
L9: line -> from B7.s down .25
B8: box  "Risk Classification" "Nurse" small bold fit rad .1  wid .6*$width
L10: line right .125 from B8.e then down .6 ->
X1: diamond wid .25 ht .25 fill 0x2171b5
L11: line down .125 -> 
B9: box "Referral" "to UBS" fit rad .1  wid .5*$width
L12: line from L10.end + (0, .25) left 1.25 then down .25 ->
X2: diamond wid .25 ht .25 fill 0x74c476
L11: line down .125 -> 
B10: box "Medical Assistance" "within 120 minutes" bold fit rad .1 wid .5*$width
L13: line from L12.nw left 1.25 then down .25 ->
X3: diamond wid .25 ht .25 fill 0xfaff00
L12: line down .125 -> 
B11: box "Medical Assistance" "within 60 minutes" bold fit rad .1  wid .5*$width
L14: line from L13.nw left 1.25 then down .25 ->
X3: diamond wid .25 ht .25 fill 0xf16913
L14: line down .125 -> 
B12: box "Medical Assistance" "within 10 minutes" bold fit rad .1  wid .5*$width 
        "Emergency?" small at X.s - (0, .075)
Arrival Regulation Spontaneous Yes Emergency Room Immediate Medical Assistance No Reception Vital Signs Nurse Assistant Risk Classification Nurse Referral to UBS Medical Assistance within 120 minutes Medical Assistance within 60 minutes Medical Assistance within 10 minutes Emergency?

Example 13

/*
 Example 13. André Leite (leite@castlab.org)
 */         
$r = 0.2in
linerad = 0.75*$r
linewid = 0.25

CMD2: [
dot rad 250% color black
X0: last.e + (0.3,0)
arrow from last dot to X0
right
C1: oval "/rodovia" fit fill 0xE6B0AA
A0:arrow from C1.w right 5.5*$r behind C1
A1: box "código da rodovia" italic fit fill lightyellow

move right 3.2in from first dot .c
box wid 5% ht 25% fill black
line -> from A1.e to last box.w
"ex. pe-114" italic above with .c at A1.n  color gray
]

move to CMD2.sw then down 3*$r

CMD3: [
dot rad 250% color black
X0: last.e + (0.3,0)
arrow from last dot to X0
right
C1: oval "/notion" fit fill 0xE6B0AA
A0:arrow from C1.w right 5.5*$r behind C1
A1: box "texto para busca" italic fit fill lightyellow

move right 3.2in from first dot .c
box wid 5% ht 25% fill black
line -> from A1.e to last box.w
"ex. aerodromo" italic above with .c at A1.n  color gray
]

move to CMD3.sw then down 3*$r

CMD4: [
dot rad 250% color black
X0: last.e + (0.3,0)
arrow from last dot to X0
right
C1: oval "/cidade" fit fill 0xE6B0AA
A0:arrow from C1.w right 5.5*$r behind C1
A1: box "nome da cidade" italic fit fill lightyellow

move right 3.2in from first dot .c
box wid 5% ht 25% fill black
line -> from A1.e to last box.w
"ex. arcoverde" italic above with .c at A1.n  color gray
]

move to CMD4.sw then down 3*$r

CMD5: [
dot rad 250% color black
X0: last.e + (0.3,0)
arrow from last dot to X0
right
C1: oval "/subacao" fit fill 0xE6B0AA
A0:arrow from C1.w right 5.5*$r behind C1
A1: box "código da subação" italic fit fill lightyellow

move right 3.2in from first dot .c
box wid 5% ht 25% fill black
line -> from A1.e to last box.w
"ex. 0620" italic above with .c at A1.n  color gray
]

move to CMD5.sw then down 3*$r

CMD6: [
D0: dot rad 250% color black
X0: last.e + (0.3,0)
arrow from last dot to X0
right
C1: oval "/fonte" fit fill 0xE6B0AA
A0:arrow from C1.w right 5.5*$r behind C1
A1: box "código da fonte" italic fit fill lightyellow

move right 3.2in from first dot .c
box wid 5% ht 25% fill black
line -> from A1.e to last box.w
"ex. 754" italic above with .c at A1.n  color gray
]

START: line from CMD6.D0.c up 17.5*$r 
box "DER" bold big fit  with .sw at START.end
/rodovia código da rodovia ex. pe-114 /notion texto para busca ex. aerodromo /cidade nome da cidade ex. arcoverde /subacao código da subação ex. 0620 /fonte código da fonte ex. 754 DER

Example 14

/*
 Exemplo 14. Original em pikchr.org e fossil-scm.org
 */
$r = 0.2in
linerad = 0.75*$r
linewid = 0.25

CMD1: [
dot rad 250% color black
X0: last.e + (0.3,0)
arrow from last dot to X0
right
C1: oval "/efiscovalidade" fit fill lightgreen
A0: arrow from C1.w right 5.5*$r behind C1
A1: box "secretaria" italic fit fill 0xD7BDE2
arrow from A0 right 9*$r behind A1
A2: box "dias" italic fit fill lightyellow

arrow from A1.e right $r*0.5 then up $r*1.8 right $r*1.2 then right until even with A2.w
A3: box "inicio" italic fit fill lightyellow
arrow $r
A4: box "fim" italic fit fill lightyellow
line right $r then down $r*1.8  right $r*1.2 then right 
move right 4.2in from first dot .c
box wid 5% ht 25% fill black
line -> from A2.e to last box.w
"ex. semobi" italic above with .c at A1.n color gray
"ex. 7" italic above with .c at A2.n  color gray
"ex. –15" italic above with .c at A3.n  color gray
"ex. 15" italic above with .c at A4.n  color gray
]

move to CMD1.sw then down 3*$r

CMD2: [
dot rad 250% color black
X0: last.e + (0.3,0)
arrow from last dot to X0
right
C1: oval "/efiscocredor" fit fill lightgreen
A0:arrow from C1.w right 5.5*$r behind C1
A1: box "secretaria" italic fit fill 0xD7BDE2
arrow from A0 right 9*$r behind A1
A2: box "nome ou cnpj" italic fit fill lightyellow

move right 4.2in from first dot .c
box wid 5% ht 25% fill black
line -> from A2.e to last box.w
"ex. semobi" italic above with .c at A1.n color gray
"ex. dix " italic above with .c at A2.n  color gray
]

move to CMD2.sw then down 3*$r

CMD3: [
D0: dot rad 250% color black
X0: last.e + (0.3,0)
arrow from last dot to X0
right
C1: oval "/efiscoobjeto" fit fill lightgreen
A0: arrow from C1.w right 5.5*$r behind C1
A1: box "secretaria" italic fit fill 0xD7BDE2
arrow from A0 right 9*$r behind A1
A2: box "texto" italic fit fill lightyellow

move right 4.2in from first dot .c
box wid 5% ht 25% fill black
line -> from A2.e to last box.w
"ex. semobi" italic above with .c at A1.n color gray
"ex. obra " italic above with .c at A2.n  color gray
]

move to CMD3.sw then down 3*$r

CMD4: [
D0: dot rad 250% color black
X0: last.e + (0.3,0)
arrow from last dot to X0
right
C1: oval "/efiscocontrato" fit fill lightgreen
A0: arrow from C1.w right 5.5*$r behind C1
A1: box "secretaria" italic fit fill 0xD7BDE2
arrow from A0 right 9*$r behind A1
A2: box "número/ano" italic fit fill lightyellow

move right 4.2in from first dot .c
box wid 5% ht 25% fill black
line -> from A2.e to last box.w
"ex. semobi" italic above with .c at A1.n color gray
"ex. 17/2023 " italic above with .c at A2.n  color gray
]

move to CMD4.sw then down 3*$r

CMD5: [
D0: dot rad 250% color black
X0: last.e + (0.3,0)
arrow from last dot to X0
right
C1: oval "/efiscosubacao" fit fill lightgreen
A0: arrow from C1.w right 5.5*$r behind C1
A1: box "secretaria" italic fit fill 0xD7BDE2
arrow from A0 right 9*$r behind A1
A2: box "código da subação" italic fit fill lightyellow

move right 4.2in from first dot .c
box wid 5% ht 25% fill black
line -> from A2.e to last box.w
"ex. semobi" italic above with .c at A1.n color gray
"ex. 0000 " italic above with .c at A2.n  color gray
]

move to CMD5.sw then down 3*$r

CMD6: [
D0: dot rad 250% color black
X0: last.e + (0.3,0)
arrow from last dot to X0
right
C1: oval "/efiscofonte" fit fill lightgreen
A0: arrow from C1.w right 5.5*$r behind C1
A1: box "secretaria" italic fit fill 0xD7BDE2
arrow from A0 right 9*$r behind A1
A2: box "código da fonte" italic fit fill lightyellow

move right 4.2in from first dot .c
box wid 5% ht 25% fill black
line -> from A2.e to last box.w
"ex. semobi" italic above with .c at A1.n color gray
"ex. 754" italic above with .c at A2.n  color gray
]

START: line from CMD6.D0.c up 22.5*$r 
box "e-Fisco" bold big fit  with .sw at START.end
/efiscovalidade secretaria dias inicio fim ex. semobi ex. 7 ex. –15 ex. 15 /efiscocredor secretaria nome ou cnpj ex. semobi ex. dix  /efiscoobjeto secretaria texto ex. semobi ex. obra  /efiscocontrato secretaria número/ano ex. semobi ex. 17/2023  /efiscosubacao secretaria código da subação ex. semobi ex. 0000  /efiscofonte secretaria código da fonte ex. semobi ex. 754 e-Fisco

Example 15

/*
 Example 15. André Leite (leite@castlab.org)
 */         

$r = 0.2in
linerad = 0.75*$r
linewid = 0.25


CMD1: [
         dot rad 250% color black
         X0: last.e + (0.3,0)
         arrow from last dot to X0
         right
         C1: oval "/tcevalidade" fit fill lightblue
         A0: arrow from C1.w right 5.5*$r behind C1
         A1: box "secretaria" italic fit fill 0xD7BDE2
         arrow from A0 right 9*$r behind A1
         A2: box "dias" italic fit fill lightyellow
         
         arrow from A1.e right $r*0.5 then up $r*1.8 right $r*1.2 then right until even with A2.w
         A3: box "inicio" italic fit fill lightyellow
         arrow $r
         A4: box "fim" italic fit fill lightyellow
         line right $r then down $r*1.8  right $r*1.2 then right 
         move right 4.2in from first dot .c
         box wid 5% ht 25% fill black
         line -> from A2.e to last box.w
         "ex. semobi" italic above with .c at A1.n color gray
         "ex. 7" italic above with .c at A2.n  color gray
         "ex. –15" italic above with .c at A3.n  color gray
         "ex. 15" italic above with .c at A4.n  color gray
]
       
move to CMD1.sw then down 3*$r
       
TCECDR: [
         dot rad 250% color black
         X0: last.e + (0.3,0)
         arrow from last dot to X0
         right
         C1: oval "/tcecredor" fit fill lightblue
         A0:arrow from C1.w right 5.5*$r behind C1
         A1: box "secretaria" italic fit fill 0xD7BDE2
         arrow from A0 right 9*$r behind A1
         A2: box "nome ou cnpj" italic fit fill lightyellow
         
         move right 4.2in from first dot .c
         box wid 5% ht 25% fill black
         line -> from A2.e to last box.w
         "ex. semobi" italic above with .c at A1.n color gray
         "ex. dix " italic above with .c at A2.n  color gray
]
       
move to TCECDR.sw then down 3*$r
       
TCEOBJ: [
         D0: dot rad 250% color black
         X0: last.e + (0.3,0)
         arrow from last dot to X0
         right
         C1: oval "/tceobjeto" fit fill lightblue
         A0: arrow from C1.w right 5.5*$r behind C1
         A1: box "secretaria" italic fit fill 0xD7BDE2
         arrow from A0 right 9*$r behind A1
         A2: box "texto para busca" italic fit fill lightyellow
         
         move right 4.2in from first dot .c
         box wid 5% ht 25% fill black
         line -> from A2.e to last box.w
         "ex. semobi" italic above with .c at A1.n color gray
         "ex. obra " italic above with .c at A2.n  color gray
]
       
move to TCEOBJ.sw then down 3*$r
       
TCECTT: [
         D0: dot rad 250% color black
         X0: last.e + (0.3,0)
         arrow from last dot to X0
         right
         C1: oval "/tcecontrato" fit fill lightblue
         A0: arrow from C1.w right 5.5*$r behind C1
         A1: box "secretaria" italic fit fill 0xD7BDE2
         arrow from A0 right 9*$r behind A1
         A2: box "número/ano" italic fit fill lightyellow
         
         move right 4.2in from first dot .c
         box wid 5% ht 25% fill black
         line -> from A2.e to last box.w
         "ex. semobi" italic above with .c at A1.n color gray
         "ex. 17/2023 " italic above with .c at A2.n  color gray
]
       
START: line from TCECTT.D0.c up 14.5*$r 
box "Remessa TCE" bold big fit  with .sw at START.end
/tcevalidade secretaria dias inicio fim ex. semobi ex. 7 ex. –15 ex. 15 /tcecredor secretaria nome ou cnpj ex. semobi ex. dix  /tceobjeto secretaria texto para busca ex. semobi ex. obra  /tcecontrato secretaria número/ano ex. semobi ex. 17/2023  Remessa TCE