forked from russdill/pscad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
powerpak-so8.py
67 lines (54 loc) · 2.2 KB
/
powerpak-so8.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
57
58
59
60
61
62
63
64
65
66
# module powerpak-so8
#
# 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
defaults = {
"round_off" : "0.1",
"clearance" : "0.2",
"mask" : "2.5 mil",
"silk" : "0.2",
"placement" : "0.25",
"grid" : "0.5"
}
def part(m):
m = pscad.wrapper(defaults.items() + m.items())
pitch = D("1.27")
width = D("6.61")
pad_size0 = [D("0.61"), D("1.27")]
pad_size1 = [D("0.61"), D("1.02")]
pad_size2 = [D("1.65"), D("3.81")]
body = [D("5.0"), D("6.25")]
thermal_pad = pscad.paste_fraction(pscad.rounded_square(pad_size2, m.round_off, center=True), D("0.5"))
all = (
pscad.pad(itertools.count(1), m.clearance, m.mask) +
pscad.down((width - pad_size0[1]) / D(2)) +
pscad.row(pscad.rounded_square(pad_size0, m.round_off, center=True), pitch, 4, center=True),
pscad.pad((i for i in [6, 6, 5, 5]), m.clearance, m.mask) +
pscad.up((width - pad_size1[1]) / D(2)) +
pscad.row(pscad.rounded_square(pad_size1, m.round_off, center=True), pitch, 4, center=True),
pscad.pad((i for i in [6, 5]), m.clearance, m.mask) +
pscad.down(width / D(2)) +
pscad.up(pad_size0[1] + D("0.82") + pad_size2[1] / D(2)) +
pscad.row(thermal_pad, D("0.61") + pad_size2[0], 2, center=True),
pscad.silk(m.silk) + patterns.brackets(body, D("0.2"), center=True)
)
silk = pscad.silk(m.silk) + (
patterns.placement_courtyard(all, m.placement, m.grid, D("0.5")),
pscad.down(width / D(2) + m.silk) +
pscad.left(pitch * D("1.5")) +
pscad.line(pad_size0[0], center=True)
)
return all, silk