adapted for non-panelized boards
This commit is contained in:
@@ -17,7 +17,6 @@ nano millproject
|
||||
Launch the `gSender` program.
|
||||
* Load the `gcode/drill.ngc` file for drilling holes.
|
||||
* Load the `gcode/outline.ngc` file for milling the board outlines.
|
||||
* Load the `gcode/slot_outline.ngc` file for milling the panelized slot outlines.
|
||||
* Load the `gcode/back.ngc` file if you want to mill the isolation traces.
|
||||
* Load the `gcode/front.ngc` file if you want to mill the isolation traces.
|
||||
|
||||
|
||||
48
export.sh
48
export.sh
@@ -11,55 +11,29 @@ usage() {
|
||||
}
|
||||
|
||||
PCB_FILE="$1"
|
||||
PCB_FILE_PREFIX="$(basename "$PCB_FILE" .kicad_pcb)" # Fix this
|
||||
PCB_FILE_PREFIX="$(basename "$PCB_FILE" .kicad_pcb)"
|
||||
|
||||
mkdir -p "$GERBERS_DIR"
|
||||
mkdir -p "$GCODE_DIR"
|
||||
|
||||
# Export drill, front and back layers as gerber files.
|
||||
# Export drill, outline, front and back layers as gerber files.
|
||||
echo "Exporting gerbers..."
|
||||
kicad-cli pcb export drill --generate-map -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 Edge.Cuts "$PCB_FILE"
|
||||
kicad-cli pcb export svg -o "$GERBERS_DIR" -l Edge.Cuts \
|
||||
--mode-multi --page-size-mode 1 --black-and-white \
|
||||
--drill-shape-opt 0 --exclude-drawing-sheet "$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 svg -o "$GERBERS_DIR" -l Edge.Cuts \
|
||||
# --mode-multi --page-size-mode 1 --black-and-white \
|
||||
# --drill-shape-opt 0 --exclude-drawing-sheet "$PCB_FILE"
|
||||
|
||||
echo "Exporting Gcode for drilling and outline routing..."
|
||||
docker run --rm -i -t \
|
||||
echo "Exporting Gcode for drilling, outline and isolation traces routing..."
|
||||
docker run --rm -it \
|
||||
-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" \
|
||||
--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 of 'Edge.Cuts' 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" \
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import os
|
||||
import pcbnew
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Export a single PCB layer to a Gerber file using pcbnew."
|
||||
)
|
||||
parser.add_argument("input", help="Input .kicad_pcb file")
|
||||
parser.add_argument("--output", "-o", required=True, help="Output directory")
|
||||
parser.add_argument("--layers", "-l", required=True,
|
||||
help="Layer name to export (e.g. User.Eco1)")
|
||||
args = parser.parse_args()
|
||||
|
||||
board = pcbnew.LoadBoard(args.input)
|
||||
|
||||
# Resolve layer name to ID
|
||||
layer_id = board.GetLayerID(args.layers)
|
||||
if layer_id == -1:
|
||||
parser.error(f"Unknown layer: {args.layers!r}. "
|
||||
f"Run with a known layer name (e.g. User.Eco1, Edge.Cuts).")
|
||||
|
||||
# Resolve output directory to absolute path so pcbnew doesn't make it
|
||||
# relative to the board file location
|
||||
output_dir = os.path.abspath(args.output)
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
prefix = args.layers.replace(".", "-")
|
||||
|
||||
pc = pcbnew.PLOT_CONTROLLER(board)
|
||||
po = pc.GetPlotOptions()
|
||||
po.SetOutputDirectory(output_dir)
|
||||
po.SetPlotFrameRef(False)
|
||||
|
||||
pc.SetLayer(layer_id)
|
||||
pc.OpenPlotfile(prefix, pcbnew.PLOT_FORMAT_GERBER, args.layers)
|
||||
print(f"Plotting layer {args.layers!r} (id={layer_id}) to {pc.GetPlotFileName()}")
|
||||
pc.PlotLayer()
|
||||
pc.ClosePlot()
|
||||
print("Done.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -41,6 +41,6 @@ cut-speed=24000
|
||||
cut-side=back
|
||||
|
||||
# Tabs
|
||||
#bridgesnum=4 # Total 4 tabs
|
||||
#bridges=0.5 # Tab width 0.5 mm
|
||||
#zbridges=0 # bridges height (default to zsafe)
|
||||
bridgesnum=4 # Total 4 tabs
|
||||
bridges=0.5 # Tab width 0.5 mm
|
||||
zbridges=0.8 # bridges height (default to zsafe)
|
||||
|
||||
Reference in New Issue
Block a user