Skip to content
Open

T3 #3

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
58f8e91
add a main and make it importable
Aug 31, 2022
1eb78bc
allow negative angles for keycaps top
Aug 31, 2022
744ad02
update wish list
Aug 31, 2022
227f785
make separator distance an option
Aug 31, 2022
39fcf25
add m65
Sep 1, 2022
db69853
update
alinelena Sep 1, 2022
615ffd0
some examples
alinelena Sep 1, 2022
7a2fce9
some examples
alinelena Sep 1, 2022
99d3270
some examples
alinelena Sep 1, 2022
3c63280
some examples
alinelena Sep 1, 2022
0d2f3d6
more fixes
alinelena Sep 1, 2022
c99fc24
more fixes
alinelena Sep 1, 2022
5ff5a61
more fixes
alinelena Sep 1, 2022
12b3227
more fixes
alinelena Sep 1, 2022
991097a
more fixes
alinelena Sep 1, 2022
2540863
add ansi68
Sep 1, 2022
504923b
update
alinelena Sep 2, 2022
b6c11da
update
alinelena Sep 2, 2022
c5ae5b7
update
alinelena Sep 2, 2022
cc11381
update
alinelena Sep 2, 2022
85ad7c2
update
alinelena Sep 2, 2022
bd73aa0
update
alinelena Sep 2, 2022
5a1b902
update
alinelena Sep 2, 2022
1343696
update
Sep 3, 2022
1b74d02
more fixes
alinelena Sep 3, 2022
bf08eba
more fixes
alinelena Sep 3, 2022
394c22d
more fixes
alinelena Sep 3, 2022
e67a4f3
update
alinelena Sep 7, 2022
65d417c
update
Sep 7, 2022
5a90176
update
Sep 8, 2022
d2aded5
update
Sep 8, 2022
9d6d84f
update
Sep 8, 2022
d033aa3
update
alinelena Sep 8, 2022
7f11dd0
update
Sep 11, 2022
9d999bf
update
alinelena Sep 11, 2022
b737237
update
alinelena Sep 11, 2022
d60edc2
update
alinelena Sep 11, 2022
2b6d510
update
alinelena Sep 11, 2022
a9c0518
update
alinelena Sep 11, 2022
eef5885
update
alinelena Sep 11, 2022
57a7fb4
update
Sep 12, 2022
d12312a
update
Sep 24, 2022
3600b1e
update
Dec 10, 2022
d416075
update
Dec 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It's especially suited for creating high/medium profile spherical top keycaps.

## Please contribute!

I'm new to CadQuery (CQ), Ptyhon and code based CAD in general. There's a lot of guesswork and fumbling around to get to this point, any help is very much appreciated.
I'm new to CadQuery (CQ), Ptyhon and code based CAD in general. There's a lot of guesswork and fumbling around to get to this point, any help is very much appreciated.

## Usage

