Skip to main content

Open Programmatic Keycap

Project description

OPK

OPK is a spherical top keycap profile developed in CadQuery and released under the very permissive Apache License 2.0.

It's especially suited for creating high/medium profile spherical top keycaps.

The profile is still highly experimental and very alpha stage.

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.

Usage

If you are new to CQ, the easiest is to download a CQ-Editor pre-built package (I use the latest development release), load the keycap.py file and hit Render!

The main keycap function in the opk.py file has sane defaults and parameters are sufficiently commented.

The export directory includes a few examples in both STL and STEP format.

Some examples:

Create the default 1u keycap

cap = keycap()
show_object(cap)

1U keycap

Create a 1.5U keycap

cap = keycap(unitX=1.5)
show_object(cap)

1.5U keycap

Create a flat top (not angled) 2U keycap

cap = keycap(unitX=2, angle=0)
show_object(cap)

2U flat top

Create a 4U spacebar

cap = keycap(unitX=4, angle=1, convex=True)
show_object(cap)

4U spacebar

A 2.25U Return key in system-default-serif font

cap = keycap(unitX=2.25, legend="Return", font="serif", fontsize=8)
show_object(cap)

Return

Save and Export results

CQ can export in many formats including STEP and STL. The easiest way to export an STL in CQ-Editor is by selecting the model in the 3D view and then clicking on Tools > Export as STL.

Of course it can be done programmatically and that can make exporting an entire keyboard very easy. The following code exports an STL and a STEP file.

cap = keycap()
show_object(cap)

exporters.export(cap, 'keycap.stl', tolerance=0.001, angularTolerance=0.05)
exporters.export(cap, 'keycap.step')

Notes / Recommendations

Default angle is 7deg that should be a good starting point for Row 3.

For spacebars a small angle (0-4deg) is recommended.

Not all fonts will be centered correctly, choose carefully. I'll add some way to better center the legends.

The code includes an example to use a DXF drawing as legend (check the comments at the end of the keycap function).

TODO

  • add support for vertical key
  • add stepped key
  • add ISO Enter
  • 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opk-0.0.7.tar.gz (18.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opk-0.0.7-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file opk-0.0.7.tar.gz.

File metadata

  • Download URL: opk-0.0.7.tar.gz
  • Upload date:
  • Size: 18.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for opk-0.0.7.tar.gz
Algorithm Hash digest
SHA256 bdc8b7baed22789628a970293338c442980697b493e9cd5e16ee05b0d20325b4
MD5 b8a0ea743792618594367cd9b998888b
BLAKE2b-256 848416baaf5eef96d5de22c83bea74769ac680bede5ceeebe21c60d17e9263b2

See more details on using hashes here.

File details

Details for the file opk-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: opk-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for opk-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 2442f94d0ead67bfba1a19f36eb83107a27137d35a82491fca7911205ba19985
MD5 39b4b65583b96efaa5a4cffb3a99e986
BLAKE2b-256 2e398f816fea4bfb1dc8d6f4a11b9cda45e96b4a042d8482a1721ecb8aa6182b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page