Skip to content

KeyV2 Helper Documentation

Bob edited this page Oct 12, 2019 · 4 revisions

ok so it's not really an API but it's definitely not a DSL. let's get going:

Key Transformations:

Functions that transform parts of the key. Bit of a catch-all to be honest:

translate_u(x=0, y=0, z=0):

Translate the key a certain amount of units, where a unit = 19.04mm. Helps with placing keys how they would be arranged on a keyboard

brimmed_stem_support(height = 0.4):

Add a brim around the stem to support it during printing

tined_stem_support(height = 0.4):

Add small threads connecting the stem to the outside of the keycap. Less intrusive than a brim. Can be cut off with flush cutters

rounded():

Enable a Minkowski sum, rounding the keycap. This is a very expensive operation, and depending on the version of OpenSCAD you have often fails due to the complexity of the object, but produces amazing results when it works. Use with caution

inverted():

Invert the dish on the keycap. Mostly used for spacebars in conjunction with the 'sideways cylindrical' dish type

rotated():

Rotate the stem 90 degrees. Since the default cherry stem is asymmetric this is needed in situations where the switch is rotated.

stabilized(mm=12, vertical = false, type="costar_stabilizer"):

Add stabilizers to the keycap mm distance away. 12mm (for backspace et al) and 50mm (for space) are normal values here. vertical arranges them vertically. type is the stem_type that will be used, and defaults to costar_stabilizer, which is just an alias for cherry stem. If you have cherry stabilizers switch type to cherry_stabilizer.

dishless():

Disable the dish

inset(val=1):

Inset the stem some number of mm. Hard to print, but more realistic for some key profiles

filled():

Fill the keycap. Currently broken :(

blank():

Give the keycap no stem at all. Good for artisans, if the stem will be cast separately

cherry(slop):

Use a cherry stem, with a slop factor. Default is 0.3mm, which shaves off 0.15mm from each side, and a few other places

alps(slop):

Use an alps stem, with a slop factor.

rounded_cherry(slop):

Use a rounded cherry stem, with a slop factor. very difficult to print on FDM printers.

box_cherry(slop):

Use a cherry stem that will fit in a box switch, like the Kailh box series. Very difficult to print on FDM printers.

flared_support():

Use support that flares from the top of the stem. Default

bar_support():

Use support bars that intersect the top of the stem. More realistic, but makes the keycap more difficult to print.

flat_support():

Use a flat ceiling of support, as low as possible without touching the switch

legend(text, position=[0,0], size=undef):

Add a legend to the keycap. The text is what the legend should say. the position are coordinates, with possible values of -1, 0, and 1 corresponding to 9 separate positions on the keycap. Size is the font size.

bump(depth=undef):

Add a homing bump to the keycap of a certain depth

row_profile(profile, unsculpted = false):

Generate a row of keycaps of a single profile. Must still use key(), eg row_profile("dsa") cherry() key().

Key Profiles:

Pre-packaged settings for key profiles for you to use!

dcs_row(n=3):

Imitates DCS profile keycaps.

dsa_row(n=3):

Imitates DSA profile keycaps. Sculpted version is approximated.

g20_row(n=3):

Imitates G20 profile keycaps. Rounded keys look fantastic. Sculpted version is approximated.

oem_row(n=3):

Imitates certain OEM style keycaps

sa_row(n=3):

Imitates SA profile keycaps.

Key Shapes:

Pre-packaged settings for certain common types of keys

spacebar():

Spacebar! includes directives for inverted and sideways cylindrical dishing

lshift():

Left shift

rshift():

Right shift

backspace():

Backspace

enter():

Enter

numpad_enter():

Numpad enter (vertical)

numpad_plus():

Numpad plus (alias for numpad_enter)

numpad_0():

Numpad 0 (alias for backspace)

stepped_caps_lock():

Stepped caps lock. Does not have actual step, but moves stem correctly.

iso_enter():

Experimental iso_enter. Due to the shape being concave (and weird), ISO enter is very tricky, and thus still isn't finalized.

Key Lengths and heights:

Change how long and how tall the keycap is!

u(u=1):

Change how many units long the keycap is.

uh(u=1):

Change how many units tall the keycap is.

1u()

1_25u()

1_5u()

2u()

2_25u()

2_75u()

6_25u()

1uh()

2uh()

1_25uh()

1_5uh()

2_25uh()

2_75uh()

6_25uh()