Skip to main content

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

Metadata

Release files for opk 0.0.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opk 0.0.16
File Size Uploaded
opk-0.0.16.tar.gz 18.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for opk 0.0.16
File Interpreter ABI Platform
opk-0.0.16-py3-none-any.whl Python 3 none any Details

Total release size: 18.8 MB

Release files / opk-0.0.16.tar.gz

Download URL opk-0.0.16.tar.gz
Size 18.8 MB
Tags Source
SHA-256 checksum
How to use checksums
552d11056afc453c6cc5dfac2179cb9684f44de3882fdf885e486f574decf41b
BLAKE2b-256 checksum
How to use checksums
e6b11dc60a81e0b55484c45b78a4a46f9ce3114c94378cc25dfa9ca0d44cdc2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.7

Release files / opk-0.0.16-py3-none-any.whl

Download URL opk-0.0.16-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
84f6a90a235d5d8ba19e6013b8249c046b4de5a48b31df5b359fab817cf461a4
BLAKE2b-256 checksum
How to use checksums
f650ad2185dc742a5f44345d5f9c055fc51ef73c11d7575dc1de1bd28222b2cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.7

Release history Release notifications | RSS feed

This release

0.0.16 This release

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page