Fix up custimzer.scad

also add git post-commit hook to generate it, so I don't have to do this again
This commit is contained in:
Bob 2020-04-24 19:51:43 -04:00
parent 555a7874bf
commit 45940e8059
6 changed files with 1718 additions and 258 deletions

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? // What does the top of your key say?
legend = ""; legend = "";
$using_customizer = true;
include <src/settings.scad> include <src/settings.scad>
include <src/key_sizes.scad> include <src/key_sizes.scad>
@ -18,8 +20,7 @@ include <src/key_profiles.scad>
include <src/key_types.scad> include <src/key_types.scad>
include <src/key_transformations.scad> include <src/key_transformations.scad>
include <src/key_helpers.scad> include <src/key_helpers.scad>
include <src/key.scad>
use <src/key.scad>
key_profile(key_profile, row) legend(legend) { key_profile(key_profile, row) legend(legend) {
key(); key();

View File

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

View File

@ -430,4 +430,6 @@ module example_key(){
key(); key();
} }
example_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) // Generates an array with n copies of value (default 0)
function dup(value=0,n) = [for (i = [1:n]) value]; 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! // Set this to true if you're making a spacebar!
$inverted_dish = false; $inverted_dish = false;
// set this to true if you are making double sculpted keycaps
$double_sculpted = false;
// change aggressiveness of double sculpting // change aggressiveness of double sculpting
// this is the radius of the cylinder the keytops are placed on // this is the radius of the cylinder the keytops are placed on
$double_sculpt_radius = 200; $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 // Supports for the stem, as it often comes off during printing. Reccommended for most machines
$stem_support_type = "tines"; // [tines, brim, disabled] $stem_support_type = "tines"; // [tines, brim, disabled]
// enable to have stem support extend past the keycap bottom, to (hopefully) the next // make legends outset instead of inset.
// keycap. only works on tines right now // broken off from artisan support since who wants outset legends?
$extra_long_stem_support = false; $outset_legends = false;
/* [Advanced] */ /* [Key] */
/* Key */
// Height in units of key. should remain 1 for most uses // Height in units of key. should remain 1 for most uses
$key_height = 1.0; $key_height = 1.0;
// Keytop thickness, aka how many millimeters between the inside and outside of the top surface of the key // 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 // for double axis sculpted keycaps and probably not much else
$top_skew_x = 0; $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 // 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; $stem_throw = 4;
@ -82,7 +78,11 @@ $stem_inset = 0;
// How many degrees to rotate the stems. useful for sideways keycaps, maybe // How many degrees to rotate the stems. useful for sideways keycaps, maybe
$stem_rotation = 0; $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, determines the shape of the key. default is 'rounded square'
$key_shape_type = "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 // If you're doing fancy bowed keycap sides, this controls how many slices you take
$height_slices = 1; $height_slices = 1;
/* Dish */ /* [Dish] */
// What type of dish the key has. note that unlike stems and supports a dish ALWAYS gets rendered. // 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] $dish_type = "cylindrical"; // [cylindrical, spherical, sideways cylindrical, old spherical, disable]
@ -107,7 +107,7 @@ $dish_overdraw_width = 0;
// Same as width but for height // Same as width but for height
$dish_overdraw_height = 0; $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. // 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; $cherry_bevel = true;
@ -117,19 +117,19 @@ $stem_support_height = .8;
$font="DejaVu Sans Mono:style=Book"; $font="DejaVu Sans Mono:style=Book";
// Whether or not to render fake keyswitches to check clearances // Whether or not to render fake keyswitches to check clearances
$clearance_check = false; $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 // 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; $linear_extrude_shape = false;
// brand new, more correct, hopefully faster, lots more work
// warns in trajectory.scad but it looks benign // warns in trajectory.scad but it looks benign
// brand new, more correct, hopefully faster, lots more work
$skin_extrude_shape = false; $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; $rounded_key = false;
//minkowski radius. radius of sphere used in minkowski sum for minkowski_key function. 1.75 for G20 //minkowski radius. radius of sphere used in minkowski sum for minkowski_key function. 1.75 for G20
$minkowski_radius = .33; $minkowski_radius = .33;
/* Features */ /* [Features] */
//insert locating bump //insert locating bump
$key_bump = false; $key_bump = false;
@ -140,6 +140,9 @@ $key_bump_edge = 0.4;
/* [Hidden] */ /* [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] //list of legends to place on a key format: [text, halign, valign, size]
//halign = "left" or "center" or "right" //halign = "left" or "center" or "right"
//valign = "top" or "center" or "bottom" //valign = "top" or "center" or "bottom"
@ -152,10 +155,6 @@ $legends = [];
// Currently does not work with thingiverse customizer, and actually breaks it // Currently does not work with thingiverse customizer, and actually breaks it
$front_legends = []; $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 // print legends on the front of the key instead of the top
$front_print_legends = false; $front_print_legends = false;