Merge branch 'master' into flat-sided-keycaps

This commit is contained in:
Bob 2020-05-01 13:06:29 -04:00
commit 842866e427
7 changed files with 86 additions and 1018 deletions

View File

@ -7,22 +7,13 @@ This library is a keycap and keyset construction library for mechanical keyboard
Relevant links:
* Thingiverse: https://www.thingiverse.com/thing:2783650
* Shapeways: https://www.shapeways.com/designer/rsheldiii/creations
* Buy me a coffee: https://ko-fi.com/rsheldiii, but only if you want to!
## How to run
#### Thingiverse Customizer
#### OpenSCAD Proper (recommended way)
The easiest (though not the best) way to run this program is to boot it up in [Thingiverse's Customizer](https://www.thingiverse.com/apps/customizer/run?thing_id=2783650). Explanations of each option are provided, as well as some default variables. Twiddle the variables to see how the keycap changes!
The customizer is not always kept up to date, so I recommend the options below.
#### OpenSCAD Customizer
If you find that the Thingiverse Customizer is timing out, but you're not technically inclined enough to start programming in OpenSCAD, you can look into [getting OpenSCAD's customizer working](https://github.com/rsheldiii/KeyV2/wiki/Getting-the-OpenSCAD-Customizer-working).
#### OpenSCAD Proper
If you are technically inclined at all, this is definitely the recommended way to run the code. It's not very hard!
If you are technically inclined at all, this is definitely the best way to run the code. It's not very hard!
First, you'll need OpenSCAD: http://www.openscad.org/downloads.html. I highly recommend installing the development snapshot, as they generally support more features and are relatively stable. Development snapshots are listed in their own section on the downloads page.
@ -30,6 +21,18 @@ After you have openSCAD installed, you need to download the code and run it. run
All examples below assume you are running the library on your computer with OpenSCAD.
#### OpenSCAD Customizer
If you're not technically inclined enough to start programming in OpenSCAD (it's easier than you think), you can look into [getting OpenSCAD's customizer working](https://github.com/rsheldiii/KeyV2/wiki/Getting-the-OpenSCAD-Customizer-working).
`customizer.scad` is auto-generated from the other files in this repository due to a quirk with how OpenSCAD shows customizer settings. It should be perpetually kept up to date, but there may be some bugs. feel free to open an issue if you find one!
#### Thingiverse Customizer
The easiest and buggiest way to run this program is to boot it up in [Thingiverse's Customizer](https://www.thingiverse.com/apps/customizer/run?thing_id=2783650). Explanations of each option are provided, as well as some default variables. Twiddle the variables to see how the keycap changes!
Unfortunately I don't think I can update the Thingiverse customizer without breaking it, so you don't get all the cool new features I've been developing over the past couple years.
## High-level overview
This library supports Cherry and Alps switches, and has pre-defined key profiles for SA, DSA, DCS, G20, Hi-Pro and (some form of) OEM keycaps. `keys.scad` is the entry point for everything but the most technical use. Pre-programmed key profiles can be found in the `key_profiles` directory.

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,8 @@ row = 1; // [5,1,2,3,4,0]
// What does the top of your key say?
legend = "";
$using_customizer = true;
include <src/settings.scad>
include <src/key_sizes.scad>
@ -18,8 +20,7 @@ include <src/key_profiles.scad>
include <src/key_types.scad>
include <src/key_transformations.scad>
include <src/key_helpers.scad>
use <src/key.scad>
include <src/key.scad>
key_profile(key_profile, row) legend(legend) {
key();

View File

@ -5,12 +5,10 @@ module OpenSCAD
Dir.chdir File.dirname(filename)
lines = lines.flat_map do |line|
# please note we do not implement `use` at all
if line =~ /(include|use)\s*<(.*)>/
# File.readlines("./#{$2}")
expand("./#{$2}")
# in lieu of actually implementing `use`, we can just cull this final line from key.scad
elsif line =~ /example\_key\(\);/
""
else
line
end

View File

@ -430,4 +430,6 @@ module example_key(){
key();
}
if (!$using_customizer) {
example_key();
}

View File

@ -72,66 +72,3 @@ function profile_segment_length(profile,i) = norm(profile[(i+1)%len(profile)] -
// Generates an array with n copies of value (default 0)
function dup(value=0,n) = [for (i = [1:n]) value];
use <scad-utils/transformations.scad>
use <scad-utils/trajectory_path.scad>
use <scad-utils/trajectory.scad>
use <scad-utils/shapes.scad>
module fakeISOEnter(thickness_difference = 0){
// 1u is the space taken upy by a 1u keycap.
// unit is the space taken up by a unit space for a keycap.
// formula is 1u + unit *(length - 1)
// t is all modifications to the polygon array
t = thickness_difference/2 - (19.02 - 18.16);
function unit(length) = 19.02 * length;
pointArray = [
[19.05 * (-.5) + t, 19.05 * (-1) + t],
[19.05 * (0.5) - t, 19.05 * (-1) + t],
[19.05 * (0.5) - t, 19.05 * (1) - t],
[19.05 * (-0.75) + t, 19.05 * (1) - t],
[19.05 * (-0.75) + t, 19.05 * (0) + t],
[19.05 * (-0.5) + t, 19.05 * (0) + t]
];
/*translate([unit(-.5), unit(-1) + 0.86]){*/
minkowski() {
circle($corner_radius, $fn=20);
offset(r=-$corner_radius * 2, $fn=20) polygon(points=pointArray);
}
/*}*/
}
function isoEnter() = [
[19.05 * (-.5) + (19.02 - 18.16), 19.05 * (-1) + (19.02 - 18.16)],
[19.05 * (0.5) - (19.02 - 18.16), 19.05 * (-1) + (19.02 - 18.16)],
[19.05 * (0.5) - (19.02 - 18.16), 19.05 * (1) - (19.02 - 18.16)],
[19.05 * (-0.75) + (19.02 - 18.16), 19.05 * (1) - (19.02 - 18.16)],
[19.05 * (-0.75) + (19.02 - 18.16), 19.05 * (0) + (19.02 - 18.16)],
[19.05 * (-0.5) + (19.02 - 18.16), 19.05 * (0) + (19.02 - 18.16)]
];
path_definition = [
trajectory(forward = 10, roll = 0),
];
// sweep
path = quantize_trajectories(path_definition, steps=100);
// skin
myLen = len(path)-1;
trans = [ for (i=[0:len(path)-1]) transform(path[i], isoEnter()) ];
translate([0,10,0])
skin(trans);

View File

@ -18,8 +18,6 @@ $font_size = 6;
// Set this to true if you're making a spacebar!
$inverted_dish = false;
// set this to true if you are making double sculpted keycaps
$double_sculpted = false;
// change aggressiveness of double sculpting
// this is the radius of the cylinder the keytops are placed on
$double_sculpt_radius = 200;
@ -31,13 +29,11 @@ $support_type = "flared"; // [flared, bars, flat, disable]
// Supports for the stem, as it often comes off during printing. Reccommended for most machines
$stem_support_type = "tines"; // [tines, brim, disabled]
// enable to have stem support extend past the keycap bottom, to (hopefully) the next
// keycap. only works on tines right now
$extra_long_stem_support = false;
// make legends outset instead of inset.
// broken off from artisan support since who wants outset legends?
$outset_legends = false;
/* [Advanced] */
/* Key */
/* [Key] */
// Height in units of key. should remain 1 for most uses
$key_height = 1.0;
// Keytop thickness, aka how many millimeters between the inside and outside of the top surface of the key
@ -68,7 +64,7 @@ $top_skew = 1.7;
// for double axis sculpted keycaps and probably not much else
$top_skew_x = 0;
/* Stem */
/* [Stem] */
// How far the throw distance of the switch is. determines how far the 'cross' in the cherry switch digs into the stem, and how long the keystem needs to be before supports can start. luckily, alps and cherries have a pretty similar throw. can modify to have stouter keycaps for low profile switches, etc
$stem_throw = 4;
@ -82,7 +78,11 @@ $stem_inset = 0;
// How many degrees to rotate the stems. useful for sideways keycaps, maybe
$stem_rotation = 0;
/* Shape */
// enable to have stem support extend past the keycap bottom, to (hopefully) the next
// keycap. only works on tines right now
$extra_long_stem_support = false;
/* [Shape] */
// Key shape type, determines the shape of the key. default is 'rounded square'
$key_shape_type = "rounded_square";
@ -92,7 +92,7 @@ $linear_extrude_height_adjustment = 0;
// If you're doing fancy bowed keycap sides, this controls how many slices you take
$height_slices = 1;
/* Dish */
/* [Dish] */
// What type of dish the key has. note that unlike stems and supports a dish ALWAYS gets rendered.
$dish_type = "cylindrical"; // [cylindrical, spherical, sideways cylindrical, old spherical, disable]
@ -107,7 +107,7 @@ $dish_overdraw_width = 0;
// Same as width but for height
$dish_overdraw_height = 0;
/* Misc */
/* [Misc] */
// There's a bevel on the cherry stems to aid insertion / guard against first layer squishing making a hard-to-fit stem.
$cherry_bevel = true;
@ -117,19 +117,19 @@ $stem_support_height = .8;
$font="DejaVu Sans Mono:style=Book";
// Whether or not to render fake keyswitches to check clearances
$clearance_check = false;
// Use linear_extrude instead of hull slices to make the shape of the key
// Should be faster, also required for concave shapes
// Use linear_extrude instead of hull slices to make the shape of the key
$linear_extrude_shape = false;
// brand new, more correct, hopefully faster, lots more work
// warns in trajectory.scad but it looks benign
// brand new, more correct, hopefully faster, lots more work
$skin_extrude_shape = false;
//should the key be rounded? unnecessary for most printers, and very slow
// This doesn't work very well, but you can try
$rounded_key = false;
//minkowski radius. radius of sphere used in minkowski sum for minkowski_key function. 1.75 for G20
$minkowski_radius = .33;
/* Features */
/* [Features] */
//insert locating bump
$key_bump = false;
@ -140,6 +140,9 @@ $key_bump_edge = 0.4;
/* [Hidden] */
// set this to true if you are making double sculpted keycaps
$double_sculpted = false;
//list of legends to place on a key format: [text, halign, valign, size]
//halign = "left" or "center" or "right"
//valign = "top" or "center" or "bottom"
@ -152,10 +155,6 @@ $legends = [];
// Currently does not work with thingiverse customizer, and actually breaks it
$front_legends = [];
// make legends outset instead of inset.
// broken off from artisan support since who wants outset legends?
$outset_legends = false;
// print legends on the front of the key instead of the top
$front_print_legends = false;