Skip to content

Commit

Permalink
First prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
DanNixon committed Apr 17, 2021
0 parents commit a0ab21c
Show file tree
Hide file tree
Showing 17 changed files with 20,324 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# For PCBs designed using KiCad: http://www.kicad-pcb.org/
# Format documentation: http://kicad-pcb.org/help/file-formats/

# Temporary files
*.000
*.bak
*.bck
*.kicad_pcb-bak
*.kicad_sch-bak
*.kicad_prl
*.sch-bak
*~
_autosave-*
*.tmp
*-save.pro
*-save.kicad_pcb
fp-info-cache

# Netlist files (exported from Eeschema)
*.net

# Autorouter files (exported from Pcbnew)
*.dsn
*.ses

# Exported BOM files
*.xml
*.csv

__pycache__/

# Generated CAD files
*.dxf
*.scad

*.gbr
*.drl
2 changes: 2 additions & 0 deletions .style.yapf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[style]
based_on_style = facebook
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
%.dxf: %.scad
openscad $< -o $@

%.scad: %.py cad.py layout.py
python $< > $@

.PHONY: clean
clean:
rm -rf *.scad *.dxf left/ right/ left.zip right.zip

.PHONY: case_panels
case_panels: lower_panel.dxf upper_panel.dxf

.PHONY: pcb_layout
pcb_layout: pcb_outline.dxf
python pcb_layout.py ./hardware/aya.kicad_pcb

left/left.kicad_pcb: hardware/aya.kicad_pcb
mkdir -p "$(shell dirname $@)"
kikit panelize extractboard -s -220 -25 200 140 $< $@

right/right.kicad_pcb: hardware/aya.kicad_pcb
mkdir -p "$(shell dirname $@)"
kikit panelize extractboard -s 20 -25 200 140 $< $@

.PHONY: pcb_split
pcb_split: left/left.kicad_pcb right/right.kicad_pcb

left.zip: left/left.kicad_pcb
zip $@ left/*.gbr left/*.drl

right.zip: right/right.kicad_pcb
zip $@ right/*.gbr right/*.drl

.PHONY: pcb_gerbers
pcb_gerbers: left.zip right.zip
43 changes: 43 additions & 0 deletions cad.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import numpy as np
import solid as sp

import layout, utils


def place_switch(position, orientation):
return sp.translate(position)(
sp.rotate((0, 0, orientation))(sp.square([14, 14], center=True))
)


def switch_cutouts(positions, orientations):
for a in range(0, layout.num_switches):
col, row = divmod(a, layout.matrix_rows)
yield place_switch(positions[col, row], orientations[col, row])


def mcu_header_cutouts(mcu_position):
return sp.translate(mcu_position)(
[
sp.translate([x, -1.2])(sp.square([4.5, 33], center=True))
for x in [-7.6, 7.6]
],
)


def case_outline(outline):
return sp.minkowski()(
sp.polygon(points=outline),
sp.circle(r=15.),
)


def case_panel(outline, mounting_holes):
return sp.difference()(
case_outline(outline),
[
sp.translate(p)(
sp.circle(d=layout.mounting_hole_diameter, segments=32)
) for p in mounting_holes
],
)
Loading

0 comments on commit a0ab21c

Please sign in to comment.