This commit is contained in:
cpu
2026-06-14 14:07:32 +02:00
parent 70a48539bb
commit c750849779
4 changed files with 47 additions and 30 deletions

View File

@@ -2,8 +2,8 @@
set -euo pipefail
GERBERS_DIR="output/gerbers"
GCODE_DIR="output/gcode"
GERBERS_DIR="gerbers"
GCODE_DIR="gcode"
usage() {
echo "Usage: $0 <kicad_pcb_file>"
@@ -11,6 +11,7 @@ usage() {
}
PCB_FILE="$1"
PCB_FILE_PREFIX="$(basename "$PCB_FILE" .kicad_pcb)" # Fix this
mkdir -p "$GERBERS_DIR"
mkdir -p "$GCODE_DIR"
@@ -18,20 +19,44 @@ mkdir -p "$GCODE_DIR"
# Export drill, front and back layers as gerber files.
echo "Exporting gerbers..."
kicad-cli pcb export drill -o "$GERBERS_DIR" "$PCB_FILE"
kicad-cli pcb export gerbers -o "$GERBERS_DIR" -l Front "$PCB_FILE"
kicad-cli pcb export gerbers -o "$GERBERS_DIR" -l Back "$PCB_FILE"
# kicad-cli pcb export gerbers -o "$GERBERS_DIR" -l Front "$PCB_FILE"
# kicad-cli pcb export gerbers -o "$GERBERS_DIR" -l Back "$PCB_FILE"
kicad-cli pcb export gerbers -o "$GERBERS_DIR" -l Edge.Cuts "$PCB_FILE"
# Export outlines of the penelized board i.e. use the layer 'User.Eco1'.
# echo "Exporting panelized outlines from layer 'User.Eco1'..."
# python3 export_panel_outlines_gerber.py \
# --layers User.Eco1 \
# --output "$GERBERS_DIR" \
# "$PCB_FILE"
# Input layers/filenames and all milling/drilling parameters are taken from the config file: 'millproject'.
echo "Exporting Gcode..."
echo "Exporting Gcode for drilling and outline routing..."
docker run --rm -i -t \
-u "$(id -u):$(id -g)" \
-v "$(pwd):/data" \
ptodorov/pcb2gcode
ptodorov/pcb2gcode \
--config millproject \
--output-dir "$GCODE_DIR" \
--drill "$GERBERS_DIR/$PCB_FILE_PREFIX.drl" \
--outline "$GERBERS_DIR/$PCB_FILE_PREFIX-Edge_Cuts.gm1"
# Export outlines of the panelized board i.e. use the layer 'User.Eco1'.
echo "Exporting panelized outline from layer 'User.Eco1'..."
python3 export_panel_outlines_gerber.py \
--layers User.Eco1 \
--output "$GERBERS_DIR" \
"$PCB_FILE"
echo "Exporting Gcode for panelized board's slot routing..."
# Use the 'User-Eco1' layer instead as it contains panelized board's slot outlines only.
docker run --rm -i -t \
-u "$(id -u):$(id -g)" \
-v "$(pwd):/data" \
ptodorov/pcb2gcode \
--config millproject \
--output-dir "$GCODE_DIR" \
--outline "$GERBERS_DIR/$PCB_FILE_PREFIX-User-Eco1.gbr" \
--outline-output "slot_outline.ngc"
# echo "Exporting Gcode for isolation traces routing..."
# docker run --rm -i -t \
# -u "$(id -u):$(id -g)" \
# -v "$(pwd):/data" \
# ptodorov/pcb2gcode \
# --config millproject \
# --output-dir "$GCODE_DIR" \
# --front "$GERBERS_DIR/$PCB_FILE_PREFIX-Front.gtl" \
# --back "$GERBERS_DIR/$PCB_FILE_PREFIX-Back.gbl" \