/
kk100.py
57 lines (46 loc) · 1.56 KB
/
kk100.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# module kk100
#
# Copyright (C) 2012 Russ Dill <Russ.Dill@asu.edu>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
import pscad
import itertools
from decimal import Decimal as D
import patterns
# http://www.molex.com/pdm_docs/sd/022232031_sd.pdf
defaults = {
'clearance' : "0.15",
'mask' : "2.5 mil",
'silk' : "0.20",
'drill_d' : "1.02",
'annulus' : "0.40",
'pitch' : "2.54",
'body_y' : "6.35",
'placement' : "0.25",
'grid' : "0.5"
}
def part(m):
m = pscad.wrapper(defaults.items() + m.items())
row = pscad.row(pscad.donut(m.drill_d / 2, m.drill_d / 2 + m.annulus),
m.pitch, m.n, center=True)
all = (
pscad.pin(itertools.count(1), m.clearance, m.mask) +
row,
pscad.silk(m.silk) +
pscad.square((m.pitch * m.n, m.body_y), center=True)
)
silk = pscad.silk(m.silk) + (
patterns.placement_courtyard(all, m.placement, m.grid, 1),
pscad.up(m.body_y / 2) +
pscad.left(m.pitch) +
pscad.square((m.pitch * 2, m.body_y / 4))
)
return all, silk