-
Notifications
You must be signed in to change notification settings - Fork 2
/
usb-a.py
63 lines (51 loc) · 1.88 KB
/
usb-a.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
# module usb-a.py
#
# 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 = {
'clearance' : "0.3048",
'mask' : "2.5 mil",
'silk' : "0.2",
'round_off' : "0.1",
'placement' : "0.25",
'grid' : "0.5"
}
def part(m):
m = pscad.wrapper(defaults.items() + m.items())
pad = pscad.rounded_square((D("0.8"), D("2.82")), m.round_off, center=True)
pad_row = (pscad.left(D("3.5")) + pad + pscad.right(D("2.5")) + pad +
pscad.right(2) + pad + pscad.right(D("2.5")) + pad)
gnd_pin = pscad.donut(D("1.15"), D("1.40"))
side = (
pscad.pin("5", m.clearance, m.mask, square=True) + (
pscad.up(D("14.15") / 2 - D("10.3")) +
pscad.left(D("13.14") / 2) + gnd_pin
),
pscad.silk(m.silk) + (
pscad.up(D("14.15") / 2) + pscad.line(D("13.90") / 2) +
pscad.right(D("13.90") / 2) + pscad.line((0, D("10.30") - D("1.55")))
)
)
all = (
pscad.mirror([1, 0]) + pscad.pad(itertools.count(1), m.clearance, m.mask) + (
pscad.up(D("14.15") / 2 - D("10.3") - D("3.71")) + pad_row
),
side + pscad.mirror([1, 0]) + side,
)
silk = pscad.silk(m.silk) + (
patterns.placement_courtyard(all, m.placement, m.grid, 1),
)
return all, silk