Expand Down Expand Up @@ -91,9 +91,16 @@ The code includes an example to use a DXF drawing as legend (check the comments
- add 2U pos-like stabilizers
- add support for logos and graphical legends
- add reinforcement for big keys
- better legend centering
- secondary, tertiary, quaternary legends
- side printed legends
- add alternative stems
- allow reduced height of keycap for non 19.xx spacing
- clean up the code
- automatic export script of all needed keycap for a full keyboard
- output files already supported for 3D printing
- online editor
- add secondary/tertiary legends
- add support for stems other than cherry
- clean up the code
- fix negative angle top
101 changes: 101 additions & 0 deletions examples/ansi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import opk
import cadquery as cq
from cadquery import exporters
from kb_render import *

keys = {
0: [
{ 't':'⎋','fs':12},
{ 't':'!\n1','fs':5},
{ 't':'"\n2','fs':5},
{ 't':'£\n3','fs':5},
{ 't':'$\n4','fs':5},
{ 't':'%\n5','fs':5},
{ 't':'^\n6','fs':5},
{ 't':'&\n7','fs':5},
{ 't':'*\n8','fs':5},
{ 't':'(\n9','fs':5},
{ 't':')\n0','fs':5},
{ 't':'-\n_','fs':5},
{ 't':'+\n=','fs':5},
{ 'w':2,'t':'⌫','fs':12},
],
1: [
{ 'w':1.5,'t':'↹','fs':12},
{ 't':'q' },
{ 't':'w' },
{ 't':'e' },
{ 't':'r' },
{ 't':'t' },
{ 't':'y' },
{ 't':'u' },
{ 't':'i' },
{ 't':'o' },
{ 't':'p' },
{ 't':'[\n{','fs':5 },
{ 't':']\n}','fs':5 },
{ 'w':1.5,'t':'|\n\\','fs':5 },
],
2: [
{ 'w':1.75,'t':'⇪' },
{ 't':'a' },
{ 't':'s' },
{ 't':'d' },
{ 't':'f','n': True },
{ 't':'g' },
{ 't':'h' },
{ 't':'j','n': True },
{ 't':'k' },
{ 't':'l' },
{ 't':';\n:','fs':5 },
{ 't':'\'\n@','fs':5 },
{ 'w':2.25,'t':'⊼','fs':12 }
],
3: [
{ 'w':2.25,'t':'⇧' },
{ 't':'z' },
{ 't':'x' },
{ 't':'c' },
{ 't':'v' },
{ 't':'b' },
{ 't':'n' },
{ 't':'m' },
{ 't':',\n<','fs':5 },
{ 't':'.\n>','fs':5 },
{ 't':'/\n?','fs':5 },
{ 'w':2.75,'t':'⇧'},
],
4: [
{ 'w': 1.25,'t':'⎈'},
{ 'w': 1.25,'t':'','f':"/usr/share/fonts/texlive-fontawesome5/FontAwesome5Brands-Regular-400.otf"},
{ 'w': 1.25,'t':'⎇','f':"/usr/share/fonts/truetype/NotoSansSymbols-Black.ttf"},
{ 'w': 6.25, 'convex':True},
{ 'w':1.25, 't':'⎇','f':"/usr/share/fonts/truetype/NotoSansSymbols-Black.ttf" },
{'w':1.25, 't':'Fn'},
{ 'w': 1.25,'t':'','f':"/usr/share/fonts/texlive-fontawesome5/FontAwesome5Brands-Regular-400.otf" },
{ 'w': 1.25,'t':'⎈'},
],
}

rows = [
{'angle': 9, 'height': 14, 'keys': keys[0] }, # row 1, numbers row
{'angle': 8, 'height': 12, 'keys': keys[1] }, # row 2, QWERT
{'angle': -6, 'height': 11.5, 'keys': keys[2] }, # row 3, ASDFG
{'angle': -8, 'height': 13, 'keys': keys[3] }, # row 4, ZXCVB
{'angle': 0, 'height': 12.5, 'keys': keys[4] }, # row 5, bottom row
]

mainFont = "DejaVu Sans Mono"
mainSize = 9

sx = 19.05
sy = 19.05

assy = render_kb(rows, mainFont=mainFont, mainSize = mainSize, sx = sx, sy = sy)

if 'show_object' in locals():
show_object(assy)

# Export the whole assembly, very handy especially for STEP
#exporters.export(assy.toCompound(), 'keycaps.stl', tolerance=0.001, angularTolerance=0.05)
#exporters.export(assy.toCompound(), 'keycaps.step')
110 changes: 110 additions & 0 deletions examples/ansi68.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import opk
import cadquery as cq
from cadquery import exporters
from kb_render import *

keys = {
0: [
{ 't':'⎋','fs':12},
{ 't':'!\n1','fs':5},
{ 't':'"\n2','fs':5},
{ 't':'£\n3','fs':5},
{ 't':'$\n4','fs':5},
{ 't':'%\n5','fs':5},
{ 't':'^\n6','fs':5},
{ 't':'&\n7','fs':5},
{ 't':'*\n8','fs':5},
{ 't':'(\n9','fs':5},
{ 't':')\n0','fs':5},
{ 't':'-\n_','fs':5},
{ 't':'+\n=','fs':5},
{ 'w':2,'t':'⌫','fs':12},
{ 't':'`\n¬','fs':5}
],
1: [
{ 'w':1.5,'t':'↹','fs':12},
{ 't':'q' },
{ 't':'w' },
{ 't':'e' },
{ 't':'r' },
{ 't':'t' },
{ 't':'y' },
{ 't':'u' },
{ 't':'i' },
{ 't':'o' },
{ 't':'p' },
{ 't':'[\n{','fs':5 },
{ 't':']\n}','fs':5 },
{ 'w':1.5,'t':'|\n\\','fs':5 },
{ 't':'⌦' }
],
2: [
{ 'w':1.75,'t':'⇪' },
{ 't':'a' },
{ 't':'s' },
{ 't':'d' },
{ 't':'f','n': True },
{ 't':'g' },
{ 't':'h' },
{ 't':'j','n': True },
{ 't':'k' },
{ 't':'l' },
{ 't':';\n:','fs':5 },
{ 't':'\'\n@','fs':5 },
{ 'w':2.25,'t':'⊼','fs':12 },
{'t':"Pg\nUp",'fs':5}
],
3: [
{ 'w':2.25,'t':'⇧' },
{ 't':'z' },
{ 't':'x' },
{ 't':'c' },
{ 't':'v' },
{ 't':'b' },
{ 't':'n' },
{ 't':'m' },
{ 't':',\n<','fs':5 },
{ 't':'.\n>','fs':5 },
{ 't':'/\n?','fs':5 },
{ 'w':1.75,'t':'⇧'},
{ 't':'↑','fs':12},
{'t':"Pg\nDn",'fs':5}


],
4: [
{ 'w': 1.25,'t':'⎈'},
{ 'w': 1.25,'t':'','f':"/usr/share/fonts/texlive-fontawesome5/FontAwesome5Brands-Regular-400.otf"},
{ 'w': 1.25,'t':'⎇','f':"/usr/share/fonts/truetype/NotoSansSymbols-Black.ttf"},
{ 'w': 6.25, 'convex':True},
{ 't':'⎇','f':"/usr/share/fonts/truetype/NotoSansSymbols-Black.ttf" },
{ 't':'','f':"/usr/share/fonts/texlive-fontawesome5/FontAwesome5Brands-Regular-400.otf" },
{ 't':'⎈'},
{ 't':'←','fs':12},
{ 't':'↓','fs':12},
{ 't':'→','fs':12},
],
}

rows = [
{'angle': 9, 'height': 14, 'keys': keys[0] }, # row 1, numbers row
{'angle': 8, 'height': 12, 'keys': keys[1] }, # row 2, QWERT
{'angle': -6, 'height': 11.5, 'keys': keys[2] }, # row 3, ASDFG
{'angle': -8, 'height': 13, 'keys': keys[3] }, # row 4, ZXCVB
{'angle': 0, 'height': 12.5, 'keys': keys[4] }, # row 5, bottom row
]

mainFont = "DejaVu Sans Mono"
mainSize = 9

sx = 19.05
sy = 19.05

assy = render_kb(rows, mainFont=mainFont, mainSize = mainSize, sx = sx, sy = sy)

if 'show_object' in locals():
show_object(assy)

# Export the whole assembly, very handy especially for STEP
#exporters.export(assy.toCompound(), 'keycaps.stl', tolerance=0.001, angularTolerance=0.05)
#exporters.export(assy.toCompound(), 'keycaps.step')
147 changes: 147 additions & 0 deletions examples/full-ansi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import opk
import cadquery as cq
from cadquery import exporters
from kb_render import *

keys = {
0: [
{'t':'⎋'},
{'t':'F1','ox':1.0,'fs':6},
{'t':'F2','fs':6},
{'t':'F3','fs':6},
{'t':'F4','fs':6},
{'t':'F5','ox':0.5,'fs':6},
{'t':'F6','fs':6},
{'t':'F7','fs':6},
{'t':'F8','fs':6},
{'t':'F9','ox':0.5,'fs':6},
{'t':'F10','fs':6},
{'t':'F11','fs':6},
{'t':'F12','fs':6},
{'t':'Print\nScreen','ox':0.5,'fs':3},
{'t':'Screen\nLock','fs':3},
{'t':'Pause','fs':3}
],
1: [
{ 't':'`\n¬','fs':5, 'oy':-0.5},
{ 't':'!\n1','fs':5},
{ 't':'"\n2','fs':5},
{ 't':'£\n3','fs':5},
{ 't':'$\n4','fs':5},
{ 't':'%\n5','fs':5},
{ 't':'^\n6','fs':5},
{ 't':'&\n7','fs':5},
{ 't':'*\n8','fs':5},
{ 't':'(\n9','fs':5},
{ 't':')\n0','fs':5},
{ 't':'-\n_','fs':5},
{ 't':'+\n=','fs':5},
{ 'w':2,'t':'⌫','fs':12},
{ 't':'Ins','fs':5,'ox':0.5},
{ 't':'Home','fs':5},
{ 't':'Pg\nUp','fs':5},
{ 't':'Num','fs':7,'ox':0.5},
{ 't':'/'},
{ 't':'*' },
{ 't':'-'}
],
2: [
{ 'w':1.5,'t':'↹','fs':12,'oy':-0.5},
{ 't':'q' },
{ 't':'w' },
{ 't':'e' },
{ 't':'r' },
{ 't':'t' },
{ 't':'y' },
{ 't':'u' },
{ 't':'i' },
{ 't':'o' },
{ 't':'p' },
{ 't':'[\n{','fs':5 },
{ 't':']\n}','fs':5 },
{ 'w':1.5,'t':'|\n\\','fs':5 },
{ 't':'Del','ox':0.5,'fs':5 },
{ 't':'End','fs':5 },
{ 't':'Pg\nDn','fs':5},
{ 't':'7','ox':0.5 },
{ 't':'8' },
{ 't':'9' },
{ 't':'+','h':2,'oy':-0.5 }
],
3: [
{ 'w':1.75,'t':'⇪','oy':-0.5 },
{ 't':'a' },
{ 't':'s' },
{ 't':'d' },
{ 't':'f','n': True },
{ 't':'g' },
{ 't':'h' },
{ 't':'j','n': True },
{ 't':'k' },
{ 't':'l' },
{ 't':';\n:','fs':5 },
{ 't':'\'\n@','fs':5 },
{ 'w':2.25,'t':'⊼','fs':12 },
{ 't':'4','ox':4.0 },
{ 't':'5','n':True },
{ 't':'6' }
],
4: [
{ 'w':2.25,'t':'⇧','oy':-0.5 },
{ 't':'z' },
{ 't':'x' },
{ 't':'c' },
{ 't':'v' },
{ 't':'b' },
{ 't':'n' },
{ 't':'m' },
{ 't':',\n<','fs':5 },
{ 't':'.\n>','fs':5 },
{ 't':'/\n?','fs':5 },
{ 'w':2.75,'t':'⇧'},
{ 't':'↑','fs':12,'ox':1.5},
{ 't':'1','ox':1.5 },
{ 't':'2' },
{ 't':'3' },
{ 't':'⊼','h':2,'oy':-0.5 },
],
5: [
{ 'w': 1.25,'t':'⎈','oy':-0.5 },
{ 'w': 1.25,'t':'','f':"/usr/share/fonts/texlive-fontawesome5/FontAwesome5Brands-Regular-400.otf"},
{ 'w': 1.25,'t':'⎇','f':"/usr/share/fonts/truetype/NotoSansSymbols-Black.ttf"},
{ 'w': 6.25, 'convex':True},
{ 'w':1.25, 't':'⎇','f':"/usr/share/fonts/truetype/NotoSansSymbols-Black.ttf" },
{'w':1.25, 't':'Fn'},
{ 'w': 1.25,'t':'','f':"/usr/share/fonts/texlive-fontawesome5/FontAwesome5Brands-Regular-400.otf" },
{ 'w': 1.25,'t':'⎈'},
{ 't':'←','fs':12,'ox': 0.5},
{ 't':'↓','fs':12 },
{ 't':'→','fs':12 },
{ 'w': 2,'t':'0','ox':0.5 },
{ 't':'.' }
],
}

rows = [
{'angle': 13, 'height': 16, 'keys': keys[0] }, # row 0, function row
{'angle': 9, 'height': 14, 'keys': keys[1] }, # row 1, numbers row
{'angle': 8, 'height': 12, 'keys': keys[2] }, # row 2, QWERT
{'angle': -6, 'height': 11.5, 'keys': keys[3] }, # row 3, ASDFG
{'angle': -8, 'height': 13, 'keys': keys[4] }, # row 4, ZXCVB
{'angle': 0, 'height': 12.5, 'keys': keys[5] }, # row 5, bottom row
]

mainFont = "DejaVu Sans Mono"
mainSize = 9

sx = 19.05
sy = 19.05

assy = render_kb(rows, mainFont=mainFont, mainSize = mainSize, sx = sx, sy = sy)

if 'show_object' in locals():
show_object(assy)

# Export the whole assembly, very handy especially for STEP
#exporters.export(assy.toCompound(), 'keycaps.stl', tolerance=0.001, angularTolerance=0.05)
#exporters.export(assy.toCompound(), 'keycaps.step')
Loading