From 8f7545c21f30183882121689b7d5dfbf72373f7f Mon Sep 17 00:00:00 2001 From: David Holdeman Date: Wed, 15 Mar 2023 07:29:26 -0500 Subject: [PATCH] add scripts --- bin/export-vrml.py | 10 ++++++++++ bin/export.sh | 27 +++++++++++++++++++++++++++ bin/fill-zones.py | 8 ++++++++ 3 files changed, 45 insertions(+) create mode 100644 bin/export-vrml.py create mode 100644 bin/export.sh create mode 100644 bin/fill-zones.py diff --git a/bin/export-vrml.py b/bin/export-vrml.py new file mode 100644 index 0000000..5f7993f --- /dev/null +++ b/bin/export-vrml.py @@ -0,0 +1,10 @@ +import sys +from pcbnewTransition.pcbnew import LoadBoard, EXPORTER_VRML + +b = LoadBoard(sys.argv[1]) +e = EXPORTER_VRML(b) + +x = float(sys.argv[2]) +y = float(sys.argv[3]) + +e.ExportVRML_File(b.GetProject(), None, sys.argv[4], 1.0, False, True, None, x, y) diff --git a/bin/export.sh b/bin/export.sh new file mode 100644 index 0000000..50c1a9b --- /dev/null +++ b/bin/export.sh @@ -0,0 +1,27 @@ +#!/bin/env bash + +if [ -z "$1" ]; then + echo "Pass file name without extension" + exit 1 +fi + +IN="$1" + +cp "$IN.kicad_pcb" "$IN.kicad_pcb.bak" + +kicad-cli sch export pdf "$IN.kicad_sch" --no-background-color -o "gerber/$IN.pdf" +kicad-cli sch export netlist "$IN.kicad_sch" --format kicadxml -o "gerber/$IN.net" +python hellen-one/kicad/hellen-one-kicad-bom-plugin.py "gerber/$IN.net" "gerber/$IN.csv" + +X=$(grep "aux_axis_origin" "$IN.kicad_pcb" | tr -s ' ' | cut -d ' ' -f 3) +Y=$(grep "aux_axis_origin" "$IN.kicad_pcb" | tr -s ' ' | cut -d ' ' -f 4 | tr -d ')') + +python fill-zones.py "$IN.kicad_pcb" + +kicad-cli pcb export gerbers --disable-aperture-macros -l "F.Cu,B.Cu,F.Paste,F.SilkS,B.SilkS,F.Mask,B.Mask,Edge.Cuts,In2.Cu,In1.Cu" --no-x2 "$IN.kicad_pcb" -o gerber/ +kicad-cli pcb export drill --map-format ps --drill-origin plot --excellon-zeros-format suppressleading "$IN.kicad_pcb" -o gerber/ +kicad-cli pcb export pos --format csv --units mm --use-drill-file-origin "$IN.kicad_pcb" -o "gerber/$IN-all-pos.csv" + +python export-vrml.py "$IN.kicad_pcb" "$X" "$Y" "gerber/$IN.wrl" + +cp "$IN.kicad_pcb.bak" "$IN.kicad_pcb" diff --git a/bin/fill-zones.py b/bin/fill-zones.py new file mode 100644 index 0000000..d66807d --- /dev/null +++ b/bin/fill-zones.py @@ -0,0 +1,8 @@ +import sys +from pcbnewTransition.pcbnew import LoadBoard, ZONE_FILLER, SaveBoard + +b = LoadBoard(sys.argv[1]) +bz = b.Zones() +zf = ZONE_FILLER(b).Fill(bz) + +SaveBoard(sys.argv[1], b)