1
0

Added keycaps option to display mx or choc keycaps on Dwgs.User, and fixed mx footprint

This commit is contained in:
tapioki 2021-06-12 16:18:06 +02:00 committed by Bán Dénes
parent 1ff7e0746e
commit ee43a93de1
3 changed files with 64 additions and 40 deletions

View File

@ -15,7 +15,8 @@ module.exports = {
params: {
class: 'S',
hotswap: false,
reverse: false
reverse: false,
keycaps: false
},
body: p => {
const standard = `
@ -34,7 +35,7 @@ module.exports = {
(fp_line (start 7 6) (end 7 7) (layer Dwgs.User) (width 0.15))
(fp_line (start 7 -7) (end 6 -7) (layer Dwgs.User) (width 0.15))
(fp_line (start 6 7) (end 7 7) (layer Dwgs.User) (width 0.15))
(fp_line (start 7 -7) (end 7 -6) (layer Dwgs.User) (width 0.15))
(fp_line (start 7 -7) (end 7 -6) (layer Dwgs.User) (width 0.15))
${''/* middle shaft */}
(pad "" np_thru_hole circle (at 0 0) (size 3.429 3.429) (drill 3.429) (layers *.Cu *.Mask))
@ -43,6 +44,13 @@ module.exports = {
(pad "" np_thru_hole circle (at 5.5 0) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at -5.5 0) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask))
`
const keycap = `
${'' /* keycap marks */}
(fp_line (start -9 -8.5) (end 9 -8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start 9 -8.5) (end 9 8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start 9 8.5) (end -9 8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start -9 8.5) (end -9 -8.5) (layer Dwgs.User) (width 0.15))
`
function pins(def_neg, def_pos, def_side) {
if(p.param.hotswap) {
return `
@ -65,12 +73,14 @@ module.exports = {
if(p.param.reverse) {
return `
${standard}
${p.param.keycaps ? keycap : ''}
${pins('-', '', 'B')}
${pins('', '-', 'F')})
`
} else {
return `
${standard}
${p.param.keycaps ? keycap : ''}
${pins('-', '', 'B')})
`
}

View File

@ -11,7 +11,8 @@ module.exports = {
params: {
class: 'S',
side: 'F',
reverse: false
reverse: false,
keycaps: false
},
body: p => {
const standard = `
@ -22,47 +23,48 @@ module.exports = {
(fp_text reference REF** (at 0 7.4) (layer F.Fab) (effects (font (size 1 1) (thickness 0.15))))
(fp_text value Kailh_PG1232 (at 0 -7.3) (layer F.Fab) (effects (font (size 1 1) (thickness 0.15))))
${''/* corner marks */}
(fp_line (start 9 -8.5) (end -9 -8.5) (layer Dwgs.User) (width 0.12))
(fp_line (start 9 8.5) (end 9 -8.5) (layer Dwgs.User) (width 0.12))
(fp_line (start -9 8.5) (end 9 8.5) (layer Dwgs.User) (width 0.12))
(fp_line (start -9 -8.5) (end -9 8.5) (layer Dwgs.User) (width 0.12))
(fp_line (start 2.25 2.95) (end 5.95 2.95) (layer Dwgs.User) (width 0.12))
(fp_line (start -2.25 2.95) (end -5.95 2.95) (layer Dwgs.User) (width 0.12))
(fp_line (start 2.25 4) (end 2.25 2.95) (layer Dwgs.User) (width 0.12))
(fp_line (start -2.25 4) (end 2.25 4) (layer Dwgs.User) (width 0.12))
(fp_line (start -2.25 2.95) (end -2.25 4) (layer Dwgs.User) (width 0.12))
(fp_line (start -6.75 6.25) (end -6.75 -6.25) (layer Dwgs.User) (width 0.12))
(fp_line (start 6.75 6.25) (end -6.75 6.25) (layer Dwgs.User) (width 0.12))
(fp_line (start 6.75 -6.25) (end 6.75 6.25) (layer Dwgs.User) (width 0.12))
(fp_line (start -6.75 -6.25) (end 6.75 -6.25) (layer Dwgs.User) (width 0.12))
(fp_line (start -5.95 2.95) (end -5.95 -2.95) (layer Dwgs.User) (width 0.12))
(fp_line (start 5.95 -2.95) (end 5.95 2.95) (layer Dwgs.User) (width 0.12))
(fp_line (start -5.95 -2.95) (end 5.95 -2.95) (layer Dwgs.User) (width 0.12))
${'' /* corner marks */}
(fp_line (start -7.25 -6.75) (end -6.25 -6.75) (layer Dwgs.User) (width 0.15))
(fp_line (start -7.25 -6.75) (end -7.25 -5.75) (layer Dwgs.User) (width 0.15))
(fp_line (start -7.25 6.75) (end -6.25 6.75) (layer Dwgs.User) (width 0.15))
(fp_line (start -7.25 6.75) (end -7.25 5.75) (layer Dwgs.User) (width 0.15))
(fp_line (start 7.25 -6.75) (end 6.25 -6.75) (layer Dwgs.User) (width 0.15))
(fp_line (start 7.25 -6.75) (end 7.25 -5.75) (layer Dwgs.User) (width 0.15))
(fp_line (start 7.25 6.75) (end 6.25 6.75) (layer Dwgs.User) (width 0.15))
(fp_line (start 7.25 6.75) (end 7.25 5.75) (layer Dwgs.User) (width 0.15))
(fp_line (start 2.8 -5.35) (end -2.8 -5.35) (layer Dwgs.User) (width 0.15))
(fp_line (start -2.8 -3.2) (end 2.8 -3.2) (layer Dwgs.User) (width 0.15))
(fp_line (start 2.8 -3.2) (end 2.8 -5.35) (layer Dwgs.User) (width 0.15))
(fp_line (start -2.8 -3.2) (end -2.8 -5.35) (layer Dwgs.User) (width 0.15))
${''/* middle shaft */}
(fp_line (start 2.25 2.6) (end 5.8 2.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start -2.25 2.6) (end -5.8 2.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start 2.25 3.6) (end 2.25 2.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start -2.25 3.6) (end 2.25 3.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start -2.25 2.6) (end -2.25 3.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start -5.8 2.6) (end -5.8 -2.95) (layer Edge.Cuts) (width 0.12))
(fp_line (start 5.8 -2.95) (end 5.8 2.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start -5.8 -2.95) (end 5.8 -2.95) (layer Edge.Cuts) (width 0.12))
${''/* stabilizers */}
(pad 3 thru_hole circle (at 5.3 -4.75) (size 1.6 1.6) (drill 1.1) (layers *.Cu *.Mask) (clearance 0.2))
(pad 4 thru_hole circle (at -5.3 -4.75) (size 1.6 1.6) (drill 1.1) (layers *.Cu *.Mask) (clearance 0.2))
`
const keycap = `
${'' /* keycap marks */}
(fp_line (start -9 -8.5) (end 9 -8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start 9 -8.5) (end 9 8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start 9 8.5) (end -9 8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start -9 8.5) (end -9 -8.5) (layer Dwgs.User) (width 0.15))
`
function pins(def_neg, def_pos) {
return `
${''/* middle shaft */}
(pad "" np_thru_hole oval (at ${def_pos}0 3.5 ${p.rot}) (size 4.7 1) (drill oval 4.7 1) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at ${def_neg}2.2 3.5 ${90 + p.rot}) (size 1.2 0.3) (drill oval 1.2 0.3) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at ${def_pos}2.2 3.5 ${90 + p.rot}) (size 1.2 0.3) (drill oval 1.2 0.3) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at ${def_pos}0 3.95 ${p.rot}) (size 4.7 0.3) (drill oval 4.7 0.3) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at ${def_pos}5.36 0 ${p.rot}) (size 1 5.9) (drill oval 1 5.9) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at ${def_pos}4.59 0 ${p.rot}) (size 1 5.9) (drill oval 1 5.9) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at ${def_pos}4.2 0 ${p.rot}) (size 1 5.9) (drill oval 1 5.9) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at ${def_neg}4.2 0 ${p.rot}) (size 1 5.9) (drill oval 1 5.9) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at ${def_neg}4.59 0 ${p.rot}) (size 1 5.9) (drill oval 1 5.9) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at ${def_neg}5.9 0 ${90 + p.rot}) (size 6.1 0.3) (drill oval 6.1 0.3) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at ${def_pos}5.9 0 ${90 + p.rot}) (size 6.1 0.3) (drill oval 6.1 0.3) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at ${def_pos}0 2.9 ${p.rot}) (size 12.1 0.3) (drill oval 12.1 0.3) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at ${def_pos}0 -2.9 ${p.rot}) (size 12.1 0.3) (drill oval 12.1 0.3) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at ${def_neg}5.36 0 ${p.rot}) (size 1 5.9) (drill oval 1 5.9) (layers *.Cu *.Mask))
(pad "" np_thru_hole oval (at ${def_pos}0 0 ${p.rot}) (size 11.85 5.9) (drill oval 11.85 5.9) (layers *.Cu *.Mask))
${''/* pins */}
(pad 1 thru_hole circle (at ${def_neg}4.58 5.1) (size 1.6 1.6) (drill 1.1) (layers *.Cu *.Mask) ${p.net.from} (clearance 0.2))
(pad 2 thru_hole circle (at ${def_pos}2 5.4) (size 1.6 1.6) (drill 1.1) (layers *.Cu *.Mask) ${p.net.to} (clearance 0.2))
@ -71,12 +73,15 @@ module.exports = {
if(p.param.reverse){
return `
${standard}
${p.param.keycaps ? keycap : ''}
${pins('-', '')}
${pins('', '-')})
`
} else {
return `
${standard}
${p.param.keycaps ? keycap : ''}
${pins('-', '')})
`
}

View File

@ -15,7 +15,8 @@ module.exports = {
params: {
class: 'S',
hotswap: false,
reverse: false
reverse: false,
keycaps: false
},
body: p => {
const standard = `
@ -42,10 +43,16 @@ module.exports = {
${''/* stabilizers */}
(pad "" np_thru_hole circle (at 5.08 0) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at -5.08 0) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask))
)
`
const keycap = `
${'' /* keycap marks */}
(fp_line (start -9.5 -9.5) (end 9.5 -9.5) (layer Dwgs.User) (width 0.15))
(fp_line (start 9.5 -9.5) (end 9.5 9.5) (layer Dwgs.User) (width 0.15))
(fp_line (start 9.5 9.5) (end -9.5 9.5) (layer Dwgs.User) (width 0.15))
(fp_line (start -9.5 9.5) (end -9.5 -9.5) (layer Dwgs.User) (width 0.15))
`
function pins(def_neg, def_pos, def_side) {
if(p.param.hotswap == TRUE) {
if(p.param.hotswap) {
return `
${'' /* holes */}
(pad "" np_thru_hole circle (at ${def_pos}2.54 -5.08) (size 3 3) (drill 3) (layers *.Cu *.Mask))
@ -66,12 +73,14 @@ module.exports = {
if(p.param.reverse){
return `
${standard}
${p.param.keycaps ? keycap : ''}
${pins('-', '', 'B')}
${pins('', '-', 'F')})
`
} else {
return `
${standard}
${p.param.keycaps ? keycap : ''}
${pins('-', '', 'B')})
`
}