-
Notifications
You must be signed in to change notification settings - Fork 6
/
icon_bat.js
61 lines (49 loc) · 1.99 KB
/
icon_bat.js
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
// Author: @infused-kim
//
// Description:
// Shows battery icons on the PCB silkscreen.
module.exports = {
params: {
designator: 'ICON',
side: 'F',
reverse: false,
spacing: 1
},
body: p => {
const spacing_adj = p.spacing / 2;
const top = `
(module icon_bat (layer F.Cu) (tedit 64461058)
${p.at /* parametric position */}
(attr virtual)
`;
const front = `
(fp_text reference "${p.ref}" (at 0 3 ${p.rot}) (layer F.SilkS) ${p.ref_hide}
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_circle (center ${-0.55 - spacing_adj} 0) (end ${-0.05 - spacing_adj} 0) (layer F.SilkS) (width 0.1))
(fp_line (start ${-0.55 - spacing_adj} -0.3) (end ${-0.55 - spacing_adj} 0.3) (layer F.SilkS) (width 0.1))
(fp_line (start ${-0.85 - spacing_adj} 0) (end ${-0.25 - spacing_adj} 0) (layer F.SilkS) (width 0.1))
(fp_circle (center ${0.55 + spacing_adj} 0) (end ${1.05 + spacing_adj} 0) (layer F.SilkS) (width 0.1))
(fp_line (start ${0.25 + spacing_adj} 0) (end ${0.85 + spacing_adj} 0) (layer F.SilkS) (width 0.1))
`
const back = `
(fp_circle (center ${-0.55 - spacing_adj} 0) (end ${-1.05 - spacing_adj} 0) (layer B.SilkS) (width 0.1))
(fp_line (start ${-0.25 - spacing_adj} 0) (end ${-0.85 - spacing_adj} 0) (layer B.SilkS) (width 0.1))
(fp_circle (center ${0.55 + spacing_adj} 0) (end ${0.05 + spacing_adj} 0) (layer B.SilkS) (width 0.1))
(fp_line (start ${0.55 + spacing_adj} -0.3) (end ${0.55 + spacing_adj} 0.3) (layer B.SilkS) (width 0.1))
(fp_line (start ${0.85 + spacing_adj} 0) (end ${0.25 + spacing_adj} 0) (layer B.SilkS) (width 0.1))
`
const bottom = `
)
`
let final = top;
if(p.side == "F" || p.reverse) {
final += front;
}
if(p.side == "B" || p.reverse) {
final += back;
}
final += bottom;
return final;
}
}