Browse Source

generate separate front and back layouts for docs

Thomas Buck 9 months ago
parent
commit
da3814a868

+ 1
- 1
.github/workflows/docs.yml View File

@@ -54,7 +54,7 @@ jobs:
54 54
         run: |
55 55
           sudo add-apt-repository --yes ppa:kicad/kicad-7.0-releases
56 56
           sudo apt update
57
-          sudo apt install -y --install-recommends kicad pipx libfuse2 libegl1
57
+          sudo apt install -y --install-recommends kicad pipx libfuse2 libegl1 poppler-utils
58 58
 
59 59
       - name: Install latest mdbook
60 60
         run: |

+ 2
- 2
docs/generate_docs.sh View File

@@ -36,9 +36,9 @@ cp -r ../hardware/plot src
36 36
 echo "Generating plot includes"
37 37
 rm -rf src/inc_dispensy_sch.md
38 38
 echo "<script src=\"js/svg-pan-zoom.js\" charset=\"UTF-8\"></script>" >> src/inc_dispensy_sch.md
39
-for f in `ls src/plot/dispensy_sch.svg/*.svg | sort -r`; do
39
+for f in `ls src/plot/dispensy.kicad_sch.svg/*.svg | sort -r`; do
40 40
     file=`echo $f | sed 's:src/:./:g'`
41
-    name=`echo $f | sed 's:src/plot/dispensy_sch.svg/::g' | sed 's:.svg::g'`
41
+    name=`echo $f | sed 's:src/plot/dispensy.kicad_sch.svg/::g' | sed 's:.svg::g'`
42 42
     echo $name
43 43
     echo "<h2>$name</h2>" >> src/inc_dispensy_sch.md
44 44
     echo "<div style=\"background-color: white; border: 1px solid black;\">" >> src/inc_dispensy_sch.md

+ 37
- 7
docs/src/main_board_pcb.md View File

@@ -2,21 +2,51 @@
2 2
 
3 3
 This page shows the current version of the PCB layout as SVG graphics.
4 4
 
5
-You can also view the [Main-Board PCB layout as PDF](./plot/dispensy_pcb.pdf).
5
+You can also view the [Main-Board PCB layout as PDF](./plot/dispensy.kicad_pcb.pdf).
6 6
 
7 7
 ## 2D PCB Layout
8 8
 
9
+### Front & Back
10
+
11
+<script src="js/svg-pan-zoom.js" charset="UTF-8"></script>
12
+<div style="background-color: white; border: 1px solid black;">
13
+    <embed type="image/svg+xml" src="./plot/dispensy.kicad_pcb.svg/0_both.svg" id="pz_dispensy0" style="width: 100%;"/>
14
+    <script>
15
+        document.getElementById('pz_dispensy0').addEventListener('load', function(){
16
+            svgPanZoom(document.getElementById('pz_dispensy0'), {controlIconsEnabled: true, minZoom: 1.0});
17
+        })
18
+    </script>
19
+</div>
20
+
21
+[Direct link to this file](./plot/dispensy.kicad_pcb.svg/0_both.svg).
22
+
23
+### Front
24
+
25
+<script src="js/svg-pan-zoom.js" charset="UTF-8"></script>
26
+<div style="background-color: white; border: 1px solid black;">
27
+    <embed type="image/svg+xml" src="./plot/dispensy.kicad_pcb.svg/1_front.svg" id="pz_dispensy1" style="width: 100%;"/>
28
+    <script>
29
+        document.getElementById('pz_dispensy1').addEventListener('load', function(){
30
+            svgPanZoom(document.getElementById('pz_dispensy1'), {controlIconsEnabled: true, minZoom: 1.0});
31
+        })
32
+    </script>
33
+</div>
34
+
35
+[Direct link to this file](./plot/dispensy.kicad_pcb.svg/1_front.svg).
36
+
37
+### Back
38
+
9 39
 <script src="js/svg-pan-zoom.js" charset="UTF-8"></script>
