rsheldiii / keyv2 Goto Github PK
View Code? Open in Web Editor NEWKeyV2: A Parametric Mechanical Keycap Library
License: GNU General Public License v3.0
KeyV2: A Parametric Mechanical Keycap Library
License: GNU General Public License v3.0
Just started openscad with this awesome project, I added some features for the layout module that could be useful to the project.
I had some issues with the recursive scope, just started openscad and I don't know how I can solve that ugly issue for the legends...
I discovered this great library while making a numpad to go along with my Cherry G84. It occured to me that it would be awesome to be able to print keycaps for that board as well. It uses the not very common Cherry ML switches. I am quite the newcommer to openscad so I don't know how easy it is to add a new stem to the library but I would be welcome to test the results :P.
All documentation I could find on the keys are these pdfs:
https://datasheet.octopart.com/MX1A-C1NW-Cherry-datasheet-15918975.pdf
https://nl.mouser.com/datasheet/2/71/Keymodule_ML_EN-462672.pdf
Also there is this https://deskthority.net/wiki/Cherry_ML.
I also don't know how much of a problem it is that their unit size is a tad smaller than the usual.
By all means, this isn't an urgent issue but I would be very happy if this could become a thing.
hey there, i was thinking of potentially printing backlit-compatible keycaps, is that possible with this library?
i know some printers allow to use two materials at once, so what if one makes a model that uses black and transparent white filaments to make a, for example, a backlit-compatible 1.75u shift?
Snippet:
include <./includes.scad>
$stem_support_type="disable";
$legends = ["A"];
$font_size = 2;
$font = "Futura Hv BT";
dsa_row() key();
No matter what I value set for $font_size
on key.scad
, it is stuck on the default value (which I believe is 6). Not present on customizer.scad
. Not sure if I am doing something wrong, or if it is a bug.
If a 2uh() key occupies 2 rows, say for oem keys, what is the correct value to pass for oem_row()? Trying to figure out how to properly define number pad Enter and Plus keys...
With the development of the examples directory, It would be nice to implement some kind of snapshot testing, where the output of the examples on your current changes are compared with the output of master.
Unlike snapshot testing for say, React, the fixtures (stl files) are going to be multiple megabytes, so it might not make sense to store them alongside the code. It might be better to generate the fixtures, then check out master and regenerate them, and compare the files.
This means that merging into master implicitly updates the fixtures, but I think that's ok.
I'm confused by the row order. Which one is correct?
5 -> F keys
1 -> Number row
2 -> Tab row
3 -> Caps row
4 -> Shift & Ctrl row
Or
5 -> F keys
4 -> Number row
3 -> Tab row
2 -> Caps row
1 -> Shift & Ctrl row
A glaring issue with this library for a while now has been that it doesn't support ISO Enter.
For context, this began when we switched from using linear_extrude
to generate keycaps to convex_hull
. convex_hull
was definitely the right choice, paving the way for proper top tilt, full sculpting, sculpted sides a la SA and DSA, etc etc. Unfortunately since the ISO enter key is a concave shape, plugging it into convex_hull
doesn't work.
The solution to this is to instead use skin
instead of convex_hull
. skin
is similar in that you pass it two (or more) shapes and it stitches them together, but it requires that:
and then it stitches the lists together, in order. In theory, you lose one feature of convex_hull
, which is stitching together shapes with different numbers of vertices, but you can now do concave shapes. In practice though, convex_hull
takes 3d primitives as input, whereas skin()
requires lists, and there is no way to currently generate a list of vertices from a shape.
it'd be great if I or someone could figure out how to generate the list for input into skin
, which is a list of x,y coordinates.
I think there's a few ways to tackle this problem:
offset
function that works on lists of x,y vertices and apply it to the list in 1. In order to generate the inset rounded corner (the "armpit" of the ISO enter if you will) you'll need to apply a negative offset first, so it'll have to be able to support that as well.I was having trouble deciding what colors to print keys in and decided it might be worth to try a color layout. The example below is quick and dirty but should let anyone play around with the idea. I'm not quite sure how a merge-worthy feature should be approached. Key labels do get very hard to read so it might be worth passing the colors down to lower levels so the individual parts of a keycap can be colored slightly differently.
diff --git a/src/layouts/layout.scad b/src/layouts/layout.scad
index cd3c9c2..f371b6d 100644
--- a/src/layouts/layout.scad
+++ b/src/layouts/layout.scad
@@ -20,7 +20,7 @@ function double_sculpted_column(column, row_length, column_sculpt_profile) =
1hand(column, row_length) : (column_sculpt_profile == "cresting_wave") ?
cresting_wave(column, row_length) : 0;
-module layout(list, profile="dcs", legends=undef, front_legends=undef, row_sculpting_offset=0, row_override=undef, column_sculpt_profile="2hands", column_override=undef) {
+module layout(list, profile="dcs", legends=undef, front_legends=undef, color_legends=undef, row_sculpting_offset=0, row_override=undef, column_sculpt_profile="2hands", column_override=undef) {
for (row = [0:len(list)-1]){
/* echo("**ROW**:", row); */
row_length = len(list[row]);
@@ -36,7 +36,8 @@ module layout(list, profile="dcs", legends=undef, front_legends=undef, row_sculp
// supports negative values for nonexistent keys
if (key_length >= 1) {
translate_u(column_distance - (key_length/2), -row) {
-
+
+ color(color_legends ? color_legends[row][column] : "")
key_profile(profile, row_sculpting, column_value) u(key_length) legend(legends ? legends[row][column] : "") front_legend(front_legends ? front_legends[row][column] : "") cherry() { // (row+4) % 5 + 1
$row = row;
$column = column;
Example layout:
include <../layout.scad>
60_percent_default_layout = [
[1,1,1,1,1,1,1,1,1,1,1,1,1,2],
[1.5,1,1,1,1,1,1,1,1,1,1,1,1,1.5],
[1.75,1,1,1,1,1,1,1,1,1,1,1,2.25],
[2.25,1,1,1,1,1,1,1,1,1,1,2.75],
[1.25,1.25,1.25,6.25,1.25,1.25,1.25,1.25]
];
home="crimson";
letters="#222222";
numbers="gray";
space=numbers;
other="saddlebrown";
shift=other;
non_letters="purple";
ctrl=other;
alt=ctrl;
fn="goldenrod";
60_percent_color_legends = [
[other, numbers, numbers, numbers, numbers, numbers, numbers, numbers, numbers, numbers, numbers, non_letters, non_letters, other],
[other, letters, letters, letters, letters, letters, letters, letters, letters, letters, letters, non_letters, non_letters, non_letters],
[other, home, home, home, home, letters, letters, home, home, home, home, non_letters, other],
[shift, letters, letters, letters, letters, letters, letters, letters, non_letters, non_letters, non_letters, shift],
[ctrl, fn, alt, space, alt, fn, fn, ctrl],
];
module 60_percent_default(profile) {
layout(60_percent_default_layout, profile, [], [], 60_percent_color_legends) children();
}
I'm trying to use a nerd font on my keycaps so I can include the various symbols which nerd fonts include, however when I try and use them, it just uses the default font. I've tried using the font name shown in Windows Font settings and the "Full Name", with and without :style=Regular
however none of this seems to work.
Sorry i am a complete noob in coding but i want to learn. I really love this easy to use code you have created but i have this question: to generate single keycaps is quite simple but on this github page there is a topic called layout. I was just wondering where i have to insert this: 60_percent_default("dcs") key(); in the code to create multiple keys at once?
Sorry if im just too blind to see the obvious answer! Thank you for this and i would really appreciate help!
Thanks again and kind regards
maxwefter
First of all - thanks for the wonderful repo - this is amazing! As title said, want to use front legends to depict what is going in with layers - some of these can be better represented in symbols. I am wondering if different fonts can be used. Here is the snippet I am using:
include <./includes.scad>
// Basic key ID
row = 3;
column = 2;
leg = "Q";
frnt_leg = "Vol +";
//font = "Wingdings";
font = "Zilla Slab"; <--------
// Legend
leg_size = 4;
leg_top_size = 4;
leg_pos = [0,0];
// Front legend
frnt_leg_size = 3;
frnt_leg_pos = [0,-0.75];
sa_row(row)
translate([25*column, 25*row, 0])
legend(leg, size=leg_size, position = leg_pos)
front_legend(frnt_leg, size = frnt_leg_size, position = frnt_leg_pos)
{
// Key dimensions
$key_length = 1;
// Stem parameters
$support_type = "flared";
$stem_throw = 4;
$stem_inset = 1;
$stem_support_type = "disabled";
$rounded_cherry_stem_d = 5.5;
$cherry_bevel = true;
// Key bump? probably only for k and d
$key_bump = false;
$key_bump_depth = 0.1;
$key_bump_edge = 2;
// Legend
$font=font; <-------
$inset_legend_depth = 0.2;
$outset_legends = false;
// Speed it up
$skin_extrude_shape = true;
key();
}
I was wondering if it's possible to have multiple characters beneath each other as the legend. I was thinking of printing some keycaps for a keyboard with 3 layers and I'd like to print the characters from each layer on the keycap.
BTW, thanks for the great project, it's been very helpful!
dcs_row(3) stepped_caps_lock() key();
I can see what you are doing, but, why cant the right side of the cap sink, so it actually models as stepped?
A similar story for ISO enter. I've read through the docs, and there's a strange issue around the 'elbow'. Notice also by running the following, you see the bottom stab clipping. Ideally if its just calling the module, can we just update that code? I was a bit lost on the elbow explanation however.
dcs_row(2) iso_enter() key();
Thank you for this work so far! I have forked it for some custom keysizes (think calling spacebar1() or spacebar7() etc). Will make a public DCS model template available once I get everything together. You did amazing work!
Hello. I'd like to print a 60% cherry keycap set with two requirements:
How do I go about doing this?
Hey apologies for ignorance!
Trying to figure out how to print he ISO Enter Key with the SA profile, is this possible? I saw the open issue on it?
What version of OpenSCAD are you on?
Master branch
Describe the bug
OpenSCAD Configurator uses $stem_inner_slop, and the code inside of upside_down(...) checks for $stem_inner_slop, however the stem code itself uses $stem_slop
To Reproduce
Pull master and open the keys.scad
Use this snippet for rendering a key:
sa_row(5)
u(1.25)
inset(val=1)
rounded_cherry($stem_slop=0)
inverted()
upside_down($stem_inner_slop=0)
key();
Replace rounded_cherry($stem_slop=0)
with rounded_cherry(0)
or rounded_cherry(slop=0)
and notice the stem reverts to the default 0.2 slop.
Replace upside_down($stem_inner_slop=0)
with upside_down()
and click render, notice the Echo error about stem slop should be 0 for upside down printing.
Additional context
Add any other context about the problem here.
I developed a way to print on the side of keycaps, but why not print on their backs? the smooth side of the keycap would face away from the user and you could do something like .1mm layers to make sure the front is smooth enough to look nice.
The side printing code should be general enough to use for this with a little tweaking
I was looking for a way to print the legend on the side of the keycap instead of on the top.
I couldn't find a way to do it. Is it coded in? If not, would it be difficult to add it? :)
Maybe I'm misunderstanding how this function works, but it appears the cherry cross tine thicknesses are reversed. Here is the function in question
// .005 purely for aesthetics, to get rid of that ugly crosshatch
function cherry_cross(slop, extra_vertical = 0) = [
// horizontal tine
[4.03 + slop, 1.15 + slop / 3],
// vertical tine
[1.25 + slop / 3, 4.23 + extra_vertical + slop / 3 + .005],
];
This gives the horizontal tine and vertical tines thicknesses of 1.15 and 1.25, respectively. When measuring gateron switches with calipers, the opposite appears to be the case.
I have printed a full set of keycaps with 0.3 slop, and they have significant side-to-side wobble despite being very tight vertically. When swapping the tine dimensions here, and lowering the slop to 0.24, I'm now getting far better fitment.
Here is the version of the function I'm using to print my keycaps now
function cherry_cross(slop, extra_vertical = 0) = [
// horizontal tine
[4.03 + slop, 1.25 + slop],
// vertical tine
[1.15 + slop, 4.23 + extra_vertical + slop],
];
(I removed the divide-by-three for my personal implementation just so the entered slop value would correspond to the exact amount of clearance)
I am trying to use this excellent tool to design a custom ESC key. I'd like it to be taller than usual. Reviewing the documentation, the only thing I can find to adjust height is in this section
https://github.com/rsheldiii/KeyV2/wiki/KeyV2-Helper-Documentation#key-lengths-and-heights but this seems to only address x,y sizes, and not z.
Is there something obvious I am missing?
Hello,
Thanks for sharing this amazing work with the world.
I was guessing if it will be possible to create two lines of text on the same keycap. Something like the may and secondary function of the key. Or maybe being able to position a different text on each corner, or something like that.
Thanks!
Basically title, I saw commits regarding dual legends but couldn't figure out how to do it.
I tried using the front_legend module, but that didn't work, I'm still new to OpenScad though so probably just my ignorance.
Thanks!
The wiki suggests using "cherry" in the "type" argument for stabilized(), but this will generate extra cherry keystems rather than cherry stabilizers (which super duper don't fit on my Cherry-stabilized Pok3r).
I think this should be suggesting "cherry_stabilizer"?
To render a blank layout of 60keys it takes ~7 min on my project.
To reduce the time to 2 min I have to render each row in a separate openscad process.
Is there any more convenient way to do it ?
I really love this library, it's fantastic! However, my favorite keycap profile is absent!
Here's a write-up by the creator, Matt3o, about the profile.
https://matt3o.com/about-mt3-profile-and-devtty-set/
I'd love to see this in here, and hell, I'd even buy you a set of MT3 @rsheldiii, should you choose to enter this profile into the library. I lack the technical expertise, as well as the calipers and other tools, to make this happen.
Any thoughts on if it's possible?
I was wondering if there is a way to generate the standard ANSI 104 key layout with your library, does the generator support 1Ux2U Keys in the vertical orientation?
Unable to input any key length as decimal (3.5 or 6.25). Using OpenSCAD Customizer.
Hello, I came across this sculpted keyset and was inspired to recreate it using KeyV2
module render_key(info) {
pos = info[0] - [4, 2.5];
x = pos[0];
y = pos[1];
x2 = pow((x + 2) * 0.75, 2);
y2 = pow((y + 0) * 1.75, 2);
y3 = pow((y + 0) * 1.20, 3);
tilt = y3;
depth = min(max(7, x2 + y2), 12);
$top_skew = 0;
$dish_depth = 1.2;
$dish_type = "spherical";
$dish_skew_y = 0;
$top_tilt = tilt;
$total_depth = depth;
cherry() key();
}
I hope these screenshots do justice in showing how choppy my results are
Is there a recommended or built-in way to achieve the desired effect?
I am having problems making a correct ISO-enter. The code I am using is:
translate_u(0,0) iso_enter() key();
Please find the attached pictures of the enter it generates.
As can be seen on the pictures, there's something wrong in the elbow point and the stabilizer parts (sorry dont know the name) come out of the keycap.
What version of OpenSCAD are you on?
2019.08.04.ci3200 (git 4952cb9a)
Describe the bug
nothing happens when the position is changed in the legend function
To Reproduce
Steps to reproduce the behavior:
legend("F7",[-1,0],3) cherry() oem_row(n=1) key();
How would I go about generating a stem by itself (to glue into an artisan keycap)? I've tried setting top & wall thickness to 0 with no luck…
I was just wondering if it would be possible to generate a "positive" version of the inset text labels, in the exact same location as they negative/inset versions are. If that was possible, I think it would allow an FDM printer to create a two-color "double shot" effect keycap.
Hi.
Brand new to your fantastic key design tool. I'm trying to print some custom OEM row 5 (escape) keys for some friends. But I've run into a bit of an issue, probably due to being unfamiliar with OpenSCAD and your library.
I initially printed the OEM key with the default stem, but forgot that I use Kailh Box Jade key for my escape. So I went to alter this to the rounded_cherry stem but desired to include stem supports to help in the printing. (I'm printing on my own Form2 SLA). The issue is best described with the image bellow:
As can be seen the "tines" stem supports protrude the outside of the key. If I change the key profile to dcs this is no longer an issue. But I would like to print both oem and dcs types for friends, depending on their keyboard.
Do you know how I could fix this?
It kinds of follow the idea of ticket #5 .
In short, I am thinking of "pudding" keycaps. One strategy could be to generate the base and then a top or "hat" that will be assemble later.
What version of OpenSCAD are you on?
OpenSCAD-2019.12.21 and some earlier
Describe the bug
scad-utils generates warnings in the terminal when testing if arguments are a list
Additional context
creating this now to keep track of it - this was caused by an update in behavior in OpenSCAD, where checking len()
on a non-list returns a warning now. This does not currently affect behavior, so that's good, but it would be nice to get rid of
What version of OpenSCAD are you on?
2019.05
Describe the bug
When rendering a key without a stem, a second, larger key model overlaps the key we want to render.
To Reproduce
Render the following code:
use <src/key.scad>
include <src/settings.scad>
include <src/key_sizes.scad>
include <src/key_profiles.scad>
include <src/key_types.scad>
include <src/key_transformations.scad>
$stem_type="disable";
key();
Additional context
Removing or commenting out $stem_type="disable"; fixes the rendering. Screenshot here
With RGB gaming keyboard being the de-facto standard for gamers, I thought it could be cool to support litophany in the library.
This would be achieved by "carving" the symbol on the keycap on the underside of the top surface of the keycap. However, because of the stem being there, a different joint between stem and top surface (with a gap) should be engineered.
Alternatively (but less cool!) one could bypass the stem problem by having lithophanic symbols on the front (vertical) face of the keycap.
Just an idea. I use a blank keyboard (no symbols on it) to do office work. How cool would it be to switch on the RGB at night and having the same innocent keyboard turning in a badass frag-ready FPS gaming machine? :P Clark Kent meets Stella Pajunas-Garnand!
This is a really awesome generator! However, I am questioning whether 3d printing keycaps is a good idea. According to this and this, keyboards and 3d printed parts both have a huge bacteria problem. Printed keycaps put both those problems together!
I think this should be mentioned in the readme.
Any ideas on how to lessen the risk? Unlike when printing kitchenware, I don't think food-safe filament is going to help!
What version of OpenSCAD are you on?
2015.03-2
Describe the bug
When using g20 keycaps "g20_row(x)" legends that are not children of the key function "legend(x) key();" do not render, regardless of whether or not the legend is set to inset through the key function "key(inset=bool)"
To Reproduce
Steps to reproduce the behavior:
OpenSCAD and Thingiverse's customizers both require the variables being customized be local to the file opened. Thingiverse's customizer goes further and requires the entire project be in a single file.
I wrote a Gulp task to cat everything together a few years ago but it's an incredibly simple task that could:
both or just #1 would be fine
Hello I am new to coding and I wanted to ask how do I indent text on a keycap that i am making. I dont know if this is the right place to ask or not. Thank you ahead of time for the assistance
Would it be possible to implement these profiles? They barely exist in the market so 3D printing them would be a good alternative.
Hi, I have very little coding experience but have been picking up a little of how to utilize OpenSCAD thanks to this project :) I made an entire set of front-legend keycaps individually (not through the customizer) before I realized I could theoretically just use the premade 60% default keyboard (which would take significantly less time...) The only problem is that when I add the following to the 60% default's coding:
$front_print_legends = true;
and try to render, it comes back within seconds appearing the same. The same coding for the 60% default with top legends takes about an hour to render and the changes (such as font change) are visible. I'm not sure if I'm using the wrong code, it needs additional coding/lines to do this, or if this is just because the feature is still in beta.
Also, as far as I can tell, the customizer has no front legend capabilities. Is there a workaround for this?
I appreciate any advice. I feel like I am missing something obvious. Thanks!
Hi,
what is the license of this library, package.json mentions GPL-V3, but there are no other mentions.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.