Panelize PCB before making fabrication files

KiKit plugin is used to make a frame with Vcuts and tooling holes around
the LinHT PCB.
This commit is contained in:
Vlastimil Slinták 2025-12-15 18:09:52 +01:00 committed by Wojciech Kaczmarski
parent 2977c3a3d4
commit 90674a0f85
2 changed files with 42 additions and 6 deletions

View file

@ -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

31
panel.json Normal file
View file

@ -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"
}
}