From 90674a0f85c42bbc755a9da5999ff2895c6ff378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vlastimil=20Slint=C3=A1k?= Date: Mon, 15 Dec 2025 18:09:52 +0100 Subject: [PATCH] Panelize PCB before making fabrication files KiKit plugin is used to make a frame with Vcuts and tooling holes around the LinHT PCB. --- Makefile | 17 +++++++++++------ panel.json | 31 +++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 panel.json diff --git a/Makefile b/Makefile index f89dfb7..3f81f32 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: all render fabrication web clean +.PHONY: all render models fabrication web clean BOARD = linht-hw @@ -27,11 +27,11 @@ STATIC_DIRS := $(shell find present/template -mindepth 1 -maxdepth 1 -type d) GERBER_ZIPS = $(foreach fab,$(FABHOUSES),$(TEMPLATE_FAB_DIR)/gerbers_$(fab).zip) -all: render fabrication web +all: render models fabrication web web: $(MARKDOWN_HTML) $(COPIED_J2) $(COPIED_JSON) $(RENDERED_HTML) -fabrication: $(BOARD).kicad_pcb $(BOARD).kicad_sch $(GERBER_ZIPS) +fabrication: $(TEMPLATE_BUILD_DIR)/panel/$(BOARD)_panel.kicad_pcb $(BOARD).kicad_sch $(GERBER_ZIPS) @mkdir -p $(TEMPLATE_FAB_DIR) kicad-cli sch export pdf $(word 2,$^) -o $(TEMPLATE_FAB_DIR)/$(BOARD)_schematic.pdf kicad-cli sch export pdf -b -n -o $(TEMPLATE_FAB_DIR)/$(BOARD)_schematic_bw.pdf $(word 2,$^) @@ -41,6 +41,8 @@ fabrication: $(BOARD).kicad_pcb $(BOARD).kicad_sch $(GERBER_ZIPS) kicad-cli pcb export pos $< --side both --format csv --units mm -o $(TEMPLATE_FAB_DIR)/$(BOARD)_pos.csv kicad-cli pcb export pos $< --side both --format ascii --units mm -o $(TEMPLATE_FAB_DIR)/$(BOARD)_pos.txt sed -e '1 s/Ref/Designator/' -e '1 s/PosX/Mid X/' -e '1 s/PosY/Mid Y/' -e '1 s/Rot/Rotation/' -e '1 s/Side/Layer/' $(TEMPLATE_FAB_DIR)/$(BOARD)_pos.csv > $(TEMPLATE_FAB_DIR)/$(BOARD)_pos_jlcpcb.csv + +models: $(BOARD).kicad_pcb kicad-cli pcb export step --subst-models $< -o $(TEMPLATE_FAB_DIR)/$(BOARD)_model.step ; \ rc=$$?; if [ $$rc -ne 0 ] && [ $$rc -ne 2 ]; then exit $$rc; fi kicad-cli pcb export vrml $< -o $(TEMPLATE_FAB_DIR)/$(BOARD)_model.vrml @@ -55,12 +57,15 @@ render: $(BOARD).kicad_pcb kicad-cli pcb render $(RENDER_ARGS) --side bottom -o $(TEMPLATE_RENDER_DIR)/$(BOARD)-back.png $^ kicad-cli pcb render $(RENDER_ARGS) --side top --rotate "315,0,315" -o $(TEMPLATE_RENDER_DIR)/$(BOARD)-preview.png $^ - -$(TEMPLATE_FAB_DIR)/gerbers_%.zip: $(BOARD).kicad_pcb - kikit fab $* --no-drc $< $(TEMPLATE_BUILD_DIR)/fab_$* +$(TEMPLATE_FAB_DIR)/gerbers_%.zip: $(TEMPLATE_BUILD_DIR)/panel/$(BOARD)_panel.kicad_pcb @mkdir -p $(TEMPLATE_FAB_DIR) + kikit fab $* --no-drc $< $(TEMPLATE_BUILD_DIR)/fab_$* @cp $(TEMPLATE_BUILD_DIR)/fab_$*/gerbers.zip $@ +$(TEMPLATE_BUILD_DIR)/panel/$(BOARD)_panel.kicad_pcb: $(BOARD).kicad_pcb + @mkdir -p $(TEMPLATE_BUILD_DIR)/panel + kikit panelize -p ./panel.json $< $@ + # Convert .md → build/.html using python-markdown build/%.html: %.md @mkdir -p build diff --git a/panel.json b/panel.json new file mode 100644 index 0000000..88bbe4c --- /dev/null +++ b/panel.json @@ -0,0 +1,31 @@ +{ + "tabs": { + "type": "full", + "patchcorners": "False" + }, + "cuts": { + "type": "vcuts" + }, + "framing": { + "type": "frame" + }, + "tooling": { + "type": "3hole", + "hoffset": "3mm", + "voffset": "15mm" + }, + "fiducials": { + "type": "3fid", + "hoffset": "3mm", + "voffset": "10mm" + }, + "text": { + "type": "simple", + "hoffset": "0mm", + "voffset": "3mm", + "width": "2.0mm", + "height": "2.0mm", + "hjustify": "center", + "text": "LinHT PCB" + } +} \ No newline at end of file