summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile18
-rwxr-xr-xsupport/generate_kicad.py12
2 files changed, 19 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 4b66b0d..0c6f340 100644
--- a/Makefile
+++ b/Makefile
@@ -4,24 +4,32 @@
OPENSCAD ?= openscad
-all: src/jig.stl src/pcb_shape.dxf
+all: out.zip
+
+out.zip: out/jig.stl out/pcb_shape.dxf out/kicad
+ zip -r out.zip out
src/input.preprocessed.dxf: src/input.preprocessed.svg
support/inkscape_exporter.py $< $@
-src/pcb_shape.dxf: src/pcb_shape.scad src/input.preprocessed.dxf
+out/pcb_shape.dxf: src/pcb_shape.scad src/input.preprocessed.dxf out
$(OPENSCAD) -o $@ $<
-src/jig.stl: src/jig.scad src/input.preprocessed.dxf
+out/jig.stl: src/jig.scad src/input.preprocessed.dxf
$(OPENSCAD) -o $@ $<
+out/kicad: input.svg out/pcb_shape.dxf
+ support/generate_kicad.py $^ $@
+
src/input.preprocessed.svg: input.svg
support/inkscape_svg_filter_layers.py $< $@ --only --name "Test Points" "Mounting Holes" "Grip Slots" "Outline"
+out:
+ mkdir -p out
+
.PHONY: clean
clean:
rm -f src/input.preprocessed.dxf
rm -f src/input.preprocessed.svg
- rm -f src/jig.stl
- rm -f src/pcb_shape.dxf
+ rm -rf out
diff --git a/support/generate_kicad.py b/support/generate_kicad.py
index 77f58fa..3e1b614 100755
--- a/support/generate_kicad.py
+++ b/support/generate_kicad.py
@@ -275,6 +275,7 @@ if __name__ == '__main__':
parser.add_argument('-y', '--yspace', type=int, default=200, help='Schematic pin Y spacing in mil (default: 200)')
parser.add_argument('-a', '--annular', type=float, default=0.5, help='Pogo pin annular ring width in mm (default: 0.5)')
parser.add_argument('-l', '--svg-layer', type=str, default='Test Points', help='Name of SVG layer containing pogo pins')
+ parser.add_argument('-n', '--name', default='jig', help='Output KiCAD project name')
args = parser.parse_args()
if not path.exists(args.output):
@@ -307,16 +308,15 @@ if __name__ == '__main__':
(x1, y1, _z1), (x2, y2, _z2) = line.dxf.start, line.dxf.end
outline.append(((x1, -y1), (x2, -y2)))
- out_name = path.basename(args.output)
- with open(path.join(args.output, f'{out_name}.sch'), 'w', encoding='utf8') as sch:
- sch.write(sch_template(f'{out_name} generated schematic (PogoJig v{__version__})', len(pins), yspace=args.yspace))
+ with open(path.join(args.output, f'{args.name}.sch'), 'w', encoding='utf8') as sch:
+ sch.write(sch_template(f'{args.name} generated schematic (PogoJig v{__version__})', len(pins), yspace=args.yspace))
- with open(path.join(args.output, f'{out_name}.kicad_pcb'), 'w', encoding='utf8') as pcb:
+ with open(path.join(args.output, f'{args.name}.kicad_pcb'), 'w', encoding='utf8') as pcb:
pcb.write(pcb_template(outline, pins, annular=args.annular))
- with open(path.join(args.output, f'{out_name}.pro'), 'w', encoding='utf8') as f:
+ with open(path.join(args.output, f'{args.name}.pro'), 'w', encoding='utf8') as f:
f.write(pkgutil.get_data('pogojig.kicad', 'kicad.pro').decode('utf8'))
- with open(path.join(args.output, f'{out_name}-cache.lib'), 'w', encoding='utf8') as f:
+ with open(path.join(args.output, f'{args.name}-cache.lib'), 'w', encoding='utf8') as f:
f.write(pkgutil.get_data('pogojig.kicad', 'kicad-cache.lib').decode('utf8'))