10 40
 <div style="background-color: white; border: 1px solid black;">
11
-    <embed type="image/svg+xml" src="./plot/dispensy_pcb.svg" id="pz_dispensy" style="width: 100%;"/>
41
+    <embed type="image/svg+xml" src="./plot/dispensy.kicad_pcb.svg/2_back.svg" id="pz_dispensy2" style="width: 100%;"/>
12 42
     <script>
13
-        document.getElementById('pz_dispensy').addEventListener('load', function(){
14
-            svgPanZoom(document.getElementById('pz_dispensy'), {controlIconsEnabled: true, minZoom: 1.0});
43
+        document.getElementById('pz_dispensy2').addEventListener('load', function(){
44
+            svgPanZoom(document.getElementById('pz_dispensy2'), {controlIconsEnabled: true, minZoom: 1.0});
15 45
         })
16 46
     </script>
17 47
 </div>
18 48
 
19
-[Direct link to this file](./plot/dispensy_pcb.svg).
49
+[Direct link to this file](./plot/dispensy.kicad_pcb.svg/2_back.svg).
20 50
 
21 51
 ## 3D PCB Model
22 52
 
@@ -28,7 +58,7 @@ You can also view the [Main-Board PCB layout as PDF](./plot/dispensy_pcb.pdf).
28 58
     var info = document.getElementById('3d_info');
29 59
     import * as View from './js/modelview.js';
30 60
     View.init(view, info);
31
-    const file = './plot/dispensy_pcb.3mf';
61
+    const file = './plot/dispensy.3mf';
32 62
     var xhttp = new XMLHttpRequest();
33 63
     xhttp.responseType = 'arraybuffer';
34 64
     xhttp.onload = function() {
@@ -51,4 +81,4 @@ You can also view the [Main-Board PCB layout as PDF](./plot/dispensy_pcb.pdf).
51 81
     xhttp.send();
52 82
 </script>
53 83
 
54
-[Direct link to this file](./plot/dispensy_pcb.3mf).
84
+[Direct link to this file](./plot/dispensy.3mf).

+ 1
- 1
docs/src/main_board_sch.md View File

@@ -2,6 +2,6 @@
2 2
 
3 3
 This page shows the current version of the schematics as SVG graphics.
4 4
 
5
-You can also view the [Main-Board schematics as PDF](./plot/dispensy_sch.pdf).
5
+You can also view the [Main-Board schematics as PDF](./plot/dispensy.kicad_sch.pdf).
6 6
 
7 7
 {{#include inc_dispensy_sch.md}}

+ 80
- 29
hardware/generate_plot.sh View File

@@ -26,42 +26,93 @@
26 26
 # | source.                                                                      |
27 27
 #  ------------------------------------------------------------------------------
28 28
 
29
-cd "$(dirname "$0")"
30
-
29
+INSCH="dispensy.kicad_sch"
30
+INPCB="dispensy.kicad_pcb"
31 31
 OUTDIR="plot"
32
-LAYER="F.Cu,B.Cu,F.Mask,B.Mask,F.Paste,B.Paste,F.Silkscreen,B.Silkscreen,Edge.Cuts,User.Drawings"
32
+LAYER_F="F.Cu,F.Mask,F.Paste,F.Silkscreen,Edge.Cuts,User.Drawings"
33
+LAYER_B="B.Cu,B.Mask,B.Paste,B.Silkscreen,Edge.Cuts,User.Drawings"
33 34
 
35
+cd "$(dirname "$0")"
34 36
 rm -rf $OUTDIR
35 37
 mkdir -p $OUTDIR
36 38
 
37
-for VAR in pdf svg
39
+#  --------------
40
+# | 2D Schematic |
41
+#  --------------
42
+
43
+for IN in $INSCH
38 44
 do
39
-    echo "Exporting schematic $VAR"
40
-    rm -rf $OUTDIR/dispensy_sch.$VAR
41
-    kicad-cli sch export $VAR \
42
-        -t "KiCad Default" \
43
-        -o $OUTDIR/dispensy_sch.$VAR \
44
-        dispensy.kicad_sch
45
-
46
-    echo "Exporting board $VAR"
47
-    rm -rf $OUTDIR/dispensy_pcb.$VAR
48
-    kicad-cli pcb export $VAR \
49
-        -t "KiCad Classic"  \
50
-        -l $LAYER \
51
-        -o $OUTDIR/dispensy_pcb.$VAR \
52
-        dispensy.kicad_pcb
53
-    echo
45
+    echo "Exporting schematic $IN"
46
+
47
+    for TYPE in pdf svg
48
+    do
49
+        echo "Exporting schematic $TYPE"
50
+        rm -rf $OUTDIR/$IN.$TYPE
51
+        kicad-cli sch export $TYPE \
52
+            -t "KiCad Default" \
53
+            -o $OUTDIR/$IN.$TYPE \
54
+            $IN
55
+        echo
56
+    done
54 57
 done
55 58
 
56
-echo "Exporting board step file"
57
-rm -rf $OUTDIR/dispensy_pcb.step
58
-kicad-cli pcb export step \
59
-    -o $OUTDIR/dispensy_pcb.step \
60
-    dispensy.kicad_pcb
59
+for IN in $INPCB
60
+do
61
+    echo "Exporting board $IN"
62
+
63
+    #  -----------
64
+    # | 2D Layout |
65
+    #  -----------
66
+
67
+    for TYPE in pdf svg
68
+    do
69
+        rm -rf $OUTDIR/$IN.$TYPE
70
+        mkdir -p $OUTDIR/$IN.$TYPE
61 71
 
62
-echo "Converting step to 3mf"
63
-rm -rf $OUTDIR/dispensy_pcb.3mf
64
-prusa-slicer --export-3mf $OUTDIR/dispensy_pcb.step
72
+        echo "Exporting board $TYPE"
73
+        kicad-cli pcb export $TYPE \
74
+            -t "KiCad Classic"  \
75
+            -l $LAYER_F,$LAYER_B \
76
+            -o $OUTDIR/$IN.$TYPE/0_both.$TYPE \
77
+            $IN
78
+        echo
65 79
 
66
-echo "Deleting step file"
67
-rm -rf $OUTDIR/dispensy_pcb.step
80
+        echo "Exporting board front $TYPE"
81
+        kicad-cli pcb export $TYPE \
82
+            -t "KiCad Classic"  \
83
+            -l $LAYER_F \
84
+            -o $OUTDIR/$IN.$TYPE/1_front.$TYPE \
85
+            $IN
86
+        echo
87
+
88
+        echo "Exporting board back $TYPE"
89
+        kicad-cli pcb export $TYPE \
90
+            -t "KiCad Classic"  \
91
+            -l $LAYER_B \
92
+            -o $OUTDIR/$IN.$TYPE/2_back.$TYPE \
93
+            $IN
94
+        echo
95
+    done
96
+
97
+    echo "Concatenating board PDFs"
98
+    mv $OUTDIR/$IN.pdf $OUTDIR/$IN.tmp
99
+    pdfunite $OUTDIR/$IN.tmp/*.pdf $OUTDIR/$IN.pdf
100
+    rm -rf $OUTDIR/$IN.tmp
101
+
102
+    #  -----------
103
+    # | 3D Export |
104
+    #  -----------
105
+
106
+    echo "Exporting board step file"
107
+    rm -rf $OUTDIR/$IN.step
108
+    kicad-cli pcb export step \
109
+        -o $OUTDIR/$IN.step \
110
+        $IN
111
+
112
+    echo "Converting step to 3mf"
113
+    rm -rf $OUTDIR/$IN.3mf
114
+    prusa-slicer --export-3mf $OUTDIR/$IN.step
115
+
116
+    echo "Deleting step file"
117
+    rm -rf $OUTDIR/$IN.step
118
+done

Loading…
Cancel
Save