Нема описа
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

generate_plot.sh 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/bin/bash
  2. # SPDX-FileCopyrightText: 2023 - 2024 Thomas Buck <thomas@xythobuz.de>
  3. # SPDX-License-Identifier: CERN-OHL-S-2.0+
  4. #
  5. # ------------------------------------------------------------------------------
  6. # | Copyright (c) 2023 - 2024 Thomas Buck <thomas@xythobuz.de> |
  7. # | |
  8. # | This source describes Open Hardware and is licensed under the CERN-OHL-S v2 |
  9. # | or any later version. |
  10. # | |
  11. # | You may redistribute and modify this source and make products using it under |
  12. # | the terms of the CERN-OHL-S v2 (https://ohwr.org/cern_ohl_s_v2.txt) |
  13. # | or any later version. |
  14. # | |
  15. # | This source is distributed WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, |
  16. # | INCLUDING OF MERCHANTABILITY, SATISFACTORY QUALITY AND FITNESS FOR A |
  17. # | PARTICULAR PURPOSE. Please see the CERN-OHL-S v2 (or any later version) |
  18. # | for applicable conditions. |
  19. # | |
  20. # | Source location: https://github.com/drinkrobotics/dispensy |
  21. # | |
  22. # | As per CERN-OHL-S v2 section 4, should You produce hardware based on this |
  23. # | source, You must where practicable maintain the Source Location visible |
  24. # | on the external case of the Gizmo or other products you make using this |
  25. # | source. |
  26. # ------------------------------------------------------------------------------
  27. INSCH="dispensy.kicad_sch"
  28. INPCB="dispensy.kicad_pcb"
  29. OUTDIR="plot"
  30. LAYER_F="F.Cu,F.Mask,F.Paste,F.Silkscreen,Edge.Cuts,User.Drawings"
  31. LAYER_B="B.Cu,B.Mask,B.Paste,B.Silkscreen,Edge.Cuts,User.Drawings"
  32. cd "$(dirname "$0")"
  33. rm -rf $OUTDIR
  34. mkdir -p $OUTDIR
  35. # --------------
  36. # | 2D Schematic |
  37. # --------------
  38. for IN in $INSCH
  39. do
  40. echo "Exporting schematic $IN"
  41. for TYPE in pdf svg
  42. do
  43. echo "Exporting schematic $TYPE"
  44. rm -rf $OUTDIR/$IN.$TYPE
  45. kicad-cli sch export $TYPE \
  46. -t "KiCad Default" \
  47. -o $OUTDIR/$IN.$TYPE \
  48. $IN
  49. echo
  50. done
  51. done
  52. for IN in $INPCB
  53. do
  54. echo "Exporting board $IN"
  55. # -----------
  56. # | 2D Layout |
  57. # -----------
  58. for TYPE in pdf svg
  59. do
  60. rm -rf $OUTDIR/$IN.$TYPE
  61. mkdir -p $OUTDIR/$IN.$TYPE
  62. echo "Exporting board $TYPE"
  63. kicad-cli pcb export $TYPE \
  64. -t "KiCad Classic" \
  65. -l $LAYER_B,$LAYER_F \
  66. -o $OUTDIR/$IN.$TYPE/0_both.$TYPE \
  67. $IN
  68. echo
  69. echo "Exporting board front $TYPE"
  70. kicad-cli pcb export $TYPE \
  71. -t "KiCad Classic" \
  72. -l $LAYER_F \
  73. -o $OUTDIR/$IN.$TYPE/1_front.$TYPE \
  74. $IN
  75. echo
  76. echo "Exporting board back $TYPE"
  77. kicad-cli pcb export $TYPE \
  78. -t "KiCad Classic" \
  79. -l $LAYER_B \
  80. -o $OUTDIR/$IN.$TYPE/2_back.$TYPE \
  81. $IN
  82. echo
  83. done
  84. echo "Concatenating board PDFs"
  85. mv $OUTDIR/$IN.pdf $OUTDIR/$IN.tmp
  86. pdfunite $OUTDIR/$IN.tmp/*.pdf $OUTDIR/$IN.pdf
  87. rm -rf $OUTDIR/$IN.tmp
  88. # -----------
  89. # | 3D Export |
  90. # -----------
  91. echo "Exporting board 3D"
  92. kicad-cli pcb export vrml \
  93. -o $OUTDIR/$IN.wrl \
  94. $IN
  95. done