Oh my, I'm actually updating.

Cleaned clutters, updated photos for once, Still utter spaghetti.
This commit is contained in:
pseudoku 2021-07-09 01:53:43 -05:00
parent bbdd8a5deb
commit e32c51a9de
36 changed files with 1402 additions and 5897 deletions

View file

@ -5,85 +5,107 @@ use <scad-utils/trajectory.scad>
use <scad-utils/trajectory_path.scad>
use <sweep.scad>
use <skin.scad>
//use <z-butt.scad>
/*DES (Distorted Elliptical Saddle) Sculpted Profile for 6x3 and corne thumb
Version 2: Eliptical Rectangle
//Choc Chord version Chicago Stenographer
*/
/*Tester */
keycap(
keyID = 1, //change profile refer to KeyParameters Struct
cutLen = 0, //Don't change. for chopped caps
Stem = true, //tusn on shell and stems
StemRot = 0, //change stem orientation by deg
Dish = true, //turn on dish cut
Stab = 0,
visualizeDish = false, // turn on debug visual of Dish
crossSection = false, // center cut to check internal
homeDot = false, //turn on homedots
Legends = false
);
//Stab = 24 for
//TODO add shift
//mirror([1,0,0])keycap(keyID = 4, cutLen = 8, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//
//translate([20,0,0])rotate([-15,0,180])keycap(keyID = 1, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([0,-15,-1])rotate([0,0,0])keycap(keyID = 2, cutLen = 8, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([20,-15,-1])rotate([0,0,0])keycap(keyID = 3, cutLen = 8, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
translate([0,0,0])rotate([-15,0,180])keycap(keyID = 4, cutLen = 8, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
translate([0,-18.05*1.12,0])rotate([-15,0,0])keycap(keyID = 5, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
translate([0,-18.05*2.10,10.2])rotate([-45,0,0])keycap(keyID = 6, cutLen = 8, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//Parameters
wallthickness = 2;
topthickness = 3; //2 for phat 3 for chicago
//-Parameters
wallthickness = 1.1; // 1.75 for mx size, 1.1
topthickness = 2.5; //2 for phat 3 for chicago
stepsize = 50; //resolution of Trajectory
step = 2; //resolution of ellipes
fn = 32; //resolution of Rounded Rectangles: 60 for output
layers = 40; //resolution of vertical Sweep: 50 for output
//---Stem param
slop = 0.25;
slop = 0.3;
stemRot = 0;
stemWid = 7.2;
stemLen = 5.5;
stemCrossHeight = 4;
stemWid = 8;
stemLen = 6;
stemCrossHeight = 1.8;
extra_vertical = 0.6;
stemLayers = 50; //resolution of stem to cap top transition
//#square([18.16, 18.16], center = true);
//#cube([18.16, 18.16, 10], center = true); // sanity check border
//injection param
draftAngle = 0; //degree note:Stem Only
//TODO: Add wall thickness transition?
keyParameters = //keyParameters[KeyID][ParameterID]
[
// BotWid, BotLen, TWDif, TLDif, keyh, WSft, LSft XSkew, YSkew, ZSkew, WEx, LEx, CapR0i, CapR0f, CapR1i, CapR1f, CapREx, StemEx
//Column 1
[17.16, 17.16, 4, 5, 8, 0, 0, -10, 5, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 4
[17.16, 17.16, 4, 5, 8, 0, 0, -10, -5, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 4
[17.16, 17.16, 6, 6, 9, 0, 0, 10, -5, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 12
[17.16, 17.16, 6, 6, 9, 0, 0, 10, 5, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 12
//Column 0
//Levee: Chicago in choc Dimension
[17.20, 16.00, 5.6, 5, 4.9, 0, .0, 5, -0, -0, 2, 2.5, .10, 2, .10, 3, 2, 2], //Chicago Steno R2/R4
[17.20, 16.00, 5.6, 5, 4.5, 0, .0, 0, -0, -0, 2, 2.5, .10, 3, .10, 3, 2, 2], //Chicago Steno R3 flat
[17.20, 16.00, 1.25, 1.25, 4.5, 0, .0, 0, -0, -0, 2, 2.5, .10, .5, .10, .5, 2, 2], //Chicago Steno R3 chord
//mods 3
[17.16, 17.16, 6.5, 6.5, 8, 0, 0, 2, 0, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R4
[17.16, 17.16, 6.5, 6.5, 8, 0, 0, 0, 0, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 8, 0, 0, 2, 0, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R2
[17.20, 16.00, 4.25, 3.25, 5.5, -.7, 0.7, 0, -4, -0, 2, 2, .10, 2, .10, 2, 2, 2], //Levee Corner R2
[17.20, 16.00, 4.25, 3.25, 5.2, -.8, 0.6, 0, -4, -0, 2, 3, .10, 2, .10, 2, 2, 2], //Levee Corner R2
//1.25 5
[21.3, 15.60, 5.6, 5, 4.5, 0, .0, 5, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R2/R4 1.25u
[21.4, 15.60, 5.6, 5, 4.5, 0, .0, 0, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R3 1.25u
//1.5 7
[26.15, 15.60, 5.6, 5, 4.5, 0, .0, 5, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R2/R4 1.5
[26.15, 15.60, 5.6, 5, 4.5, 0, .0, 0, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R3 1.5u
//1.75 9
[30.90, 15.60, 5.6, 5, 4.5, 0, .0, 5, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R2/R4 1.5
[30.90, 15.60, 5.6, 5, 4.5, 0, .0, 0, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R3 1.5u
//2.00 11
[35.70, 15.60, 5.6, 5, 4.5, 0, .0, 5, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R2/R4 1.5
[30.90, 15.60, 5.6, 5, 4.5, 0, .0, 0, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R3 1.5u
// Ergo shits
[18.75, 18.75, 5.6, 5, 8, 0, .25, 0, -0, -0, 2, 2.5, .10, 3, .10, 3, 2, 2], //highpro 19.05 R2|4
[17.20, 16.00, 5.6, 5, 4.7, 0, .0, 3, -0, -0, 2, 2.5, .10, 2, .10, 3, 2, 2], //Chicago Steno R2 ALT
[17.20, 16.00, 5.6, 5, 5.5, 0, .0, 7, -0, -0, 2, 2.5, .10, 2, .10, 3, 2, 2], //Chicago Steno R1 Steap
[17.20, 16.00, 5.6, 5, 7.0, 0, .0, 10, -0, -0, 2, 2.5, .10, 2, .10, 3, 2, 2] //Chicago Steno R1 mild with alt R2
];
dishParameters = //dishParameter[keyID][ParameterID]
[
//FFwd1 FFwd2 FPit1 FPit2 DshDep DshHDif FArcIn FArcFn FArcEx BFwd1 BFwd2 BPit1 BPit2 BArcIn BArcFn BArcEx
//Column 2
[ 5, 4.8, 5, -48, 5, 2, 10.5, 10, 2, 5, 4, 13, -40, 10.5, 18, 2], //T1
[ 5, 4.8, 5, -48, 5, 2, 10.5, 10, 2, 5, 4, 13, -40, 10.5, 18, 2], //T1
[ 5, 4.8, 5, -48, 5, 2, 10.5, 10, 2, 3, 3, 3, -40, 10.5, 10.5, 2], //T1
[ 5, 4.8, 5, -48, 5, 2, 10.5, 10, 2, 5, 4, 13, -40, 10.5, 18, 2], //T1
//Column 0
[ 4.5, 4, 7, -50, 7, 1.7, 11, 17, 2, 4.5, 4, 2, -35, 11, 15, 2], //Chicago Steno R2/R4
[ 4.5, 4, 5, -40, 7, 1.7, 11, 15, 2, 4.5, 4, 5, -40, 11, 15, 2], //Chicago Steno R3 flat
[ 4.5, 4, 5, -40, 7, 1.7, 11, 15, 2, 4.5, 4, 5, -40, 11, 15, 2], //Chicago Steno R3 chord
[ 6, 3, 18, -50, 5, 1.8, 8.5, 15, 2, 3, 3, -5, -30, 8.5, 8.5, 2], //R4
[ 6, 3, 18, -50, 5, 1.8, 8.5, 15, 2, 5, 4, 13, -30, 8.5, 15, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 8.8, 15, 2, 3, 3, -5, -30, 8.8, 8.5, 2], //R2
[ 6, 3.5, 7, -50, 5, 1.0, 16, 23, 2, 6, 3.5, 7, -50, 16, 23, 2], //Levee Steno R2/R4
[ 6, 3.5, 7, -50, 5, 1.0, 16, 23, 2, 6, 3.5, 7, -50, 16, 23, 2], //Levee Steno R2/R4
//1.25
[ 4.5, 4, 7, -40, 8, 1.8, 15, 20, 2, 4.5, 4, 2, -35, 15, 20, 2], //Chicago Steno R2/R4
[ 4.5, 4, 5, -40, 8, 1.8, 15, 20, 2, 4.5, 4, 5, -40, 15, 20, 2], //Chicago Steno R3
//1.5
[ 4.5, 4, 7, -40, 8, 1.8, 19, 25, 2, 4.5, 4, 2, -35, 19, 25, 2], //Chicago Steno R2/R4
[ 4.5, 4, 5, -40, 8, 1.8, 19, 25, 2, 4.5, 4, 5, -40, 19, 25, 2], //Chicago Steno R3
//1.75
[ 4.5, 4, 7, -40, 8, 1.8, 22.5, 27, 2, 4.5, 4, 2, -35, 22.5, 27, 2], //Chicago Steno R2/R4
[ 4.5, 4, 5, -40, 8, 1.8, 22.5, 27, 2, 4.5, 4, 5, -40, 22.5, 27, 2], //Chicago Steno R3
//2.00
[ 4.5, 4, 7, -40, 8, 1.8, 22.5, 27, 2, 4.5, 4, 2, -35, 22.5, 27, 2], //Chicago Steno R2/R4
[ 4.5, 4, 5, -40, 8, 1.8, 22.5, 27, 2, 4.5, 4, 5, -40, 22.5, 27, 2], //Chicago Steno R3
[ 5, 5, 5, -40, 7, 1.7, 11, 15, 2, 5, 5, 5, -40, 11, 15, 2], //Chicago Steno R3 flat
[ 4.5, 4, 7, -50, 7, 1.7, 11, 17, 2, 4.5, 4, 2, -35, 11, 15, 2], //Chicago Steno R1
[ 4.5, 4, 7, -50, 7, 1.7, 11, 17, 2, 4.5, 4, 2, -35, 11, 15, 2], //Chicago Steno R1
[ 4.5, 4, 7, -50, 7, 1.7, 11, 17, 2, 4.5, 4, 2, -35, 11, 15, 2] //Chicago Steno R1
];
function FrontForward1(keyID) = dishParameters[keyID][0]; //
function FrontForward2(keyID) = dishParameters[keyID][1]; //
function FrontPitch1(keyID) = dishParameters[keyID][2]; //
function FrontPitch2(keyID) = dishParameters[keyID][3]; //
function DishDepth(keyID) = dishParameters[keyID][4]; //
function DishHeightDif(keyID) = dishParameters[keyID][5]; //
function FrontInitArc(keyID) = dishParameters[keyID][6];
function FrontFinArc(keyID) = dishParameters[keyID][7];
function FrontArcExpo(keyID) = dishParameters[keyID][8];
function BackForward1(keyID) = dishParameters[keyID][9]; //
function BackForward2(keyID) = dishParameters[keyID][10]; //
function BackPitch1(keyID) = dishParameters[keyID][11]; //
function BackPitch2(keyID) = dishParameters[keyID][12]; //
function BackInitArc(keyID) = dishParameters[keyID][13];
function BackFinArc(keyID) = dishParameters[keyID][14];
function BackArcExpo(keyID) = dishParameters[keyID][15];
function BottomWidth(keyID) = keyParameters[keyID][0]; //
function BottomLength(keyID) = keyParameters[keyID][1]; //
@ -104,6 +126,23 @@ function CapRound1f(keyID) = keyParameters[keyID][15];
function ChamExponent(keyID) = keyParameters[keyID][16];
function StemExponent(keyID) = keyParameters[keyID][17];
function FrontForward1(keyID) = dishParameters[keyID][0]; //
function FrontForward2(keyID) = dishParameters[keyID][1]; //
function FrontPitch1(keyID) = dishParameters[keyID][2]; //
function FrontPitch2(keyID) = dishParameters[keyID][3]; //
function DishDepth(keyID) = dishParameters[keyID][4]; //
function DishHeightDif(keyID) = dishParameters[keyID][5]; //
function FrontInitArc(keyID) = dishParameters[keyID][6];
function FrontFinArc(keyID) = dishParameters[keyID][7];
function FrontArcExpo(keyID) = dishParameters[keyID][8];
function BackForward1(keyID) = dishParameters[keyID][9]; //
function BackForward2(keyID) = dishParameters[keyID][10]; //
function BackPitch1(keyID) = dishParameters[keyID][11]; //
function BackPitch2(keyID) = dishParameters[keyID][12]; //
function BackInitArc(keyID) = dishParameters[keyID][13];
function BackFinArc(keyID) = dishParameters[keyID][14];
function BackArcExpo(keyID) = dishParameters[keyID][15];
function FrontTrajectory(keyID) =
[
trajectory(forward = FrontForward1(keyID), pitch = FrontPitch1(keyID)), //more param available: yaw, roll, scale
@ -112,8 +151,8 @@ function FrontTrajectory(keyID) =
function BackTrajectory (keyID) =
[
trajectory(forward = BackForward1(keyID), pitch = BackPitch1(keyID)),
trajectory(forward = BackForward2(keyID), pitch = BackPitch2(keyID)),
trajectory(backward = BackForward1(keyID), pitch = -BackPitch1(keyID)),
trajectory(backward = BackForward2(keyID), pitch = -BackPitch2(keyID))
];
//------- function defining Dish Shapes
@ -127,6 +166,17 @@ function DishShape (a,b,c,d) =
// [[c+a,-b]]
);
function DishShape2 (a,b, phi = 200, theta, r) =
concat(
// [[c+a,b]],
ellipse(a, b, d = 0,rot1 = 90, rot2 = phi),
[for (t = [-atan(-b*cos(phi)/a*sin(phi))+step:step:90])
[r*sin(t)+a*cos(phi)+r*sin(atan(b*cos(phi)/-a*sin(phi)))+a, r*cos(t)+b*sin(phi)-r*cos(atan(b*cos(phi)/-a*sin(phi)))]],
[[a,b*sin(270)+r*sin(theta)]] //bounday vertex to clear ends
);
function oval_path(theta, phi, a, b, c, deform = 0) = [
a*cos(theta)*cos(phi), //x
c*sin(theta)*(1+deform*cos(theta)) , //
@ -135,7 +185,6 @@ function oval_path(theta, phi, a, b, c, deform = 0) = [
path_trans2 = [for (t=[0:step:180]) translation(oval_path(t,0,10,15,2,0))*rotation([0,90,0])];
//--------------Function definng Cap
function CapTranslation(t, keyID) =
[
@ -202,11 +251,11 @@ function StemRadius(t, keyID) = pow(t/stemLayers,3)*3 + (1-pow(t/stemLayers, 3))
///----- KEY Builder Module
module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false, Dish = true, Stem = false, homeDot = false, Stab = 0) {
module keycap(keyID = 0, cutLen = 0, visualizeDish = false, crossSection = false, Dish = true, Stem = false, StemRot = 0, homeDot = false, Stab = 0, Legends = false) {
//Set Parameters for dish shape
FrontPath = quantize_trajectories(FrontTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
BackPath = quantize_trajectories(BackTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
FrontPath = quantize_trajectories(FrontTrajectory(keyID), steps = stepsize, loop=false);
BackPath = quantize_trajectories(BackTrajectory(keyID), steps = stepsize, loop=false);
//Scaling initial and final dim tranformation by exponents
function FrontDishArc(t) = pow((t)/(len(FrontPath)),FrontArcExpo(keyID))*FrontFinArc(keyID) + (1-pow(t/(len(FrontPath)),FrontArcExpo(keyID)))*FrontInitArc(keyID);
@ -227,104 +276,71 @@ module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false,
}
}
if(Stem == true){
rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop); // generate mx cherry stem, not compatible with box
if (Stab != 0){
translate([Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
translate([-Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
//TODO add binding support?
rotate([0,0,StemRot]){
choc_stem(draftAng = draftAngle);
if (Stab != 0){
// no need for stab
}
translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), rounded_rectangle_profile(StemTransform(i, keyID),fn=fn,r=StemRadius(i, keyID)))]); //outer shell
}
translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), rounded_rectangle_profile(StemTransform(i, keyID),fn=fn,r=StemRadius(i, keyID)))]); //Transition Support for taller profile
}
//cut for fonts and extra pattern for light?
}
//Cuts
//Fonts
if(cutLen != 0){
translate([sign(cutLen)*(BottomLength(keyID)+CapRound0i(keyID)+abs(cutLen))/2,0,0])
cube([BottomWidth(keyID)+CapRound1i(keyID)+1,BottomLength(keyID)+CapRound0i(keyID),50], center = true);
}
if(Legends == true){
#rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([-1,-5,KeyHeight(keyID)-2.5])linear_extrude(height = 1)text( text = "ver2", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
// #rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([0,-3.5,0])linear_extrude(height = 0.5)text( text = "Me", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
#rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([-1,-5,KeyHeight(keyID)-2.5])linear_extrude(height = 1)text( text = "ver2", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
}
//Dish Shape
if(Dish == true){
if(visualizeDish == false){
translate([-TopWidShift(keyID),.00001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
translate([-TopWidShift(keyID),.0001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(BackCurve);
} else {
#translate([-TopWidShift(keyID),.00001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)]) rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
#translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
#translate([-TopWidShift(keyID),.0001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)]) rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
#translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(BackCurve);
}
}
if(cutLen != 0){
translate([0,sign(cutLen)*(BottomLength(keyID)+CapRound0i(keyID)+abs(cutLen))/2,0])
cube([BottomWidth(keyID)+CapRound1i(keyID)+1,BottomLength(keyID)+CapRound0i(keyID),50], center = true);
}
if(crossSection == true) {
translate([0,-15,-.1])cube([15,30,15]);
translate([0,-25,-.1])cube([15,50,15]);
}
}
//Homing dot
if(homeDot == true)translate([0,0,KeyHeight(keyID)-DishHeightDif(keyID)-.25])sphere(d = 1);
if(homeDot == true){
translate([2,-4.5,KeyHeight(keyID)-DishHeightDif(keyID)+.15])sphere(d = 1);
translate([-2,-4.5,KeyHeight(keyID)-DishHeightDif(keyID)+.15])sphere(d = 1);
}
}
//------------------stems
$fn = fn;
function outer_cherry_stem(slop) = [ stemWid - slop * 2, stemLen - slop * 2];
function outer_cherry_stabilizer_stem(slop) = [4.85 - slop * 2, 6.05 - slop * 2];
function outer_box_cherry_stem(slop) = [6 - slop, 6 - slop];
// .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],
];
module inside_cherry_cross(slop) {
// inside cross
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-0.005]) {
linear_extrude(height = stemCrossHeight) {
square(cherry_cross(slop, extra_vertical)[0], center=true);
square(cherry_cross(slop, extra_vertical)[1], center=true);
}
}
// Guides to assist insertion and mitigate first layer squishing
{
for (i = cherry_cross(slop, extra_vertical)) hull() {
linear_extrude(height = 0.01, center = false) offset(delta = 0.4) square(i, center=true);
translate([0, 0, 0.5]) linear_extrude(height = 0.01, center = false) square(i, center=true);
}
}
}
module cherry_stem(depth, slop) {
difference(){
// outside shape
linear_extrude(height = depth) {
offset(r=1){
square(outer_cherry_stem(slop) - [2,2], center=true);
module choc_stem(draftAng = 5) {
stemHeight = 3.1;
dia = .15;
wids = 1.2/2;
lens = 2.9/2;
module Stem() {
difference(){
translate([0,0,-stemHeight/2])linear_extrude(height = stemHeight)hull(){
translate([wids-dia,-3/2])circle(d=dia);
translate([-wids+dia,-3/2])circle(d=dia);
translate([wids-dia, 3/2])circle(d=dia);
translate([-wids+dia, 3/2])circle(d=dia);
}
//cuts
translate([3.9,0])cylinder(d1=7+sin(draftAng)*stemHeight, d2=7,3.5, center = true, $fn = 64);
translate([-3.9,0])cylinder(d1=7+sin(draftAng)*stemHeight,d2=7,3.5, center = true, $fn = 64);
}
inside_cherry_cross(slop);
}
}
module choc_stem() {
translate([5.7/2,0,-3.4/2+2])difference(){
cube([1.25,3, 3.4], center= true);
translate([3.9,0,0])cylinder(d=7,3.4,center = true);
translate([-3.9,0,0])cylinder(d=7,3.4,center = true);
}
translate([-5.7/2,0,-3.4/2+2])difference(){
cube([1.25,3, 3.4], center= true);
translate([3.9,0,0])cylinder(d=7,3.4,center = true);
translate([-3.9,0,0])cylinder(d=7,3.4,center = true);
}
translate([5.7/2,0,-stemHeight/2+2])Stem();
translate([-5.7/2,0,-stemHeight/2+2])Stem();
}
/// ----- helper functions
function rounded_rectangle_profile(size=[1,1],r=1,fn=32) = [
@ -370,3 +386,21 @@ function sign_y(i,n) =
i > 0 && i < n/2 ? 1 :
i > n/2 ? -1 :
0;
//lp_production_base();
//for(i = [0:3-1]){
// for(j = [0:2-1]){
// translate([(1-i)*21, (.5-j)*21,0]){
// keycap(keyID = 1, cutLen = 0, Stem =false, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish =false , crossSection = false, homeDot = true, Legends = false);
//// import("R3X.stl");
// }
// }
// }
//for(i = [0:1-1]){
// for(j = [0:2-1]){
// translate([(1-i)*21, (.5-j)*21,0]){
// keycap(keyID = 1, cutLen = 0, Stem =false, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish =false , crossSection = false, homeDot = true, Legends = false);
// }
// }
// }
//translate([(1-0)*21, (.5-0)*21,0])

View file

@ -5,36 +5,26 @@ use <scad-utils/trajectory.scad>
use <scad-utils/trajectory_path.scad>
use <sweep.scad>
use <skin.scad>
//use <z-butt.scad>
/*DES (Distorted Elliptical Saddle) Sculpted Profile for 6x3 and corne thumb
Version 2: Eliptical Rectangle
//NOTE: with sweep cuts, top surface may not be visible in review, it should be visible once rendered
*/
//#square([18.16, 18.16], center = true);
//TODO add shift
mirror([0,0,0])keycap(keyID = 1, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = true, crossSection = false, homeDot = false, Legends = false);
//#translate([0,0,0])cube([14.5, 13.5, 10], center = true); // internal check
//#translate([0,0,0])cube([17.5, 16.5, 10], center = true); // external check
//n translate([0,19, 0])keycap(keyID = 3, cutLen = 0, Stem =true, Dish = true, visualizeDish = true, crossSection = true, homeDot = false, Legends = false);
// translate([0,38, 0])mirror([0,1,0])keycap(keyID = 2, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = true, homeDot = false, Legends = false);
RowHome = [0,2.5,5,2.5,0,0];
//for(Col = [6:6]){
// for(Row = [1:3]){
// translate([19*Col, 19*Row +RowHome[Col], 0])keycap(keyID = Col*4+Row, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
// }
//}
//#translate([0,38,13])cube([18-5.7, 18-5.7,1],center = true);
mirror([0,0,0])keycap(
keyID = 1, //change profile refer to KeyParameters Struct
cutLen = 0, //Don't change. for chopped caps
Stem = true, //tusn on shell and stems
StemRot = 0,//change stem orientation by deg
Dish = true, //turn on dish cut
Stab = 0,
visualizeDish = false, // turn on debug visual of Dish
crossSection = false, // center cut to check internal
homeDot = false, //turn on homedots
Legends = false
);
//Parameters
wallthickness = 1.2;
topthickness = 3; //
topthickness = 2; //
stepsize = 50; //resolution of Trajectory
step = 1; //resolution of ellipes
fn = 32; //resolution of Rounded Rectangles: 60 for output
@ -42,7 +32,6 @@ layers = 40; //resolution of vertical Sweep: 50 for output
dotRadius = 1.25; //home dot size
//---Stem param
slop = 0.25;
stemRot = 0;
stemWid = 8;
stemLen = 6;
stemCrossHeight = 1.8;
@ -54,22 +43,39 @@ driftAngle = 0;
keyParameters = //keyParameters[KeyID][ParameterID]
[
// BotWid, BotLen, TWDif, TLDif, keyh, WSft, LSft XSkew, YSkew, ZSkew, WEx, LEx, CapR0i, CapR0f, CapR1i, CapR1f, CapREx, StemEx
//normie hipro
[17.16, 17.16, 6.5, 6.5, 5.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 1u
[35.96, 17.16, 6.5, 6.5, 5.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 2u ver 1
[35.96, 17.16, 6.5, 6.5, 5.5, 0, 0, -0, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4 2u ver 1
[35.96, 17.16, 6.5, 6.5, 5.5, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 2u ver 1
[16.90, 15.80, 7, 4, 5.5, 0, .0, 5, -0, -0, 2, 3, .75, 1, .75, 4, 2, 2],
[16.80, 15.80, 7, 4, 5.5, 0, .0, 5, -0, -0, 2, 3, .75, 1, .75, 4, 2, 2],
[17.16, 17.16, 6.5, 6.5, 14.0, 0, 0, -14, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//Column 0
//Levee: Chicago in choc Dimension
[17.20, 16.00, 5.6, 5, 3.8, 0, -.5, 7, -0, -0, 2, 2, .10, 3, .10, 3, 2, 2], //Chicago Steno R2x 1u
[17.20, 16.00, 5.6, 5, 4.4, 0, .0, 0, -0, -0, 2, 2, .10, 3, .10, 3, 2, 2], //Chicago Steno R3x 1u
[35.85, 15.65, 7, 7, 4.4, 0, .0, 0, -0, -0, 2, 2, .30, 5, .30, 5, 2, 2], //Chicago Steno R3x 1.5u
[35.85, 15.65, 7, 7, 4.4, 0, .0, 0, -0, -0, 2, 2, .30, 5, .30, 5, 2, 2], //Chicago Steno R3x 2u
//mods 3
[17.20, 16.00, 4.25, 3.25, 5.5, -.7, 0.7, 0, -4, -0, 2, 2, .10, 2, .10, 2, 2, 2], //Levee Corner R2
[17.20, 16.00, 4.25, 3.25, 5.2, -.8, 0.6, 0, -4, -0, 2, 3, .10, 2, .10, 2, 2, 2], //Levee Corner R2
//1.25 5
[21.3, 15.60, 5.6, 5, 4.5, 0, .0, 5, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R2/R4 1.25u
[21.4, 15.60, 5.6, 5, 4.5, 0, .0, 0, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R3 1.25u
//1.5 7
[26.15, 15.60, 5.6, 5, 4.5, 0, .0, 5, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R2/R4 1.5
[26.15, 15.60, 5.6, 5, 4.5, 0, .0, 0, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R3 1.5u
//1.75 9
[30.90, 15.60, 5.6, 5, 4.5, 0, .0, 5, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R2/R4 1.5
[30.90, 15.60, 5.6, 5, 4.5, 0, .0, 0, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R3 1.5u
// Ergo shits
[18.75, 18.75, 5.6, 5, 8, 0, .25, 0, -0, -0, 2, 2.5, .10, 3, .10, 3, 2, 2], //highpro 19.05 R2|4
[17.20, 16.00, 5.6, 5, 4.7, 0, .0, 3, -0, -0, 2, 2.5, .10, 2, .10, 3, 2, 2], //Chicago Steno R2 ALT
[17.20, 16.00, 5.6, 5, 5.5, 0, .0, 7, -0, -0, 2, 2.5, .10, 2, .10, 3, 2, 2], //Chicago Steno R1 Steap
[17.20, 16.00, 5.6, 5, 7.0, 0, .0, 10, -0, -0, 2, 2.5, .10, 2, .10, 3, 2, 2], //Chicago Steno R1 mild with alt R2
];
dishParameters = //dishParameter[keyID][ParameterID]
[
//FFwd1 FFwd2 FPit1 FPit2 DshDepi DishDepf,DshHDif FArcIn FArcFn FArcEx BFwd1 BFwd2 BPit1 BPit2 BArcIn BArcFn BArcEx
[ 4, 4.2, -5, -20, 1.5, 3.25, 8.2, 9, 2, 5, 3, -5, -20, 8.2, 9, 2], //R5 2u
[ 4, 4.2, -5, -20, 2, 4.25, 18.2, 21, 2, 5, 3, -5, -20, 18.2, 21, 2], //R5 2u
[ 4, 4.2, -5, -15, 1, 3, 18.2, 21, 2, 4, 4.2, -5, -15, 18.2, 21, 2], //R4 2u
[ 5, 2.3, 2, -55, 1.5, 3.75, 8.5, 8.5, 2, 5, 3, 2, -50, 8.5, 8.7 , 2], //R2x 1u
[ 4.5, 3.3, -3, -45, 1.5, 3.75, 8.5, 8.7, 2, 4.5, 3.3, -3, -45, 8.5, 8.7, 2], //R3x 1u
[ 4.5, 3.2, -5, -45, 1.5, 3.75, 19.0, 18, 2, 4.5, 3.2, -5, -45, 19.0, 18, 2], //R3x 2u
[ 4.5, 3.2, -5, -45, 1.5, 3.75, 19.0, 18, 2, 4.5, 3.2, -5, -45, 19.0, 18, 2], //R3x 2u
[ 4, 4.2, -5, -15, 1, 3, 18.2, 21, 2, 5, 3, -5, -15, 18.2, 21, 2], //R3 2u
[ 4., 1.5, 8, -55, 3, 7, 9.0, 9, 2, 4, 3, 3, -50, 9, 9, 2], //R3
[ 4., 1.5, -0, -50, 3, 7, 9.0, 9, 2, 4, 3, -10, -50, 9, 9, 2], //R3
@ -210,7 +216,7 @@ function StemRadius(t, keyID) = pow(t/stemLayers,3)*3 + (1-pow(t/stemLayers, 3))
///----- KEY Builder Module
module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false, Dish = true, Stem = false, homeDot = false, Stab = 0) {
module keycap(keyID = 0, cutLen = 0, visualizeDish = false, csrossSection = false, Dish = true, Stem = false,StemRot = 0, homeDot = false, Stab = 0) {
//Set Parameters for dish shape
FrontPath = quantize_trajectories(FrontTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
@ -235,13 +241,13 @@ module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false,
}
}
if(Stem == true){
translate([0,0,StemBrimDep])rotate([0,0,stemRot])choc_stem(); // generate mx cherry stem, not compatible with box
translate([0,0,StemBrimDep])rotate([0,0,StemRot])choc_stem();
if (Stab != 0){
translate([Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
translate([-Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
// translate([Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
// translate([-Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
//TODO add binding support?
}
#translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), rounded_rectangle_profile(StemTransform(i, keyID),fn=fn,r=StemRadius(i, keyID)))]); //Transition Support for taller profile
rotate([0,0,StemRot])translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), rounded_rectangle_profile(StemTransform(i, keyID),fn=fn,r=StemRadius(i, keyID)))]); //Transition Support for taller profile
}
//cut for fonts and extra pattern for light?
}
@ -274,78 +280,30 @@ module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false,
//------------------stems
$fn = fn;
function outer_cherry_stem(slop) = [ stemWid - slop * 2, stemLen - slop * 2];
function outer_cherry_stabilizer_stem(slop) = [4.85 - slop * 2, 6.05 - slop * 2];
function outer_box_cherry_stem(slop) = [6 - slop, 6 - slop];
// .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],
];
module inside_cherry_cross(slop) {
// inside cross
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-0.005]) {
linear_extrude(height = stemCrossHeight) {
square(cherry_cross(slop, extra_vertical)[0], center=true);
square(cherry_cross(slop, extra_vertical)[1], center=true);
}
}
// Guides to assist insertion and mitigate first layer squishing
{
for (i = cherry_cross(slop, extra_vertical)) hull() {
linear_extrude(height = 0.01, center = false) offset(delta = 0.4) square(i, center=true);
translate([0, 0, 0.5]) linear_extrude(height = 0.01, center = false) square(i, center=true);
}
}
}
module cherry_stem(depth, slop) {
D1=.15;
D2=.05;
H1=3.5;
CrossDist = 1.75;
difference(){
// outside shape
linear_extrude(height = depth) {
offset(r=1){
square(outer_cherry_stem(slop) - [2,2], center=true);
}
}
inside_cherry_cross(slop);
hull(){
translate([CrossDist,CrossDist-.1,0])cylinder(d1=D1, d2=D2, H1);
translate([-CrossDist,-CrossDist+.1,0])cylinder(d1=D1, d2=D2, H1);
}
hull(){
translate([-CrossDist,CrossDist-.1])cylinder(d1=D1, d2=D2, H1);
translate([CrossDist,-CrossDist+.1])cylinder(d1=D1, d2=D2, H1);
}
}
}
module choc_stem(draftAng = 2) {
stemHeinght = 3.1;
module choc_stem(draftAng = 5) {
stemHeight = 3.1;
dia = .15;
wids = 1.2/2;
lens = 2.9/2;
module Stem() {
difference(){
hull(){
translate([0,0,-stemHeinght/2])cube([1.25-sin(draftAng)*stemHeinght,3-sin(draftAng)*stemHeinght,.001], center= true);
translate([0,0,stemHeinght/2])cube([1.25,3,.001], center= true);
translate([0,0,-stemHeight/2])linear_extrude(height = stemHeight)hull(){
translate([wids-dia,-3/2])circle(d=dia);
translate([-wids+dia,-3/2])circle(d=dia);
translate([wids-dia, 3/2])circle(d=dia);
translate([-wids+dia, 3/2])circle(d=dia);
}
//cuts
translate([3.9,0])cylinder(d1=7+sin(draftAng)*stemHeinght, d2=7,3.5, center = true);
translate([-3.9,0])cylinder(d1=7+sin(draftAng)*stemHeinght,d2=7,3.5, center = true);
//cuts
translate([3.9,0])cylinder(d1=7+sin(draftAng)*stemHeight, d2=7,3.5, center = true, $fn = 64);
translate([-3.9,0])cylinder(d1=7+sin(draftAng)*stemHeight,d2=7,3.5, center = true, $fn = 64);
}
}
translate([5.7/2,0,-stemHeinght/2+2])Stem();
translate([-5.7/2,0,-stemHeinght/2+2])Stem();
translate([5.7/2,0,-stemHeight/2+2])Stem();
translate([-5.7/2,0,-stemHeight/2+2])Stem();
}
/// ----- helper functions
function rounded_rectangle_profile(size=[1,1],r=1,fn=32) = [
for (index = [0:fn-1])
@ -390,3 +348,27 @@ function sign_y(i,n) =
i > 0 && i < n/2 ? 1 :
i > n/2 ? -1 :
0;
//lp_key = [
//// "base_sx", 18.5,
//// "base_sy", 18.5,
// "base_sx", 17.65,
// "base_sy", 16.5,
// "cavity_sx", 16.1,
// "cavity_sy", 14.9,
// "cavity_sz", 1.6,
// "cavity_ch_xy", 1.6,
// "indent_inset", 1.5
// ];
//Choc Chord version Chicago Stenographer
//#square([18.16, 18.16], center = true);
//translate([0,19,0])keycap(keyID = 1, cutLen = 0, Stem =false, Dish = true, Stab = 0 , visualizeDish = true, crossSection = false, homeDot = false, Legends = false);
//translate([0,0,0])lp_master_base(xu = 2, yu = 1 );
//stem_cavity_negative(lp_key, x=1, y=1);
//}
//#translate([0,0,0])cube([14.5, 13.5, 10], center = true); // internal check
//#translate([0,0,0])cube([17.5, 16.5, 10], center = true); // external check
//translate([0,17,0])mirror([0,1,0])keycap(keyID = 0, cutLen = 0, Stem =false, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([18,0,0])mirror([0,0,0])keycap(keyID = 0, cutLen = 0, Stem =false, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//n translate([0,19, 0])keycap(keyID = 3, cutLen = 0, Stem =true, Dish = true, visualizeDish = true, crossSection = true, homeDot = false, Legends = false);
// translate([0,38, 0])mirror([0,1,0])keycap(keyID = 2, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = true, homeDot = false, Legends = false);

View file

@ -5,49 +5,33 @@ use <scad-utils/trajectory.scad>
use <scad-utils/trajectory_path.scad>
use <sweep.scad>
use <skin.scad>
//use <z-butt.scad>
// Choc Chord version Chicago Stenographer with sculpte Thumb cluter
// change stemrot
//DES (Distorted Elliptical Saddle) Choc Chord version Chicago Stenographer with sculpted gergo thumb cluter
/*Tester */
translate([0, 17, 0])rotate([0,0,0])mirror([0,1,0])keycap(keyID = 6, cutLen = 0, Stem =true, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
translate([0, 0, 0])rotate([0,0,0])mirror([0,0,0])keycap(keyID = 1, cutLen = 0, Stem =true, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
translate([0, 34, 0])rotate([0,0,0])mirror([0,1,0])keycap(keyID = 7, cutLen = 0, Stem =true, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
translate([0, -17, 0])rotate([0,0,0])mirror([0,0,0])keycap(keyID = 0, cutLen = 0, Stem =true, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//
//translate([-3, 0, 0])rotate([0,0,0])mirror([0,0,0])keycap(keyID = 2, cutLen = 7, Stem =true, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([3, 0, 0])rotate([0,0,0])mirror([0,0,0])keycap(keyID = 3, cutLen = -7, Stem =true, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([0, 18, 0])rotate([0,0,0])mirror([0,0,0])keycap(keyID = 4, cutLen = 0, Stem =true, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//
// translate([0,-17.5, 0])rotate([0,0,0])mirror([0,1,0])keycap(keyID = 1, cutLen = -ChocCut, Stem =true, Dish = true, SecondaryDish = true ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//
// translate([18,-17.5, 0])rotate([0,0,180])mirror([0,0,0])keycap(keyID = 1, cutLen = -ChocCut, Stem =true, Dish = true, SecondaryDish = true ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
// translate([18, 0, 0])rotate([0,0,180])mirror([0,1,0])keycap(keyID = 1, cutLen = -ChocCut, Stem =true, Dish = true, SecondaryDish = true ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = true, Legends = false);
//
//#translate([0,17,0])cube([14.5, 13.5, 4], center = true); // internal check
//#translate([0,0,5])cube([19.05, 19.05, 10], center = true); // internal check
//#translate([0,0,0])cube([17.5, 16.5, 10], center = true); // internal check
ChocCut = 0;
thumbStem = true;
thumbDish = true;
thumbVis = false;
thumbSec = false;
mirror([1,0,0])keycap(
keyID = 1, //change profile refer to KeyParameters Struct
cutLen = 0, //Don't change. for chopped caps
Stem = true, //tusn on shell and stems
StemRot = 0,//change stem orientation by deg
Dish = true, //turn on dish cut
Stab = 0,
visualizeDish = false, // turn on debug visual of Dish
crossSection = false, // center cut to check internal
homeDot = false, //turn on homedots
Legends = false
);
//-Parameters
wallthickness = 1.1; // 1.75 for mx size, 1.1
topthickness = 2.5; //2 for phat 3 for chicago
stepsize = 50; //resolution of Trajectory
step = 6; //resolution of ellipes
fn = 16; //resolution of Rounded Rectangles: 60 for output
stepsize = 40; //resolution of Trajectory
step =2; //resolution of ellipes
fn = 32; //resolution of Rounded Rectangles: 60 for output
layers = 40; //resolution of vertical Sweep: 50 for output
//---Stem param
slop = 0.3;
stemRot = 0;
stemWid = 8;
stemLen = 6;
stemCrossHeight = 1.8;
@ -59,19 +43,27 @@ stemLayers = 50; //resolution of stem to cap top transition
draftAngle = 0; //degree note:Stem Only
//TODO: Add wall thickness transition?
keyParameters = //keyParameters[KeyID][ParameterID]
[
// BotWid, BotLen, TWDif, TLDif, keyh, WSft, LSft XSkew, YSkew, ZSkew, WEx, LEx, CapR0i, CapR0f, CapR1i, CapR1f, CapREx, StemEx
//Column 0
//Levee: Chicago in choc Dimension
[17.20, 16.00, 5.6, 5, 5.0, 0, .0, 5, -0, -0, 2, 2.5, .10, 2, .10, 3, 2, 2], //Chicago Steno R2/R4
[17.20, 16.00, 5.6, 5, 4.6, 0, .0, 0, -0, -0, 2, 2.5, .10, 3, .10, 3, 2, 2], //Chicago Steno R3 flat
[17.20, 16.00, 4.25, 3.25, 5.5, -.7, 0.7, 0, -4, -0, 2, 2, .10, 2, .10, 2, 2, 2], //Levee Corner R2
[17.20, 16.00, 4.25, 3.25, 5.2, -.8, 0.6, 0, -4, -0, 2, 3, .10, 2, .10, 2, 2, 2], //Levee Corner R2
[16.80*1.25, 15.60, 5, 4, 4.5, 0, .0, 0, -0, -0, 2, 3, .75, 3, .75, 3, 2, 2], //Chicago Steno R2/R4 1.25u
//Levee: Chicago in choc Dimension for ref
[17.20, 16.00, 5.6, 5, 5.0, 0, .0, 5, -0, -0, 2, 2.5, .10, 2, .10, 3, 2, 2], //Levee Steno R2/R4
[17.20, 16.00, 5.6, 5, 4.6, 0, .0, 0, -0, -0, 2, 2.5, .10, 3, .10, 3, 2, 2], //Levee Steno R3
//Thumb
[17.20, 16.00, 4.25, 3.25, 5.0, -.5, 0.0, -3, -3, -0, 2, 2, .10, 2, .10, 2, 2, 2], //Thumb 1
[15.65, 26.4, 5.5, 3.25, 4.9, -.5, 0.0, -3, -2, -2, 2, 2, .3, 2, .3, 2.5, 2, 2], //Thumb 1.5
[15.65, 35.8, 4.25, 3.25, 4.9, -.25, 0.0, -2.5, -4, -2, 2, 3, .3, 2, .3, 2.5, 2, 2], //Thumb 2.0
//1.25 5
[21.3, 15.60, 5.6, 5, 4.5, 0, .0, 5, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R2/R4 1.25u
[21.4, 15.60, 5.6, 5, 4.5, 0, .0, 0, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R3 1.25u
//1.5 7
[26.15, 15.60, 5.6, 5, 4.5, 0, .0, 5, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R2/R4 1.5
[26.15, 15.60, 5.6, 5, 4.5, 0, .0, 0, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R3 1.5u
//1.75 9
[30.90, 15.60, 5.6, 5, 4.5, 0, .0, 5, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R2/R4 1.5
[30.90, 15.60, 5.6, 5, 4.5, 0, .0, 0, -0, -0, 2, 2, .5, 3, .5, 3, 2, 2], //Chicago Steno R3 1.5u
// Ergo shits
[18.75, 18.75, 5.6, 5, 8, 0, .25, 0, -0, -0, 2, 2.5, .10, 3, .10, 3, 2, 2], //highpro 19.05 R2|4
[17.20, 16.00, 5.6, 5, 4.7, 0, .0, 3, -0, -0, 2, 2.5, .10, 2, .10, 3, 2, 2], //Chicago Steno R2 ALT
[17.20, 16.00, 5.6, 5, 5.5, 0, .0, 7, -0, -0, 2, 2.5, .10, 2, .10, 3, 2, 2], //Chicago Steno R1 Steap
@ -81,15 +73,25 @@ keyParameters = //keyParameters[KeyID][ParameterID]
dishParameters = //dishParameter[keyID][ParameterID]
[
//FFwd1 FFwd2 FPit1 FPit2 DshDep DshHDif FArcIn FArcFn FArcEx BFwd1 BFwd2 BPit1 BPit2 BArcIn BArcFn BArcEx
//FFwd1 FFwd2 FPit1 FPit2 DshDep DshHDif FArcIn FArcFn FArcEx BFwd1 BFwd2 BPit1 BPit2 BArcIn BArcFn BArcEx FTani FTanf BTani BTanf TanEX PhiInit PhiFin
//Column 0
[ 4.5, 4, 7, -50, 7, 1.7, 11, 17, 2, 4.5, 4, 2, -35, 11, 15, 2], //Chicago Steno R2/R4
[ 4.5, 4, 5, -40, 7, 1.7, 11, 15, 2, 4.5, 4, 5, -40, 11, 15, 2], //Chicago Steno R3 flat
[ 4.5, 4, 7, -50, 7, 1.7, 11, 17, 2, 4.5, 4, 2, -35, 11, 15, 2, 3, 4.5, 3, 4.5, 2, 203, 210], //Chicago Steno R2/R4
[ 4.5, 4, 5, -40, 7, 1.7, 11, 15, 2, 4.5, 4, 5, -40, 11, 15, 2, 4, 5, 4, 5, 2, 200, 210], //Chicago Steno R3 flat
[ 5, 5.5, 0, -40, 7, 1.7, 16, 18, 2, 5.5, 3.5, 5, -50, 16, 18, 2, 5, 3.75, 2, 3.75, 2, 199, 210], //T1
[ 10, 4.5, 0, -40, 7, 1.7, 16, 15, 2, 10, 3.5, 5, -50, 16, 18, 2, 3, 3.75, .75, 3.75, 2, 200, 210], //1.5u
[ 14.5, 4.5, 4, -40, 7, 1.7, 16, 18, 2, 14.5, 4.5, 2, -35, 16, 23, 2, 3, 3.75, .75, 3.75, 2, 200, 210], //2.0u
//1.25
[ 4.5, 4, 7, -40, 8, 1.8, 15, 20, 2, 4.5, 4, 2, -35, 15, 20, 2, 3, 5, 7, 5, 2, 200, 210], //Chicago Steno R2/R4
[ 4.5, 4, 5, -40, 8, 1.8, 15, 20, 2, 4.5, 4, 5, -40, 15, 20, 2, 3, 5, 7, 5, 2, 200, 210], //Chicago Steno R3
//1.5
[ 4.5, 4, 7, -40, 8, 1.8, 19, 25, 2, 4.5, 4, 2, -35, 19, 25, 2], //Chicago Steno R2/R4
[ 4.5, 4, 5, -40, 8, 1.8, 19, 25, 2, 4.5, 4, 5, -40, 19, 25, 2], //Chicago Steno R3
//1.75
[ 4.5, 4, 7, -40, 8, 1.8, 22.5, 27, 2, 4.5, 4, 2, -35, 22.5, 27, 2], //Chicago Steno R2/R4
[ 4.5, 4, 5, -40, 8, 1.8, 22.5, 27, 2, 4.5, 4, 5, -40, 22.5, 27, 2], //Chicago Steno R3
[ 6, 3.5, 7, -50, 5, 1.0, 16, 23, 2, 6, 3.5, 7, -50, 16, 23, 2], //Levee Steno R2/R4
[ 6, 3.5, 7, -50, 5, 1.0, 16, 23, 2, 6, 3.5, 7, -50, 16, 23, 2], //Levee Steno R2/R4
[ 4.5, 4, 5, -40, 8, 1.8, 15, 16, 2, 4.5, 4, 5, -40, 15, 16, 2], //Chicago Steno R2/R4
[ 5, 5, 5, -40, 7, 1.7, 11, 15, 2, 5, 5, 5, -40, 11, 15, 2], //Chicago Steno R3 flat
[ 4.5, 4, 7, -50, 7, 1.7, 11, 17, 2, 4.5, 4, 2, -35, 11, 15, 2], //Chicago Steno R1
[ 4.5, 4, 7, -50, 7, 1.7, 11, 17, 2, 4.5, 4, 2, -35, 11, 15, 2], //Chicago Steno R1
@ -99,14 +101,20 @@ dishParameters = //dishParameter[keyID][ParameterID]
SecondaryDishParam =
[
[ 6, 3.5, 7, -50, 3, 2, 8, 8, 2, 5, 5, 5, 15, 10, 20, 2], //Chicago Steno R2/R4
[ 6, 3.5, 7, -50, 3, 2, 8, 8, 2, 5, 5, 5, 15, 10, 20, 2], //Chicago Steno R2/R4
[ 6, 3.5, 7, -50, 3, 2.5, 8, 20, 3, 2, 4.2, 8, 0, 8, 8, 3], //Chicago Steno R3 flat
[ 6, 3.5, 7, -50, 3, 2.5, 8, 20, 3, 2, 4.2, 8, 0, 8, 8, 3], //Chicago Steno R3 chord
[ 6, 3.5, 7, -50, 3, 2, 8, 8, 2, 5, 5, 5, 15, 10, 20, 2], //Levee Steno R2/R4
[ 6, 3.5, 7, -50, 5, 1.0, 16, 23, 2, 6, 3.5, 7, -50, 16, 23, 2], //Levee Steno R2/R4
//1.25
[ 6, 3.5, 7, -50, 3, 2, 8, 8, 2, 5, 5, 5, 15, 10, 20, 2], //Chicago Steno R2/R4
[ 6, 3.5, 7, -50, 3, 2.5, 8, 20, 3, 1, 8, 6, 0, 8, 8, 3], //Chicago Steno R3 flat
[ 6, 3.5, 7, -50, 3, 2.5, 8, 20, 3, 2, 4.2, 8, 0, 8, 8, 3], //Chicago Steno R3 flat
//1.50
[ 6, 3.5, 7, -50, 3, 2, 8, 8, 2, 5, 5, 5, 15, 10, 20, 2], //Chicago Steno R2/R4
[ 6, 3.5, 7, -50, 3, 2.5, 8, 20, 3, 2, 4.2, 8, 0, 8, 8, 3], //Chicago Steno R3 flat
[ 6, 3.5, 7, -50, 3, 2, 8, 8, 2, 5, 5, 5, 15, 10, 20, 2], //Chicago Steno R1
[ 6, 3.5, 7, -50, 3, 2, 8, 8, 2, 5, 5, 5, 15, 10, 20, 2], //Chicago Steno R1
[ 6, 3.5, 7, -50, 3, 2, 8, 8, 2, 5, 5, 5, 15, 10, 20, 2], //Chicago Steno R1
@ -147,6 +155,13 @@ function BackPitch2(keyID) = dishParameters[keyID][12]; //
function BackInitArc(keyID) = dishParameters[keyID][13];
function BackFinArc(keyID) = dishParameters[keyID][14];
function BackArcExpo(keyID) = dishParameters[keyID][15];
function ForwardTanInit(keyID)= dishParameters[keyID][16];
function ForwardTanFin(keyID) = dishParameters[keyID][17];
function BackTanInit(keyID) = dishParameters[keyID][18];
function BackTanFin(keyID) = dishParameters[keyID][19];
function TanArcExpo(keyID) = dishParameters[keyID][20];
function TransitionAngleInit(keyID) = dishParameters[keyID][21];
function TransitionAngleFin(keyID) = dishParameters[keyID][22];
function SFrontForward1(keyID) = SecondaryDishParam[keyID][0]; //
function SFrontForward2(keyID) = SecondaryDishParam[keyID][1]; //
@ -174,8 +189,8 @@ function FrontTrajectory(keyID) =
function BackTrajectory (keyID) =
[
trajectory(forward = BackForward1(keyID), pitch = BackPitch1(keyID)),
trajectory(forward = BackForward2(keyID), pitch = BackPitch2(keyID)),
trajectory(backward = BackForward1(keyID), pitch = -BackPitch1(keyID)),
trajectory(backward = BackForward2(keyID), pitch = -BackPitch2(keyID)),
];
function SFrontTrajectory(keyID) =
@ -202,6 +217,29 @@ function DishShape (a,b,c,d) =
// [[c+a,-b]]
);
function DishShape2 (a,b, phi = 200, theta, r) =
concat(
// [[c+a,b]],
ellipse(a, b, d = 0,rot1 = 90, rot2 = phi),
[for (t = [step:step*2:theta])let( sig = atan(a*cos(phi)/-b*sin(phi)))
[ r*cos(-atan(-a*cos(phi)/b*sin(phi))-t)
+a*cos(phi)
-r*cos(sig)
+a,
r*sin(-atan(-a*cos(phi)/b*sin(phi))-t)
+b*sin(phi)
+r*sin(sig)]
],
[[a,b*sin(phi)-r*sin(theta)*2]] //bounday vertex to clear ends
);
function oval_path(theta, phi, a, b, c, deform = 0) = [
a*cos(theta)*cos(phi), //x
c*sin(theta)*(1+deform*cos(theta)) , //
@ -254,8 +292,8 @@ function InnerTransform(t, keyID) =
function StemTranslation(t, keyID) =
[
((1-t)/stemLayers*TopWidShift(keyID)), //X shift
((1-t)/stemLayers*TopLenShift(keyID)), //Y shift
0, //X shift
0, //Y shift
stemCrossHeight+.1 + (t/stemLayers*(KeyHeight(keyID)- topthickness - stemCrossHeight-.1)) //Z shift
];
@ -275,9 +313,17 @@ function StemTransform(t, keyID) =
function StemRadius(t, keyID) = pow(t/stemLayers,3)*3 + (1-pow(t/stemLayers, 3))*1;
//Stem Exponent
//
function FTanRadius(t, keyID) = pow(t/stepsize,TanArcExpo(keyID) )*ForwardTanInit(keyID) + (1-pow(t/stepsize, TanArcExpo(keyID) ))*ForwardTanFin(keyID);
function BTanRadius(t, keyID) = pow(t/stepsize,TanArcExpo(keyID) )*BackTanInit(keyID) + (1-pow(t/stepsize, TanArcExpo(keyID) ))*BackTanFin(keyID);
function TanTransition(t, keyID) = pow(t/stepsize,TanArcExpo(keyID) )*TransitionAngleInit(keyID) + (1-pow(t/stepsize, TanArcExpo(keyID) ))*TransitionAngleFin(keyID);
///----- KEY Builder Module
module keycap(keyID = 0, cutLen = 0, visualizeDish = false, crossSection = false, Dish = true, SecondaryDish = false, Stem = false, homeDot = false, Stab = 0, Legends = false) {
module keycap(keyID = 0, cutLen = 0, visualizeDish = false, crossSection = false, Dish = true, SecondaryDish = false, Stem = false, StemRot = 0, homeDot = false, Stab = 0, Legends = false) {
//Set Parameters for dish shape
FrontPath = quantize_trajectories(FrontTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
@ -286,9 +332,12 @@ module keycap(keyID = 0, cutLen = 0, visualizeDish = false, crossSection = false
//Scaling initial and final dim tranformation by exponents
function FrontDishArc(t) = pow((t)/(len(FrontPath)),FrontArcExpo(keyID))*FrontFinArc(keyID) + (1-pow(t/(len(FrontPath)),FrontArcExpo(keyID)))*FrontInitArc(keyID);
function BackDishArc(t) = pow((t)/(len(FrontPath)),BackArcExpo(keyID))*BackFinArc(keyID) + (1-pow(t/(len(FrontPath)),BackArcExpo(keyID)))*BackInitArc(keyID);
FrontCurve = [ for(i=[0:len(FrontPath)-1]) transform(FrontPath[i], DishShape(DishDepth(keyID), FrontDishArc(i), 1, d = 0)) ];
BackCurve = [ for(i=[0:len(BackPath)-1]) transform(BackPath[i], DishShape(DishDepth(keyID), BackDishArc(i), 1, d = 0)) ];
FrontCurve = [ for(i=[0:len(FrontPath)-1]) transform(FrontPath[i], DishShape2( a= DishDepth(keyID), b= FrontDishArc(i), phi = TransitionAngleInit(keyID) , theta= 60
, r = FTanRadius(i, keyID))) ];
BackCurve = [ for(i=[0:len(BackPath)-1]) transform(BackPath[i], DishShape2(DishDepth(keyID), BackDishArc(i), phi = TransitionAngleInit(keyID), theta= 60
, r = BTanRadius(i, keyID))) ];
// for(i=[0:len(FrontPath)-1])echo ( len(transform(FrontPath[i], DishShape2( a= DishDepth(keyID), b= FrontDishArc(i), phi = TransitionAngleInit(keyID), theta= 60
// , r = FTanRadius(i, keyID)))), TanTransition(i, keyID));
//Secondary Dish
SFrontPath = quantize_trajectories(SFrontTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
@ -299,6 +348,7 @@ module keycap(keyID = 0, cutLen = 0, visualizeDish = false, crossSection = false
SFrontCurve = [ for(i=[0:len(SFrontPath)-1]) transform(SFrontPath[i], DishShape(SDishDepth(keyID), SFrontDishArc(i), 1, d = 0)) ];
SBackCurve = [ for(i=[0:len(SBackPath)-1]) transform(SBackPath[i], DishShape(SDishDepth(keyID), SBackDishArc(i), 1, d = 0)) ];
//builds
difference(){
union(){
@ -311,16 +361,21 @@ module keycap(keyID = 0, cutLen = 0, visualizeDish = false, crossSection = false
}
}
if(Stem == true){
rotate([0,0,stemRot])choc_stem(draftAng = draftAngle); // generate mx cherry stem, not compatible with box
if (Stab != 0){
translate([Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
translate([-Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
}
translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), rounded_rectangle_profile(StemTransform(i, keyID),fn=fn,r=StemRadius(i, keyID)))]); //outer shell
rotate([0,0,StemRot]){
choc_stem(draftAng = draftAngle);
if (Stab != 0){
translate([Stab/2,0,0])rotate([0,0,StemRot])cherry_stem(KeyHeight(keyID), slop);
translate([-Stab/2,0,0])rotate([0,0,StemRot])cherry_stem(KeyHeight(keyID), slop);
}
translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID)), rounded_rectangle_profile(StemTransform(i, keyID),fn=fn,r=1 /*StemRadius(i, keyID) */ ))]); //outer shell
}
}
}
//cut for fonts and extra pattern for light?
if(visualizeDish == true && Dish == true){
#translate([-TopWidShift(keyID),.0001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
#translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(BackCurve);
}
}
//Cuts
@ -336,15 +391,12 @@ module keycap(keyID = 0, cutLen = 0, visualizeDish = false, crossSection = false
}
//Dish Shape
if(Dish == true){
if(visualizeDish == false){
translate([-TopWidShift(keyID),.0001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
} else {
#translate([-TopWidShift(keyID),.0001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)]) rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
#translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
}
translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(BackCurve);
if(SecondaryDish == true){
translate([BottomWidth(keyID)/2,-BottomLength(keyID)/2,KeyHeight(keyID)-SDishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(SBackCurve);
#translate([BottomWidth(keyID)/2,-BottomLength(keyID)/2,KeyHeight(keyID)-SDishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(SBackCurve);
mirror([1,0,0])translate([BottomWidth(keyID)/2,-BottomLength(keyID)/2,KeyHeight(keyID)-SDishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(SBackCurve);
// translate([BottomWidth(keyID)/2,-BottomLength(keyID)/2,KeyHeight(keyID)-SDishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(SFrontCurve);
//
@ -407,23 +459,28 @@ module cherry_stem(depth, slop) {
}
module choc_stem(draftAng = 2) {
stemHeinght = 3.1;
module choc_stem(draftAng = 5) {
stemHeight = 3.1;
dia = .15;
wids = 1.2/2;
lens = 2.9/2;
module Stem() {
difference(){
hull(){
translate([0,0,-stemHeinght/2])cube([1.25-sin(draftAng)*stemHeinght,3-sin(draftAng)*stemHeinght,.001], center= true);
translate([0,0,stemHeinght/2])cube([1.25,3,.001], center= true);
translate([0,0,-stemHeight/2])linear_extrude(height = stemHeight)hull(){
translate([wids-dia,-3/2])circle(d=dia);
translate([-wids+dia,-3/2])circle(d=dia);
translate([wids-dia, 3/2])circle(d=dia);
translate([-wids+dia, 3/2])circle(d=dia);
}
//cuts
translate([3.9,0])cylinder(d1=7+sin(draftAng)*stemHeinght, d2=7,3.5, center = true);
translate([-3.9,0])cylinder(d1=7+sin(draftAng)*stemHeinght,d2=7,3.5, center = true);
//cuts
translate([3.9,0])cylinder(d1=7+sin(draftAng)*stemHeight, d2=7,3.5, center = true, $fn = 64);
translate([-3.9,0])cylinder(d1=7+sin(draftAng)*stemHeight,d2=7,3.5, center = true, $fn = 64);
}
}
translate([5.7/2,0,-stemHeinght/2+2])Stem();
translate([-5.7/2,0,-stemHeinght/2+2])Stem();
translate([5.7/2,0,-stemHeight/2+2])Stem();
translate([-5.7/2,0,-stemHeight/2+2])Stem();
}
/// ----- helper functions
@ -470,3 +527,55 @@ function sign_y(i,n) =
i > 0 && i < n/2 ? 1 :
i > n/2 ? -1 :
0;
lp_key = [
// "base_sx", 18.5,
// "base_sy", 18.5,
"base_sx", 17.65,
"base_sy", 16.5,
"cavity_sx", 16.1,
"cavity_sy", 14.9,
"cavity_sz", 1.6,
"cavity_ch_xy", 1.6,
"indent_inset", 1.5
];
/*Tester */
//translate([0,0,0])lp_master_base(xu = 2, yu = 1 );
// lp_production_base();
// for(i = [0:2]){
// for(j = [0:1]){
// translate([(1-i)*21, (.5-j)*21,0]){
// translate([0, 0, -.05])rotate([0,0,0])mirror([0,j,0])keycap(keyID = 2, cutLen = 0, Stem =false, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
// }
// }
// }
//
// lp_production_base15();
// for(i = [0:1]){
// for(j = [0:1]){
// translate([(.75-i*1.5)*21, (.5-j)*21,0]){
// translate([0, 0, -.05])rotate([0,0,90])mirror([j,0,0])keycap(keyID = 3, cutLen = 0, Stem =false, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
// }
// }
// }
//translate([-19, 3.5, -.05])rotate([0,0,10])mirror([0,0,0])keycap(keyID = 3, cutLen = 0, Stem =false, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([0, -17, 0])rotate([0,0,0])mirror([0,0,0])keycap(keyID = 0, cutLen = 0, Stem =false, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([0, 34, 0])rotate([0,0,0])mirror([0,1,0])keycap(keyID = 7, cutLen = 0, Stem =true, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([0, -17, 0])rotate([0,0,0])mirror([0,0,0])keycap(keyID = 0, cutLen = 0, Stem =true, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([-3, 0, 0])rotate([0,0,0])mirror([0,0,0])keycap(keyID = 2, cutLen = 7, Stem =true, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([3, 0, 0])rotate([0,0,0])mirror([0,0,0])keycap(keyID = 3, cutLen = -7, Stem =true, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([0, 18, 0])rotate([0,0,0])mirror([0,0,0])keycap(keyID = 4, cutLen = 0, Stem =true, Dish = true, SecondaryDish = false ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
// translate([0,-17.5, 0])rotate([0,0,0])mirror([0,1,0])keycap(keyID = 1, cutLen = -ChocCut, Stem =true, Dish = true, SecondaryDish = true ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//
// translate([18,-17.5, 0])rotate([0,0,180])mirror([0,0,0])keycap(keyID = 1, cutLen = -ChocCut, Stem =true, Dish = true, SecondaryDish = true ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
// translate([18, 0, 0])rotate([0,0,180])mirror([0,1,0])keycap(keyID = 1, cutLen = -ChocCut, Stem =true, Dish = true, SecondaryDish = true ,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = true, Legends = false);
//
//#translate([0,17,0])cube([14.5, 13.5, 4], center = true); // internal check
//#translate([0,0,5])cube([19.05, 19.05, 10], center = true); // internal check
//#translate([0,0,0])cube([17.5, 16.5, 10], center = true); // internal check

View file

@ -1,531 +0,0 @@
use <scad-utils/morphology.scad> //for cheaper minwoski
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <scad-utils/trajectory.scad>
use <scad-utils/trajectory_path.scad>
use <sweep.scad>
use <skin.scad>
use <z-butt.scad>
//DES (Distorted Elliptical Saddle) Choc Chord version Chicago Stenographer with sculpted gergo thumb cluter
//TODO: fine tune levee as the dish is not replicated compared to chicago
/*Tester */
//difference(){
//// #lp_stem_cavity(yu = 2);
// #translate([0,-0,-0])cube([16.5,36.5,20], center = true);
//}
difference(){
translate([0,0,-0])keycap(keyID = 5, cutLen = -ChocCut, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
}
// #lp_master_base();
// for(j= [0:5])
// for(i = [0:3])
// translate([19*j,19*i,0])keycap(keyID = 3, cutLen = -ChocCut, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//for (i = [15:18])
////difference(){
//
//,
//for (i = [19:22])
// translate([19*1.25,19*(i-19),0])keycap(keyID = i, cutLen = -ChocCut, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([0,16, 0])keycap(keyID = 14, cutLen = -ChocCut, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//
//translate([17,0, 0])mirror([1,0,0])keycap(keyID = 13, cutLen = -ChocCut, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//
//translate([17,16, 0])mirror([1,0,0])keycap(keyID = 14, cutLen = -ChocCut, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//Levee Additional Dist
//Test Mods
//translate([0,20, 0])keycap(keyID = 2, cutLen = -ChocCut, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([0,40, 0])rotate([0,0,180])keycap(keyID = 1, cutLen = -ChocCut, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([0,0, 0])rotate([0,0,0])keycap(keyID = 1, cutLen = -ChocCut, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([20,19, 0])keycap(keyID = 12, cutLen = -ChocCut, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([20,38, 0])rotate([0,0,180])keycap(keyID = 11, cutLen = -ChocCut, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([20,0, 0])rotate([0,0,0])keycap(keyID = 11, cutLen = -ChocCut, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([24,0, 0])keycap(keyID = 8, cutLen = -ChocCut, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//
//translate([24,20, 0])keycap(keyID = 9, cutLen = -ChocCut, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([24,40, 0])rotate([0,0,180])keycap(keyID = 8, cutLen = -ChocCut, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//
// translate([0,19, 0])keycap(keyID = 3, cutLen = 0, Stem =true, Dish = true, visualizeDish = true, crossSection = true, homeDot = false, Legends = false);
// translate([0,38, 0])mirror([0,1,0])keycap(keyID = 2, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = true, homeDot = false, Legends = false);
RowHome = [0,2.5,5,2.5,0,0];
//#translate([20,0,0])cube([14.5, 13.5, 10], center = true); // internal check
ChocCut = 0;
// Levee Test
// translate([19*0, 5, 0])rotate([-15,0,0])
// keycap(keyID = 9, cutLen = -ChocCut, Stem = thumbStem, Dish = thumbDish, visualizeDish = thumbVis, crossSection = thumbSec,Legends = false);
// translate([19*0, 19-5, 0])rotate([15,0,0])
// keycap(keyID = 10, cutLen = ChocCut, Stem = thumbStem, Dish = thumbDish, visualizeDish = thumbVis, crossSection = thumbSec,Legends = false);
// translate([-19+5, 19*.5, .5])rotate([15,0,90])
// keycap(keyID = 11, cutLen = ChocCut, Stem = thumbStem, Dish = thumbDish, visualizeDish = thumbVis, crossSection = thumbSec,Legends = false);
// translate([19*1, 19*1, 0])
// keycap(keyID = 12, cutLen = ChocCut, Stem = thumbStem, Dish = thumbDish, visualizeDish = thumbVis, crossSection = thumbSec,Legends = false);
//Test 1.5 mods
thumbStem = true;
thumbDish = true;
thumbVis = false;
thumbSec = false;
////// thumb
// translate([0,0,0])rotate([0,0,30])translate([-19,0,0])keycap(keyID = 4, cutLen = 0, Stem = thumbStem , Dish = thumbDish, visualizeDish = thumbVis, crossSection = thumbSec,Legends = false);
//
// translate([0,0,0])rotate([0,0,30])translate([-19,28,0])rotate([0,0,180])keycap(keyID = 16, cutLen = 0, Stem =thumbStem , Dish = thumbDish, visualizeDish = thumbVis, crossSection = thumbSec,Legends = false);
// translate([0,0,0])rotate([0,0,30])translate([0,0,0])keycap(keyID = 6, cutLen = 0, Stem =thumbStem , Dish = thumbDish, visualizeDish = thumbVis, crossSection = thumbSec,Legends = false);
// translate([0,0,0])rotate([0,0,30])translate([0,28,0])rotate([0,0,0])keycap(keyID = 5, cutLen = 0, Stem =thumbStem , Dish = thumbDish, visualizeDish = thumbVis, crossSection = thumbSec,Legends = false);
// translate([0,0,0])rotate([0,0,15])translate([25,1.5,0])rotate([0,0,180])keycap(keyID = 24, cutLen = 0, Stem =thumbStem , Dish = thumbDish, visualizeDish = thumbVis, crossSection = thumbSec,Legends = false);
// translate([0,0,0])rotate([0,0,0])translate([51,12,0])keycap(keyID = 20, cutLen = 0, Stem =thumbStem , Dish = thumbDish, visualizeDish = thumbVis, crossSection = thumbSec,Legends = false);
//-Parameters
wallthickness = 1.1; // 1.75 for mx size, 1.1
topthickness = 2.5; //2 for phat 3 for chicago
stepsize = 50; //resolution of Trajectory
step = 2; //resolution of ellipes
fn = 32; //resolution of Rounded Rectangles: 60 for output
layers = 30; //resolution of vertical Sweep: 50 for output
//---Stem param
slop = 0.3;
stemRot = 0;
stemWid = 8;
stemLen = 6;
stemCrossHeight = 1.8;
extra_vertical = 0.6;
stemLayers = 50; //resolution of stem to cap top transition
//#cube([18.16, 18.16, 10], center = true); // sanity check border
//injection param
draftAngle = 0; //degree note:Stem Only
//TODO: Add wall thickness transition?
keyParameters = //keyParameters[KeyID][ParameterID]
[
// BotWid, BotLen, TWDif, TLDif, keyh, WSft, LSft XSkew, YSkew, ZSkew, WEx, LEx, CapR0i, CapR0f, CapR1i, CapR1f, CapREx, StemEx
//Column 0
[17.26, 17.26, 4.5, 2, 4.5, 0, .0, 5, -0, -0, 2, 3, 1, 2, 1, 6, 2, 2], //Phat Fingers 0
[17.26, 17.26, 7, 4, 5.5, 0, .0, 5, -0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R2/R4
[17.26, 17.26, 7, 4, 4.5, 0, .0, 0, -0, -0, 2, 3, 1, 3, 1, 4, 2, 2], //Chicago Steno R3 flat
[17.26, 17.26, 7, 4, 4.5, 0, .0, 0, -0, -0, 2, 3, 1, 3, 1, 4, 2, 2], //Chicago Steno R3 deep
//Gergo Thumb Sculpted
[17.06, 35.96, 7, 3, 5.4, 0, 0, -3, -7, -0, 2, 2, 1, 2, 1, 4, 2, 2], //Chicago T0 R1 2u 3
[17.06, 17.06, 7, 4, 6.4, 0, .0, -6, 0, 0, 2, 2, 1, 2, 1, 4, 2, 2], //Chicago T0 R2 1u
[17.06, 35.96, 7, 3, 5.4, 0, 0, -3, 7, -0, 2, 2, 1, 3, 1, 4, 2, 2], //Chicago T1 R2 2u
[17.06*1.50,17.16, 7, 5, 6.2, 0, 0, -2, 4, 5, 2, 2, 1, 3, 1, 4, 2, 2], //Chicago T2 R1 1.25
[17.16*1.25,17.16, 7, 5, 6.8, 0, 0, -2, 3, -0, 2, 2, 1, 3, 1, 4, 2, 2], //Chicago T3 R1 1.25
//Gergo 1.5 mods
[17.06*1.5,17.26, 7, 4, 5.5, 0, .0, 5, 0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R2/R4 8
[17.06*1.5,17.26, 7, 4, 4.5, 0, .0, 0, -0, -0, 2, 3, 1, 3, 1, 4, 2, 2], //Chicago Steno R3flat
//Phat Fingers Uniform
[17.26, 17.26, 2, 2, 5, 0, .0, 0, -0, -0, 2, 3, 1, 3, 1, 3, 2, 2], //10
//Levee: Chicago in choc Dimension 11~14
[16.10, 15.10, 5, 4, 5.5, 0, .0, 5, -0, -0, 2, 3, .75, 1, .75, 4, 2, 2], //Chicago Steno R2/R4
[16.10, 15.10, 6, 4, 4.5, 0, .0, 0, -0, -0, 2, 3, .75, 1, .75, 4, 2, 2], //Chicago Steno R3 flat
[16.10, 15.10, 4.25, 3.25, 5.2, -.8, -0.6, 0, -4, -0, 2, 3, .10, 2, .10, 2, 2, 2], //Levee Corner R2
[16.10, 15.10, 4.25, 3.25, 5.2, -.8, 0.6, 0, -4, -0, 2, 3, .10, 2, .10, 2, 2, 2], //Levee Corner R3
//Chicago 4 rows system 15~18
[17.26, 17.26, 7, 4, 5.8, 0, .0, 7, -0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R1
[17.26, 17.26, 7, 4, 4.7, 0, .0, 3, -0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R2
[17.26, 17.26, 7, 4, 4.5, 0, .0, 0, -0, -0, 2, 3, 1, 3, 1, 4, 2, 2], //Chicago Steno R3 flat
[17.26, 17.26, 7, 4, 5.5, 0, .0, -5, -0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R4
[17.26, 17.26, 7, 4, 5.5, 0, .0, -5, -0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R5
//Chicago 4 rows system 1.25 19~22
[21.86, 17.26, 7, 4, 5.8, 0, .0, 7, -0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R1
[21.86, 17.26, 7, 4, 4.7, 0, .0, 3, -0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R2
[21.86, 17.26, 7, 4, 4.5, 0, .0, 0, -0, -0, 2, 3, 1, 3, 1, 4, 2, 2], //Chicago Steno R3 flat
[21.86, 17.26, 7, 4, 5.5, 0, .0, -5, -0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R4
[21.86, 17.26, 7, 4, 5.5, 0, .0, -5, -0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R5
//Chicago 4 rows system 1.5 23~26
[26.66, 17.26, 7, 4, 5.8, 0, .0, 7, -0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R1
[26.66, 17.26, 7, 4, 4.7, 0, .0, 3, -0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R2
[26.66, 17.26, 7, 4, 4.5, 0, .0, .1, -0, -0, 2, 3, 1, 3, 1, 4, 2, 2], //Chicago Steno R3 flat
[26.66, 17.26, 7, 4, 5.5, 0, .0, -5, -0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R4
[26.66, 17.26, 7, 4, 5.5, 0, .0, -5, -0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R5
//Chicago 4 rows system 2.0 27~31
[35.96, 17.26, 7, 4, 5.8, 0, .0, 7, -0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R1
[35.96, 17.26, 7, 4, 4.7, 0, .0, 3, -0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R2
[35.96, 17.26, 7, 4, 4.5, 0, .0, .1, -0, -0, 2, 3, 1, 3, 1, 4, 2, 2], //Chicago Steno R3 flat
[35.96, 17.26, 7, 4, 5.5, 0, .0, -5, -0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R4
[35.96, 17.26, 7, 4, 5.5, 0, .0, -5, -0, -0, 2, 3, 1, 1, 1, 4, 2, 2], //Chicago Steno R5
];
dishParameters = //dishParameter[keyID][ParameterID]
[
//FFwd1 FFwd2 FPit1 FPit2 DshDep DshHDif FArcIn FArcFn FArcEx BFwd1 BFwd2 BPit1 BPit2 BArcIn BArcFn BArcEx
//Column 0
[ 6, 4, 7, -50, 5, 1.0, 15, 25, 2, 6, 4, 2, -35, 15, 19, 2], //Phat Fingers
[ 6, 4, 7, -50, 8, 1.8, 11, 17, 2, 6, 4, 2, -35, 11, 15, 2], //Chicago Steno R2/R4
[ 6, 4, 5, -40, 8, 1.8, 11, 15, 2, 6, 4, 5, -40, 11, 15, 2], //Chicago Steno R3 flat
[ 5.5, 4, 10, -40, 8, 1.8, 11, 15, 2, 5.5, 4, 10, -40, 11, 15, 2], //Chicago Steno R3 deep
[14.3, 4.5, 3, -40, 8, 1.8, 12, 17, 2, 14.3, 4, 2, -35, 12, 15, 2], //Chicago T0 R1 2u
[ 6, 4, 7, -50, 8, 1.8, 12, 17, 2, 6, 4, 2, -35, 12, 15, 2], //Chicago T0 R2 1u
[14.3, 4.5, 3, -40, 8, 1.8, 12, 17, 2, 14.3, 4, 2, -35, 12, 15, 2], //Chicago T1 R2 2u
[ 6, 4, 2, -35, 8, 1.8, 20, 24, 2, 6, 4, 7, -45, 20, 23, 2], //Chicago T2 R1 1.25
[ 6, 4, 2, -35, 8, 1.8, 15, 17, 2, 6, 4, 7, -45, 15, 15, 2], //Chicago T3 R1 1.25
//Gergo 1.5 mods
[ 6, 4, 7, -50, 8, 1.8, 22, 25, 2, 6, 4, 2, -35, 22, 25, 2], //Chicago Steno mod R2/R4
[ 6, 4, 5, -40, 8, 1.8, 22, 25, 2, 6, 4, 5, -40, 22, 25, 2], //Chicago Steno mod R3 flat
//Phat Fingers Uniform
[ 6, 3.5, 7, -50, 5, 1.0, 16, 23, 2, 6, 3.5, 7, -50, 16, 23, 2], //Phat Uniform
//Levee: Chicago in choc Dimension
[ 4.5, 4, 7, -50, 8, 1.8, 11, 17, 2, 4.5, 4, 2, -35, 11, 15, 2], //Chicago Steno R2/R4
[ 4.5, 4, 5, -40, 8, 1.8, 11, 15, 2, 4.5, 4, 5, -40, 11, 15, 2], //Chicago Steno R3 flat
[ 6, 3.5, 7, -50, 5, 1.0, 16, 23, 2, 6, 3.5, 7, -50, 16, 23, 2], //Levee Steno R2/R4
[ 6, 3.5, 7, -50, 5, 1.0, 16, 23, 2, 6, 3.5, 7, -50, 16, 23, 2], //Levee Steno R3/R3
//Chicago 4 rows system
[ 6, 4, 7, -50, 8, 1.8, 11, 17, 2, 6, 4, 2, -35, 11, 15, 2], //Chicago Steno R1
[ 6, 4, 7, -50, 8, 1.8, 11, 17, 2, 6, 4, 2, -35, 11, 15, 2], //Chicago Steno R2
[ 6, 4, 5, -40, 8, 1.8, 11, 15, 2, 6, 4, 5, -40, 11, 15, 2], //Chicago Steno R3 flat
[ 6, 4, 7, -50, 8, 1.8, 11, 17, 2, 6, 4, 2, -35, 11, 15, 2], //Chicago Steno R2/R4
//Chicago 4 rows system 1.25
[ 6, 4, 7, -50, 8, 1.8, 16, 25, 2, 6, 4, 2, -35, 16, 22, 2], //Chicago Steno R1
[ 6, 4, 7, -50, 8, 1.8, 16, 25, 2, 6, 4, 2, -35, 16, 22, 2], //Chicago Steno R2
[ 6, 4, 5, -40, 8, 1.8, 16, 25, 2, 6, 4, 5, -40, 16, 22, 2], //Chicago Steno R3 flat
[ 6, 4, 7, -50, 8, 1.8, 16, 25, 2, 6, 4, 2, -35, 16, 22, 2], //Chicago Steno R2/R4
//Chicago 4 rows system 1.5
[ 6, 4, 7, -50, 8, 1.8, 22, 25, 2, 6, 4, 2, -35, 22, 25, 2], //Chicago Steno R1
[ 6, 4, 7, -50, 8, 1.8, 22, 25, 2, 6, 4, 2, -35, 22, 25, 2], //Chicago Steno R2
[ 6, 4, 5, -40, 8, 1.8, 22, 25, 2, 6, 4, 5, -40, 22, 25, 2], //Chicago Steno R3 flat
[ 6, 4, 7, -50, 8, 1.8, 22, 25, 2, 6, 4, 2, -35, 22, 25, 2], //Chicago Steno R2/R4
//Chicago 4 rows system 2.0
[ 6, 4, 7, -50, 8, 1.8, 22, 25, 2, 6, 4, 2, -35, 22, 25, 2], //Chicago Steno R1
[ 6, 4, 7, -50, 8, 1.8, 22, 25, 2, 6, 4, 2, -35, 22, 25, 2], //Chicago Steno R2
[ 6, 4, 5, -40, 8, 1.8, 22, 25, 2, 6, 4, 5, -40, 22, 25, 2], //Chicago Steno R3 flat
[ 6, 4, 7, -50, 8, 1.8, 22, 25, 2, 6, 4, 2, -35, 22, 25, 2], //Chicago Steno R2/R4
];
function BottomWidth(keyID) = keyParameters[keyID][0]; //
function BottomLength(keyID) = keyParameters[keyID][1]; //
function TopWidthDiff(keyID) = keyParameters[keyID][2]; //
function TopLenDiff(keyID) = keyParameters[keyID][3]; //
function KeyHeight(keyID) = keyParameters[keyID][4]; //
function TopWidShift(keyID) = keyParameters[keyID][5];
function TopLenShift(keyID) = keyParameters[keyID][6];
function XAngleSkew(keyID) = keyParameters[keyID][7];
function YAngleSkew(keyID) = keyParameters[keyID][8];
function ZAngleSkew(keyID) = keyParameters[keyID][9];
function WidExponent(keyID) = keyParameters[keyID][10];
function LenExponent(keyID) = keyParameters[keyID][11];
function CapRound0i(keyID) = keyParameters[keyID][12];
function CapRound0f(keyID) = keyParameters[keyID][13];
function CapRound1i(keyID) = keyParameters[keyID][14];
function CapRound1f(keyID) = keyParameters[keyID][15];
function ChamExponent(keyID) = keyParameters[keyID][16];
function StemExponent(keyID) = keyParameters[keyID][17];
function FrontForward1(keyID) = dishParameters[keyID][0]; //
function FrontForward2(keyID) = dishParameters[keyID][1]; //
function FrontPitch1(keyID) = dishParameters[keyID][2]; //
function FrontPitch2(keyID) = dishParameters[keyID][3]; //
function DishDepth(keyID) = dishParameters[keyID][4]; //
function DishHeightDif(keyID) = dishParameters[keyID][5]; //
function FrontInitArc(keyID) = dishParameters[keyID][6];
function FrontFinArc(keyID) = dishParameters[keyID][7];
function FrontArcExpo(keyID) = dishParameters[keyID][8];
function BackForward1(keyID) = dishParameters[keyID][9]; //
function BackForward2(keyID) = dishParameters[keyID][10]; //
function BackPitch1(keyID) = dishParameters[keyID][11]; //
function BackPitch2(keyID) = dishParameters[keyID][12]; //
function BackInitArc(keyID) = dishParameters[keyID][13];
function BackFinArc(keyID) = dishParameters[keyID][14];
function BackArcExpo(keyID) = dishParameters[keyID][15];
function FrontTrajectory(keyID) =
[
trajectory(forward = FrontForward1(keyID), pitch = FrontPitch1(keyID)), //more param available: yaw, roll, scale
trajectory(forward = FrontForward2(keyID), pitch = FrontPitch2(keyID)) //You can add more traj if you wish
];
function BackTrajectory (keyID) =
[
trajectory(forward = BackForward1(keyID), pitch = BackPitch1(keyID)),
trajectory(forward = BackForward2(keyID), pitch = BackPitch2(keyID)),
];
//------- function defining Dish Shapes
function ellipse(a, b, d = 0, rot1 = 0, rot2 = 360) = [for (t = [rot1:step:rot2]) [a*cos(t)+a, b*sin(t)*(1+d*cos(t))]]; //Centered at a apex to avoid inverted face
function DishShape (a,b,c,d) =
concat(
// [[c+a,b]],
ellipse(a, b, d = 0,rot1 = 90, rot2 = 270)
// [[c+a,-b]]
);
function oval_path(theta, phi, a, b, c, deform = 0) = [
a*cos(theta)*cos(phi), //x
c*sin(theta)*(1+deform*cos(theta)) , //
b*sin(phi),
];
path_trans2 = [for (t=[0:step:180]) translation(oval_path(t,0,10,15,2,0))*rotation([0,90,0])];
//--------------Function definng Cap
function CapTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*KeyHeight(keyID)) //Z shift
];
function InnerTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*(KeyHeight(keyID)-topthickness)) //Z shift
];
function CapRotation(t, keyID) =
[
((1-t)/layers*XAngleSkew(keyID)), //X shift
((1-t)/layers*YAngleSkew(keyID)), //Y shift
((1-t)/layers*ZAngleSkew(keyID)) //Z shift
];
function CapTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)) + (1-pow(t/layers, WidExponent(keyID)))*BottomWidth(keyID) ,
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)) + (1-pow(t/layers, LenExponent(keyID)))*BottomLength(keyID)
];
function CapRoundness(t, keyID) =
[
pow(t/layers, ChamExponent(keyID))*(CapRound0f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound0i(keyID),
pow(t/layers, ChamExponent(keyID))*(CapRound1f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound1i(keyID)
];
function CapRadius(t, keyID) = pow(t/layers, ChamExponent(keyID))*ChamfFinRad(keyID) + (1-pow(t/layers, ChamExponent(keyID)))*ChamfInitRad(keyID);
function InnerTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, WidExponent(keyID)))*(BottomWidth(keyID) -wallthickness*2),
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, LenExponent(keyID)))*(BottomLength(keyID)-wallthickness*2)
];
function StemTranslation(t, keyID) =
[
((1-t)/stemLayers*TopWidShift(keyID)), //X shift
((1-t)/stemLayers*TopLenShift(keyID)), //Y shift
stemCrossHeight+.1 + (t/stemLayers*(KeyHeight(keyID)- topthickness - stemCrossHeight-.1)) //Z shift
];
function StemRotation(t, keyID) =
[
// ((1-t)/stemLayers*XAngleSkew(keyID)), //X shift
// ((1-t)/stemLayers*YAngleSkew(keyID)), //Y shift
// ((1-t)/stemLayers*ZAngleSkew(keyID)) //Z shift
0,0,0
];
function StemTransform(t, keyID) =
[
pow(t/stemLayers, StemExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemWid - 2*slop),
pow(t/stemLayers, StemExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemLen - 2*slop)
];
function StemRadius(t, keyID) = pow(t/stemLayers,3)*3 + (1-pow(t/stemLayers, 3))*1;
//Stem Exponent
///----- KEY Builder Module
module keycap(keyID = 0, cutLen = 0, visualizeDish = false, crossSection = false, Dish = true, Stem = false, homeDot = false, Stab = 0, Legends = false) {
//Set Parameters for dish shape
FrontPath = quantize_trajectories(FrontTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
BackPath = quantize_trajectories(BackTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
//Scaling initial and final dim tranformation by exponents
function FrontDishArc(t) = pow((t)/(len(FrontPath)),FrontArcExpo(keyID))*FrontFinArc(keyID) + (1-pow(t/(len(FrontPath)),FrontArcExpo(keyID)))*FrontInitArc(keyID);
function BackDishArc(t) = pow((t)/(len(FrontPath)),BackArcExpo(keyID))*BackFinArc(keyID) + (1-pow(t/(len(FrontPath)),BackArcExpo(keyID)))*BackInitArc(keyID);
FrontCurve = [ for(i=[0:len(FrontPath)-1]) transform(FrontPath[i], DishShape(DishDepth(keyID), FrontDishArc(i), 1, d = 0)) ];
BackCurve = [ for(i=[0:len(BackPath)-1]) transform(BackPath[i], DishShape(DishDepth(keyID), BackDishArc(i), 1, d = 0)) ];
//builds
difference(){
union(){
difference(){
skin([for (i=[0:layers-1]) transform(translation(CapTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(CapTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]); //outer shell
//Cut inner shell
if(Stem == true){
translate([0,0,-.001])skin([for (i=[0:layers-1]) transform(translation(InnerTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(InnerTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]);
}
}
if(Stem == true){
rotate([0,0,stemRot])choc_stem(draftAng = draftAngle); // generate mx cherry stem, not compatible with box
if (Stab != 0){
translate([Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
translate([-Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
}
translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), rounded_rectangle_profile(StemTransform(i, keyID),fn=fn,r=StemRadius(i, keyID)))]); //outer shell
}
//cut for fonts and extra pattern for light?
}
//Cuts
//Fonts
if(cutLen != 0){
translate([0,sign(cutLen)*(BottomLength(keyID)+CapRound0i(keyID)+abs(cutLen))/2,0])
cube([BottomWidth(keyID)+CapRound1i(keyID)+1,BottomLength(keyID)+CapRound0i(keyID),50], center = true);
}
if(Legends == true){
#rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([-1,-5,KeyHeight(keyID)-2.5])linear_extrude(height = 1)text( text = "ver2", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
// #rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([0,-3.5,0])linear_extrude(height = 0.5)text( text = "Me", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
}
//Dish Shape
if(Dish == true){
if(visualizeDish == false){
translate([-TopWidShift(keyID),.0001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
} else {
#translate([-TopWidShift(keyID),.0001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)]) rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
#translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
}
}
if(crossSection == true) {
translate([0,-25,-.1])cube([15,50,15]);
}
//Homing dot
if(homeDot == true)translate([0,0,KeyHeight(keyID)-DishHeightDif(keyID)-.25])sphere(d = 1);
}
}
//------------------stems
$fn = fn;
function outer_cherry_stem(slop) = [ stemWid - slop * 2, stemLen - slop * 2];
function outer_cherry_stabilizer_stem(slop) = [4.85 - slop * 2, 6.05 - slop * 2];
function outer_box_cherry_stem(slop) = [6 - slop, 6 - slop];
// .005 purely for aesthetics, to get rid of that ugly crosshatch
function stem_cross(slop, extra_vertical = 0) = [
// horizontal tine
[4.0 + slop, 1.0 + slop / 3],
// vertical tine
[1.00 + slop / 3, 4.0 + extra_vertical + slop / 3 + .005],
];
module inside_cherry_cross(slop) {
// inside cross
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-0.005]) {
linear_extrude(height = stemCrossHeight) {
square(cherry_cross(slop, extra_vertical)[0], center=true);
square(cherry_cross(slop, extra_vertical)[1], center=true);
}
}
// Guides to assist insertion and mitigate first layer squishing
{
for (i = cherry_cross(slop, extra_vertical)) hull() {
linear_extrude(height = 0.01, center = false) offset(delta = 0.4) square(i, center=true);
translate([0, 0, 0.5]) linear_extrude(height = 0.01, center = false) square(i, center=true);
}
}
}
module cherry_stem(depth, slop) {
difference(){
// outside shape
linear_extrude(height = depth) {
offset(r=1){
square(outer_cherry_stem(slop) - [2,2], center=true);
}
}
inside_cherry_cross(slop);
}
}
module choc_stem(draftAng = 2) {
stemHeinght = 3.4;
module Stem() {
difference(){
hull(){
translate([0,0,-stemHeinght/2])cube([1.25-sin(draftAng)*stemHeinght,3-sin(draftAng)*stemHeinght,.001], center= true);
translate([0,0,stemHeinght/2])cube([1.25,3,.001], center= true);
}
//cuts
translate([3.9,0])cylinder(d1=7+sin(draftAng)*stemHeinght, d2=7,3.5, center = true);
translate([-3.9,0])cylinder(d1=7+sin(draftAng)*stemHeinght,d2=7,3.5, center = true);
}
}
translate([5.7/2,0,-3.4/2+2])Stem();
translate([-5.7/2,0,-3.4/2+2])Stem();
}
/// ----- helper functions
function rounded_rectangle_profile(size=[1,1],r=1,fn=32) = [
for (index = [0:fn-1])
let(a = index/fn*360)
r * [cos(a), sin(a)]
+ sign_x(index, fn) * [size[0]/2-r,0]
+ sign_y(index, fn) * [0,size[1]/2-r]
];
function elliptical_rectangle(a = [1,1], b =[1,1], fn=32) = [
for (index = [0:fn-1]) // section right
let(theta1 = -atan(a[1]/b[1])+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta1), a[1]*sin(theta1)]
+ [a[0]*cos(atan(b[0]/a[0])) , 0]
- [b[1]*cos(atan(a[1]/b[1])) , 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
- [0, b[0]*sin(atan(b[0]/a[0]))]
+ [0, a[1]*sin(atan(a[1]/b[1]))],
for(index = [0:fn-1]) // section left
let(theta2 = -atan(a[1]/b[1])+180+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta2), a[1]*sin(theta2)]
- [a[0]*cos(atan(b[0]/a[0])) , 0]
+ [b[1]*cos(atan(a[1]/b[1])) , 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + 180 + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
+ [0, b[0]*sin(atan(b[0]/a[0]))]
- [0, a[1]*sin(atan(a[1]/b[1]))]
]/2;
function sign_x(i,n) =
i < n/4 || i > n-n/4 ? 1 :
i > n/4 && i < n-n/4 ? -1 :
0;
function sign_y(i,n) =
i > 0 && i < n/2 ? 1 :
i > n/2 ? -1 :
0;

View file

@ -1,396 +0,0 @@
use <scad-utils/morphology.scad> //for cheaper minwoski
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <scad-utils/trajectory.scad>
use <scad-utils/trajectory_path.scad>
use <sweep.scad>
use <skin.scad>
/*DES (Distorted Elliptical Saddle) Sculpted Profile for 6x3 and corne thumb
Version 2: Eliptical Rectangle
*/
//#square([18.16, 18.16], center = true);
U = 18.05;
H = 10;
//mirror([1,0,0])keycap(keyID = 2, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
translate([0,-.08*U, 6.5])rotate([-30,0,0])translate([0,0,H])keycap(keyID = 0, cutLen = 7, Stem = false, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
translate([0, .8*U, 0])rotate([-15,0,0])translate([0,0,H])keycap(keyID = 1, cutLen = 7, Stem = false, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
translate([0,1.95*U, 0])rotate([ 15,0,0])translate([0,0,H])keycap(keyID = 2, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
translate([0,2.93*U,10.5])rotate([ 45,0,0])translate([0,0,H])keycap(keyID = 3, cutLen =-7, Stem = true, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
translate([U,1.95*U, 0])rotate([ 15,0,0])translate([0,0,H])keycap(keyID = 4, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
//normie hipro
// for(Row = [0:4]){
// translate([0, 19*Row, 0])keycap(keyID = 29+Row, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
// }
//#translate([0,38,13])cube([18-5.7, 18-5.7,1],center = true);
//Parameters
wallthickness = 2;
topthickness = 3; //
stepsize = 50; //resolution of Trajectory
step = 6; //resolution of ellipes
fn = 16; //resolution of Rounded Rectangles: 60 for output
layers = 40; //resolution of vertical Sweep: 50 for output
dotRadius = 1.25; //home dot size
//---Stem param
slop = 0.25;
stemRot = 0;
stemWid = 7.2;
stemLen = 5.5;
stemCrossHeight = 4;
extra_vertical = 0.6;
StemBrimDep = 0.75;
stemLayers = 50; //resolution of stem to cap top transition
keyParameters = //keyParameters[KeyID][ParameterID]
[
// BotWid, BotLen, TWDif, TLDif, keyh, WSft, LSft XSkew, YSkew, ZSkew, WEx, LEx, CapR0i, CapR0f, CapR1i, CapR1f, CapREx, StemEx
//Column 0
//normie hipro
[17.16, 17.16, 6.5, 6.5, 11.0, 0, 0, 0, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[17.16, 17.16, 6.5, 6.5, 11.0, 0, 0, 0, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[17.16, 17.16, 6.5, 6.5, 11.0, 0, 0, 0, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 11.0, 0, 0, -10, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[17.16, 17.16, 6.5, 6.5, 11.0, 0, 0, 0, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home Deeper
//thumbs
[17.16, 17.16*1.5, 6, 7, 13, 0, 0, -13, 10, -5, 2, 2, 1, 4.85, 1, 3, 2, 2], //R5 0 Corne thumb
[17.16, 17.16, 4, 5, 14, 0, 0, -13, 5, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 4 corne thumb
[17.16, 17.16, 4, 6, 15, 0, 0, -13, 10, 15, 2, 2, 1, 5, 1, 2, 2, 2], //R5 8 corne thumb
];
dishParameters = //dishParameter[keyID][ParameterID]
[
//FFwd1 FFwd2 FPit1 FPit2 DshDep DshHDif FArcIn FArcFn FArcEx BFwd1 BFwd2 BPit1 BPit2 BArcIn BArcFn BArcEx
//Column 0
[ 5, 3.5, 18, -55, 5, 1.8, 8.8, 15, 2, 3, 4.4, -10, -55, 8.8, 15, 2], //R5
[ 5, 3.5, 18, -55, 5, 1.8, 8.8, 15, 2, 3, 4.4, -10, -55, 8.8, 15, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 8.8, 15, 2, 6, 3, 18, -55, 8.8, 15, 2], //R3
[ 3, 3, -10, -50, 5, 1.8, 8.8, 15, 2, 6, 4, 5, -55, 8.8, 16, 2], //R2
[ 6, 3, 18, -55, 5, 1.8, 8.8, 15, 2, 5, 3.5, 8, -55, 8.8, 15, 2], //R3 deep dish
//Thumb
[ 8, 4.5, 7, -39, 4, 1.8, 9.5, 15, 2, 10, 4, 8, -30, 9.5, 20, 2], //R5
[ 5, 4.3, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 13, -30, 10.5, 18, 2], //R5
[ 5, 4.3, 5, -48, 4, 1.9, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //R5
];
function FrontForward1(keyID) = dishParameters[keyID][0]; //
function FrontForward2(keyID) = dishParameters[keyID][1]; //
function FrontPitch1(keyID) = dishParameters[keyID][2]; //
function FrontPitch2(keyID) = dishParameters[keyID][3]; //
function DishDepth(keyID) = dishParameters[keyID][4]; //
function DishHeightDif(keyID) = dishParameters[keyID][5]; //
function FrontInitArc(keyID) = dishParameters[keyID][6];
function FrontFinArc(keyID) = dishParameters[keyID][7];
function FrontArcExpo(keyID) = dishParameters[keyID][8];
function BackForward1(keyID) = dishParameters[keyID][9]; //
function BackForward2(keyID) = dishParameters[keyID][10]; //
function BackPitch1(keyID) = dishParameters[keyID][11]; //
function BackPitch2(keyID) = dishParameters[keyID][12]; //
function BackInitArc(keyID) = dishParameters[keyID][13];
function BackFinArc(keyID) = dishParameters[keyID][14];
function BackArcExpo(keyID) = dishParameters[keyID][15];
function BottomWidth(keyID) = keyParameters[keyID][0]; //
function BottomLength(keyID) = keyParameters[keyID][1]; //
function TopWidthDiff(keyID) = keyParameters[keyID][2]; //
function TopLenDiff(keyID) = keyParameters[keyID][3]; //
function KeyHeight(keyID) = keyParameters[keyID][4]; //
function TopWidShift(keyID) = keyParameters[keyID][5];
function TopLenShift(keyID) = keyParameters[keyID][6];
function XAngleSkew(keyID) = keyParameters[keyID][7];
function YAngleSkew(keyID) = keyParameters[keyID][8];
function ZAngleSkew(keyID) = keyParameters[keyID][9];
function WidExponent(keyID) = keyParameters[keyID][10];
function LenExponent(keyID) = keyParameters[keyID][11];
function CapRound0i(keyID) = keyParameters[keyID][12];
function CapRound0f(keyID) = keyParameters[keyID][13];
function CapRound1i(keyID) = keyParameters[keyID][14];
function CapRound1f(keyID) = keyParameters[keyID][15];
function ChamExponent(keyID) = keyParameters[keyID][16];
function StemExponent(keyID) = keyParameters[keyID][17];
function FrontTrajectory(keyID) =
[
trajectory(forward = FrontForward1(keyID), pitch = FrontPitch1(keyID)), //more param available: yaw, roll, scale
trajectory(forward = FrontForward2(keyID), pitch = FrontPitch2(keyID)) //You can add more traj if you wish
];
function BackTrajectory (keyID) =
[
trajectory(forward = BackForward1(keyID), pitch = BackPitch1(keyID)),
trajectory(forward = BackForward2(keyID), pitch = BackPitch2(keyID)),
];
//------- function defining Dish Shapes
function ellipse(a, b, d = 0, rot1 = 0, rot2 = 360) = [for (t = [rot1:step:rot2]) [a*cos(t)+a, b*sin(t)*(1+d*cos(t))]]; //Centered at a apex to avoid inverted face
function DishShape (a,b,c,d) =
concat(
// [[c+a,b]],
ellipse(a, b, d = 0,rot1 = 90, rot2 = 270)
// [[c+a,-b]]
);
function oval_path(theta, phi, a, b, c, deform = 0) = [
a*cos(theta)*cos(phi), //x
c*sin(theta)*(1+deform*cos(theta)) , //
b*sin(phi),
];
path_trans2 = [for (t=[0:step:180]) translation(oval_path(t,0,10,15,2,0))*rotation([0,90,0])];
//--------------Function definng Cap
function CapTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*KeyHeight(keyID)) //Z shift
];
function InnerTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*(KeyHeight(keyID)-topthickness)) //Z shift
];
function CapRotation(t, keyID) =
[
((1-t)/layers*XAngleSkew(keyID)), //X shift
((1-t)/layers*YAngleSkew(keyID)), //Y shift
((1-t)/layers*ZAngleSkew(keyID)) //Z shift
];
function CapTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)) + (1-pow(t/layers, WidExponent(keyID)))*BottomWidth(keyID) ,
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)) + (1-pow(t/layers, LenExponent(keyID)))*BottomLength(keyID)
];
function CapRoundness(t, keyID) =
[
pow(t/layers, ChamExponent(keyID))*(CapRound0f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound0i(keyID),
pow(t/layers, ChamExponent(keyID))*(CapRound1f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound1i(keyID)
];
function CapRadius(t, keyID) = pow(t/layers, ChamExponent(keyID))*ChamfFinRad(keyID) + (1-pow(t/layers, ChamExponent(keyID)))*ChamfInitRad(keyID);
function InnerTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, WidExponent(keyID)))*(BottomWidth(keyID) -wallthickness*2),
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, LenExponent(keyID)))*(BottomLength(keyID)-wallthickness*2)
];
function StemTranslation(t, keyID) =
[
((1-t)/stemLayers*TopWidShift(keyID)), //X shift
((1-t)/stemLayers*TopLenShift(keyID)), //Y shift
stemCrossHeight+.1+StemBrimDep + (t/stemLayers*(KeyHeight(keyID)- topthickness - stemCrossHeight-.1 -StemBrimDep)) //Z shift
];
function StemRotation(t, keyID) =
[
((1-t)/stemLayers*XAngleSkew(keyID)), //X shift
((1-t)/stemLayers*YAngleSkew(keyID)), //Y shift
((1-t)/stemLayers*ZAngleSkew(keyID)) //Z shift
];
function StemTransform(t, keyID) =
[
pow(t/stemLayers, StemExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemWid - 2*slop),
pow(t/stemLayers, StemExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemLen - 2*slop)
];
function StemRadius(t, keyID) = pow(t/stemLayers,3)*3 + (1-pow(t/stemLayers, 3))*1;
//Stem Exponent
///----- KEY Builder Module
module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false, Dish = true, Stem = false, crossSection = true,Legends = false, homeDot = false, Stab = 0) {
//Set Parameters for dish shape
FrontPath = quantize_trajectories(FrontTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
BackPath = quantize_trajectories(BackTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
//Scaling initial and final dim tranformation by exponents
function FrontDishArc(t) = pow((t)/(len(FrontPath)),FrontArcExpo(keyID))*FrontFinArc(keyID) + (1-pow(t/(len(FrontPath)),FrontArcExpo(keyID)))*FrontInitArc(keyID);
function BackDishArc(t) = pow((t)/(len(FrontPath)),BackArcExpo(keyID))*BackFinArc(keyID) + (1-pow(t/(len(FrontPath)),BackArcExpo(keyID)))*BackInitArc(keyID);
FrontCurve = [ for(i=[0:len(FrontPath)-1]) transform(FrontPath[i], DishShape(DishDepth(keyID), FrontDishArc(i), 1, d = 0)) ];
BackCurve = [ for(i=[0:len(BackPath)-1]) transform(BackPath[i], DishShape(DishDepth(keyID), BackDishArc(i), 1, d = 0)) ];
//builds
difference(){
union(){
difference(){
skin([for (i=[0:layers-1]) transform(translation(CapTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(CapTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]); //outer shell
//Cut inner shell
if(Stem == true){
translate([0,0,-.001])skin([for (i=[0:layers-1]) transform(translation(InnerTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(InnerTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]);
}
}
if(Stem == true){
translate([0,0,StemBrimDep])cherry_stem(KeyHeight(keyID)-StemBrimDep, slop); // generate mx cherry stem, not compatible with box
if (Stab != 0){
translate([Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
translate([-Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
//TODO add binding support?
}
translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), rounded_rectangle_profile(StemTransform(i, keyID),fn=fn,r=StemRadius(i, keyID)))]); //Transition Support for taller profile
}
//cut for fonts and extra pattern for light?
}
//Cuts
if(cutLen != 0){
translate([0,sign(cutLen)*(BottomLength(keyID)+CapRound0i(keyID)+abs(cutLen))/2,0])
cube([BottomWidth(keyID)+CapRound1i(keyID)+1,BottomLength(keyID)+CapRound0i(keyID),50], center = true);
}
//Fonts
if(Legends == true){
#rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([-1,-5,KeyHeight(keyID)-2.5])linear_extrude(height = 1)text( text = "ver2", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
// #rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([0,-3.5,0])linear_extrude(height = 0.5)text( text = "Me", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
}
//Dish Shape
if(Dish == true){
if(visualizeDish == false){
translate([-TopWidShift(keyID),.00001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
} else {
#translate([-TopWidShift(keyID),.00001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)]) rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
#translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
}
}
if(crossSection == true) {
translate([0,-15,-.1])cube([15,30,15]);
}
}
//Homing dot
if(homeDot == true)translate([0,0,KeyHeight(keyID)-DishHeightDif(keyID)-.25])sphere(d = dotRadius);
}
//------------------stems
$fn = fn;
function outer_cherry_stem(slop) = [ stemWid - slop * 2, stemLen - slop * 2];
function outer_cherry_stabilizer_stem(slop) = [4.85 - slop * 2, 6.05 - slop * 2];
function outer_box_cherry_stem(slop) = [6 - slop, 6 - slop];
// .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],
];
module inside_cherry_cross(slop) {
// inside cross
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-0.005]) {
linear_extrude(height = stemCrossHeight) {
square(cherry_cross(slop, extra_vertical)[0], center=true);
square(cherry_cross(slop, extra_vertical)[1], center=true);
}
}
// Guides to assist insertion and mitigate first layer squishing
{
for (i = cherry_cross(slop, extra_vertical)) hull() {
linear_extrude(height = 0.01, center = false) offset(delta = 0.4) square(i, center=true);
translate([0, 0, 0.5]) linear_extrude(height = 0.01, center = false) square(i, center=true);
}
}
}
module cherry_stem(depth, slop) {
D1=.15;
D2=.05;
H1=3.5;
CrossDist = 1.75;
difference(){
// outside shape
linear_extrude(height = depth) {
offset(r=1){
square(outer_cherry_stem(slop) - [2,2], center=true);
}
}
rotate([0,0,stemRot])inside_cherry_cross(slop);
hull(){
translate([CrossDist,CrossDist-.1,0])cylinder(d1=D1, d2=D2, H1);
translate([-CrossDist,-CrossDist+.1,0])cylinder(d1=D1, d2=D2, H1);
}
hull(){
translate([-CrossDist,CrossDist-.1])cylinder(d1=D1, d2=D2, H1);
translate([CrossDist,-CrossDist+.1])cylinder(d1=D1, d2=D2, H1);
}
}
}
module choc_stem() {
translate([5.7/2,0,-3.4/2+2])difference(){
cube([1.25,3, 3.4], center= true);
translate([3.9,0,0])cylinder(d=7,3.4,center = true);
translate([-3.9,0,0])cylinder(d=7,3.4,center = true);
}
translate([-5.7/2,0,-3.4/2+2])difference(){
cube([1.25,3, 3.4], center= true);
translate([3.9,0,0])cylinder(d=7,3.4,center = true);
translate([-3.9,0,0])cylinder(d=7,3.4,center = true);
}
}
/// ----- helper functions
function rounded_rectangle_profile(size=[1,1],r=1,fn=32) = [
for (index = [0:fn-1])
let(a = index/fn*360)
r * [cos(a), sin(a)]
+ sign_x(index, fn) * [size[0]/2-r,0]
+ sign_y(index, fn) * [0,size[1]/2-r]
];
function elliptical_rectangle(a = [1,1], b =[1,1], fn=32) = [
for (index = [0:fn-1]) // section right
let(theta1 = -atan(a[1]/b[1])+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta1), a[1]*sin(theta1)]
+ [a[0]*cos(atan(b[0]/a[0])) , 0]
- [b[1]*cos(atan(a[1]/b[1])) , 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
- [0, b[0]*sin(atan(b[0]/a[0]))]
+ [0, a[1]*sin(atan(a[1]/b[1]))],
for(index = [0:fn-1]) // section left
let(theta2 = -atan(a[1]/b[1])+180+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta2), a[1]*sin(theta2)]
- [a[0]*cos(atan(b[0]/a[0])) , 0]
+ [b[1]*cos(atan(a[1]/b[1])) , 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + 180 + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
+ [0, b[0]*sin(atan(b[0]/a[0]))]
- [0, a[1]*sin(atan(a[1]/b[1]))]
]/2;
function sign_x(i,n) =
i < n/4 || i > n-n/4 ? 1 :
i > n/4 && i < n-n/4 ? -1 :
0;
function sign_y(i,n) =
i > 0 && i < n/2 ? 1 :
i > n/2 ? -1 :
0;

View file

@ -1,632 +0,0 @@
//use <scad-utils/morphology.scad> //for cheaper minwoski
use <scad-utils/transformations.scad>
use <scad-utils/lists.scad>
use <scad-utils/shapes.scad>
use <scad-utils/trajectory.scad>
use <scad-utils/trajectory_path.scad>
use <sweep.scad>
use <skin.scad>
use <z-butt.scad>
/*DES (Distorted Elliptical Saddle) Sculpted Profile for 6x3 and corne thumb
Version 2: Eliptical Rectangle
version 3: fine tune shapes
TODOs:
1. cylinderical stem and transform to top surface
2. modify inner cut to have two thickness parameters
3. fragile things? cuts from knobs
*/
//#square([18.16, 18.16], center = true);
//#difference(){
// translate([0,0,(KeyHeight(capID)+5)/2+.08])cube([30, 30, KeyHeight(capID)+5],center = true );
// translate([11,11,0])cylinder(d=4,20, center = true);
// translate(-[11,11,0])cylinder(d=4,20, center = true);
// translate([-11,11,0])cylinder(d=4,20, center = true);
//}
//#mirror([0,0,0])translate([0,0,1.95])keycap(keyID = capID, cutLen = 0, Stem =false, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//bottom cast param
capID = 1;
difference(){
mx_stem_cavity(name = "custom", xu=1, yu=1., sz = 10)translate([0,0,-.75])mirror([1,0,0])keycap(keyID = capID, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
// translate([0,-30,-25]) cube([60,60,50]); // cut check
}
//#translate([0,-0,-1]) keycap(keyID = capID, cutLen = 0, Stem =false, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//Parameters
wallthickness = 2;
topthickness = 3; //
stepsize = 30; //resolution of Trajectory
step = 6; //resolution of ellipes
fn = 16; //resolution of Rounded Rectangles: 60 for output
layers = 50; //resolution of vertical Sweep: 50 for output
dotRadius = 1.25; //home dot size
//---Stem param
slop = 0.3;
stemRot = 0;
stemWid = 7.2;
stemLen = 5.5;
stemCrossHeight = 4;
extra_vertical = 0.6;
StemBrimDep = 0.75;
stemLayers = 50; //resolution of stem to cap top transition
Dcyl = 5.5;
draftAngle = 1; //degree note:Stem Only
stemsupportLimit = 8.5;
keyParameters = //keyParameters[KeyID][ParameterID]
[
// BotWid, BotLen, TWDif, TLDif, keyh, WSft, LSft XSkew, YSkew, ZSkew, WEx, LEx, CapR0i, CapR0f, CapR1i, CapR1f, CapREx, StemEx
//corne thumb high pro
[17.16, 26.66, 6, 7, 13, 0, 0, -13, 10, -5, 2, 2, 1, 4.85, 1, 3, 2, 2], //R5 0 Corne thumb
[17.16, 17.16, 4, 5, 14, 0, 0, -13, 5, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 corne thumb
[17.16, 17.16, 4, 6, 15, 0, 0, -13, 10, 15, 2, 2, 1, 5, 1, 2, 2, 2], //R5 corne thumb
//Low profile corne thumb
[17.16, 26.66, 6, 7, 9.0, 0, 0, -8, 10, -5, 2, 2, 1, 4.85, 1, 3, 2, 2], //R5 3 Corne thumb
[17.16, 17.16, 4, 5, 10., 0, 0, -12, 5, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 corne thumb
[17.16, 17.16, 4, 6, 11, 0, 0, -12, 10, 15, 2, 2, 1, 5, 1, 2, 2, 2], //R5 corne thumb
//Column high sculpt 3 row system
[17.16, 17.16, 6.5, 6.5,10.25, 0, -.25, 10, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4 6
[17.16, 17.16, 6.5, 6.5, 8.75, 0, .5, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5,10.75, 0, -.25, -13, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[17.16, 17.16, 6.5, 6.5, 8.75, 0, .5, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 deepdish
//kyria Thumbs 10 ~ 16
[17.16, 35.96, 6, 7, 11, 0, 0, -8, 10, -5, 2, 2, 1, 4.85, 1, 3.5, 2, 2], //T0R1 2u 10
[17.16, 17.16, 6, 5, 11, -.5, 0, -9, 7, 10, 2, 2, 1, 5, 1, 3, 2, 2], //T0R1 1u
[17.16, 17.16, 6, 5, 13, -.5, 0, -9, 7, 5, 2, 2, 1, 5, 1, 3.5, 2, 2], //T0R2 1u
[17.16, 35.56, 6, 7, 11, 0, 0, -8, 10, -5, 2, 2, 1, 4.85, 1, 3.5, 2, 2], //T1R1 2u
[17.16, 17.16, 4, 6, 12, .5, 0, -13, -7, 10, 2, 2, 1, 5, 1, 2, 2, 2], //T1R1 1u
[17.16, 17.16, 6, 5, 15, -.5, 0, -9, -7, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //T1R2 1u
[17.16, 17.16, 4, 6, 13, .5, 0, -13, 10, 15, 2, 2, 1, 5, 1, 2, 2, 2], //T2R1
[17.16, 17.16, 4, 6, 13, 0, 0, -8, 10, 20, 2, 2, 1, 5, 1, 2, 2, 2], //T3R1 17
//normie hi-sculpt 4 row system 18~23
[17.16, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 18
[17.16, 17.16, 6.5, 6.5, 9.5, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[17.16, 17.16, 6.5, 6.5, 8.5, 0, .5, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 10, 0, 0, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[17.16, 17.16, 6.5, 6.5, 14.0, 0, -.25, -14, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
[17.16, 17.16, 6.5, 6.5, 9, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home Deeper 23
//1.25u 24~28
[21.86, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 24
[21.86, 17.16, 6.5, 6.5, 9.5, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[21.86, 17.16, 6.5, 6.5, 8.5, 0, .5, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[21.86, 17.16, 6.5, 6.5, 10, 0, 0, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[21.86, 17.16, 6.5, 6.5, 14.0, 0, -.25, -14, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1 28
//1.5u 29~33
[26.66, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 29
[26.66, 17.16, 6.5, 6.5, 9.5, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[26.66, 17.16, 6.5, 6.5, 8.5, 0, .5, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[26.66, 17.16, 6.5, 6.5, 10, 0, 0, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[26.66, 17.16, 6.5, 6.5, 14.0, 0, -.25, -14, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//1.75u
[31.06, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[31.06, 17.16, 6.5, 6.5, 9.5, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[31.06, 17.16, 6.5, 6.5, 8.5, 0, .5, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[31.06, 17.16, 6.5, 6.5, 10, 0, 0, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[31.06, 17.16, 6.5, 6.5, 14.0, 0, -.25, -14, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//2.0u
[35.96, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[35.46, 17.16, 6.5, 6.5, 9.5, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[35.46, 17.16, 6.5, 6.5, 8.5, 0, .5, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[35.46, 17.16, 6.5, 6.5, 10, 0, 0, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[35.46, 17.16, 6.5, 6.5, 14.0, 0, -.25, -14, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//normie mild 4 row system
[17.16, 17.16, 6.5, 6.5, 9.3, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[17.16, 17.16, 6.5, 6.5, 8.8, 0, 0, 7, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[17.16, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 8.8, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[17.16, 17.16, 6.5, 6.5, 11.0, 0, -.25, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
[17.16, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home Deeper
//1.25u
[22.06, 17.16, 6.5, 6.5, 9.3, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[22.06, 17.16, 6.5, 6.5, 8.8, 0, 0, 7, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[22.06, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[22.06, 17.16, 6.5, 6.5, 8.8, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[22.06, 17.16, 6.5, 6.5, 11.0, 0, -.25, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//1.5u
[26.66, 17.16, 6.5, 6.5, 9.3, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[26.66, 17.16, 6.5, 6.5, 8.8, 0, 0, 7, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[26.66, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[26.66, 17.16, 6.5, 6.5, 8.8, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[26.66, 17.16, 6.5, 6.5, 11.0, 0, -.25, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//1.75u
[31.06, 17.16, 6.5, 6.5, 9.3, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[31.06, 17.16, 6.5, 6.5, 8.8, 0, 0, 7, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[31.06, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[31.06, 17.16, 6.5, 6.5, 8.8, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[31.06, 17.16, 6.5, 6.5, 11.0, 0, -.25, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//2.0u
[35.56, 17.16, 6.5, 6.5, 9.3, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[35.56, 17.16, 6.5, 6.5, 8.8, 0, 0, 7, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[35.56, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[35.56, 17.16, 6.5, 6.5, 8.8, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[35.56, 17.16, 6.5, 6.5, 11.0, 0, -.25, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//lowest profile
[17.16, 17.16, 6.5, 6.5, 7.25, 0, 0, 3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4 6
[17.16, 17.16, 6.5, 6.5, 7, 0, .5, .001, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 7.25, 0, -.25, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[17.16, 17.16, 6.5, 6.5, 7, 0, .5, .001, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 deepdish
];
dishParameters = //dishParameter[keyID][ParameterID]
[
//FFwd1 FFwd2 FPit1 FPit2 DshDep DshHDif FArcIn FArcFn FArcEx BFwd1 BFwd2 BPit1 BPit2 BArcIn BArcFn BArcEx
//higt corne thumb
[ 8, 4.5, 7, -39, 4, 1.8, 9.5, 15, 2, 10, 4, 8, -30, 9.5, 20, 2], //R5
[ 5, 4.3, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 13, -30, 10.5, 18, 2], //R5
[ 5, 4.3, 5, -48, 4, 1.9, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //R5
[ 8, 5.0, 7, -39, 4, 1.9, 9.5, 15, 2, 10, 4, 8, -30, 9.5, 20, 2], //R5
[ 5, 4.8, 5, -48, 5, 2.2, 10.5, 10, 2, 6, 4, 13, -30, 10.5, 18, 2], //R5
[ 5, 4.8, 5, -48, 4, 2.0, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //R5
// low pro 3 row system
[ 6, 3, 18, -50, 5, 1.8, 8.8, 15, 2, 5, 4.4, 5, -55, 8.8, 15, 2], //R4
[ 5, 3.5, 10, -55, 5, 1.8, 8.5, 15, 2, 5, 3.5, 10, -55, 8.5, 15, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R2
[ 4.8, 3.3, 18, -55, 5, 2.0, 8.5, 15, 2, 4.8, 3.3, 18, -55, 8.5, 15, 2], //R3 deep
//kyria
[ 13, 4.5, 7, -39, 4, 1.8, 9.5, 15, 2, 13, 4, 8, -30, 9.5, 20, 2], //T1R1 2u
[ 5, 4.4, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 2, -30, 10.5, 18, 2], //T0R1 1u
[ 5, 4.3, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 2, -30, 10.5, 18, 2], //T0R2 1u
[ 13, 4.5, 7, -39, 4, 1.8, 9.5, 15, 2, 13, 4, 8, -30, 9.5, 20, 2], //T1R1 2u
[ 5, 4.4, 5, -48, 4, 1.9, 11, 12, 2, 5.5, 3.5, 8, -50, 11, 28, 2], //T1R1 1u
[ 5, 4.3, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 2, -30, 10.5, 18, 2], //T1R2 1u
[ 5, 4.4, 5, -48, 4, 1.9, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //T2R1
[ 5, 4.4, 5, -48, 4, 1.9, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //T3R1
//heavy
[ 6, 3, -5, -50, 5, 1.8, 8.8, 15, 2, 6, 3.5, 13, -50, 8.8, 16, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 8.8, 15, 2, 5, 4.4, 5, -55, 8.8, 15, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 8.8, 15, 2, 5, 3.5, 8, -55, 8.8, 15, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 8.8, 15, 2, 5, 4, 12, -55, 8.8, 16, 2], //R2
[ 5, 3.5, 8, -50, 5, 1.9, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R1
[ 5.5, 2.8, 23, -50, 5, 1.8, 8.5, 15, 2, 5, 3.3, 13, -55, 8.5, 15, 2], //R3 deep
// 1.25
[ 6, 3, -5, -50, 5, 1.8, 12.4, 18, 2, 6, 3.5, 13, -50, 12.4, 19, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 12.4, 20, 2, 5, 4.4, 5, -55, 12.4, 19, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 12.4, 18, 2, 5, 3.7, 8, -55, 12.4, 19, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 12.4, 18, 2, 5, 4, 12, -55, 12.4, 19, 2], //R2
[ 5, 3.5, 8, -50, 5, 1.9, 12.5, 18, 2, 6, 4, 13, 30, 12.5, 19, 2], //R1
//1.5
[ 6, 3, -5, -50, 5, 1.8, 15.5, 22, 2, 6, 3.5, 13, -50, 15.5, 22, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 15.5, 27.2, 2, 5, 4.4, 5, -55, 15.5, 22, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 15.5, 22, 2, 5, 3.7, 8, -55, 15.5, 22, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 15.7, 22, 2, 5, 4, 12, -55, 15.7, 23, 2], //R2
[ 5, 3.5, 8, -50, 5, 1.9, 15.7, 22, 2, 6, 4, 13, 30, 15.7, 23.5, 2], //R1
//1.75
[ 6, 3, -5, -50, 5, 1.8, 18.7, 25, 2, 6, 3.5, 13, -50, 18.7, 25, 2], //R5
[ 6, 3, 17, -50, 5, 1.8, 18.7, 32, 2, 5, 4.4, 5, -55, 18.7, 25, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 18.7, 27, 2, 5, 3.8, 8, -55, 18.7, 25, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 18.7, 25, 2, 5, 4, 12, -55, 18.7, 28, 2], //R2
[ 5, 3.7, 8, -50, 5, 1.9, 18.8, 25, 2, 6, 4, 12, 30, 18.8, 28, 2], //R1
//2
[ 6, 3, -5, -50, 5, 1.8, 21.9, 30, 2, 6, 3.5, 13, -50, 21.9, 31, 2], //R5
[ 6, 3, 15, -50, 5, 1.8, 21.9, 34, 2, 5, 4.4, 5, -55, 21.9, 31, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 21.9, 32.5, 2, 5, 3.7, 8, -55, 21.9, 31, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 21.9, 30, 2, 5, 4, 11.5, -55, 21.9, 33, 2], //R2
[ 5, 3.7, 8, -50, 5, 1.9, 22.1, 30, 2, 6, 4, 12, 30, 22.1, 33.5, 2], //R1
//mild
[ 6, 3, -5, -35, 5, 1.8, 8.8, 15, 2, 6, 3.5, 13, -50, 8.8, 16, 2], //R5
[ 6, 3, 15, -55, 5, 1.8, 8.8, 15, 2, 5, 4.4, 5, -55, 8.8, 15, 2], //R4
[ 5, 3.5, 8, -55, 5, 1.8, 8.8, 15, 2, 5, 3.8, 8, -55, 8.8, 15, 2], //R3
[ 5, 4.4, 5, -55, 5, 1.8, 8.8, 15, 2, 6, 3, 15, -55, 8.8, 15, 2], //R2
[ 5, 3.5, 8, -50, 5, 1.8, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R1
[ 5, 3.3, 15, -55, 5, 1.8, 8.5, 15, 2, 5, 3.3, 15, -55, 8.5, 15, 2], //R3 deep
// 1.25
[ 6, 3, -5, -50, 5, 1.8, 12.4, 18, 2, 6, 3.5, 13, -50, 12.4, 19, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 12.4, 20, 2, 5, 4.6, 5, -55, 12.4, 19, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 12.4, 18, 2, 5, 3.9, 8, -55, 12.4, 19, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 12.4, 18, 2, 5, 4, 12, -55, 12.4, 19, 2], //R2
[ 5, 3.8, 8, -50, 5, 1.9, 12.5, 18, 2, 6, 4, 13, 30, 12.5, 19, 2], //R1
//1.5
[ 6, 3, -5, -50, 5, 1.8, 15.5, 22, 2, 6, 3.5, 13, -50, 15.5, 22, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 15.5, 27.2, 2, 5, 4.4, 5, -55, 15.5, 22, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 15.5, 22, 2, 5, 3.9, 8, -55, 15.5, 22, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 15.7, 22, 2, 5, 4, 12, -55, 15.7, 23, 2], //R2
[ 5, 3.9, 8, -50, 5, 1.9, 15.7, 22, 2, 6, 4, 13, 30, 15.7, 23.5, 2], //R1
//1.75
[ 6, 3.2, -5, -50, 5, 1.8, 18.7, 25, 2, 6, 3.5, 13, -50, 18.7, 25, 2], //R5
[ 6, 3, 17, -50, 5, 1.8, 18.7, 32, 2, 5, 4.4, 5, -55, 18.7, 25, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 18.7, 27, 2, 5, 3.9, 8, -55, 18.7, 25, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 18.7, 25, 2, 5, 4, 12, -55, 18.7, 28, 2], //R2
[ 5, 3.9, 8, -50, 5, 1.9, 18.8, 25, 2, 6, 4, 12, 30, 18.8, 28, 2], //R1
//2
[ 6, 3.1, -5, -50, 5, 1.8, 21.9, 30, 2, 6, 3.5, 13, -50, 21.9, 31, 2], //R5
[ 6, 3, 15, -50, 5, 1.8, 21.9, 34, 2, 5, 4.4, 5, -55, 21.9, 31, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 21.9, 32.5, 2, 5, 3.9, 8, -55, 21.9, 31, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 21.9, 30, 2, 5, 4, 11.5, -55, 21.9, 33, 2], //R2
[ 5, 3.9, 8, -50, 5, 1.9, 22.1, 30, 2, 6, 4, 12, 30, 22.1, 33.5, 2], //R1
// low pro mil sculpt 3 row system
[ 6, 3, 18, -50, 5, 1.8, 8.8, 15, 2, 5, 4.4, 5, -55, 8.8, 15, 2], //R4
[ 5, 3.8, 8, -55, 5, 1.8, 8.5, 15, 2, 5, 4.2, 8, -55, 8.5, 15, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R2
[5.25, 3., 16, -55, 5, 1.8, 8.5, 15, 2, 5.25, 3.1, 16, -55, 8.5, 15, 2], //R3 deep
];
function FrontForward1(keyID) = dishParameters[keyID][0]; //
function FrontForward2(keyID) = dishParameters[keyID][1]; //
function FrontPitch1(keyID) = dishParameters[keyID][2]; //
function FrontPitch2(keyID) = dishParameters[keyID][3]; //
function DishDepth(keyID) = dishParameters[keyID][4]; //
function DishHeightDif(keyID) = dishParameters[keyID][5]; //
function FrontInitArc(keyID) = dishParameters[keyID][6];
function FrontFinArc(keyID) = dishParameters[keyID][7];
function FrontArcExpo(keyID) = dishParameters[keyID][8];
function BackForward1(keyID) = dishParameters[keyID][9]; //
function BackForward2(keyID) = dishParameters[keyID][10]; //
function BackPitch1(keyID) = dishParameters[keyID][11]; //
function BackPitch2(keyID) = dishParameters[keyID][12]; //
function BackInitArc(keyID) = dishParameters[keyID][13];
function BackFinArc(keyID) = dishParameters[keyID][14];
function BackArcExpo(keyID) = dishParameters[keyID][15];
function BottomWidth(keyID) = keyParameters[keyID][0]; //
function BottomLength(keyID) = keyParameters[keyID][1]; //
function TopWidthDiff(keyID) = keyParameters[keyID][2]; //
function TopLenDiff(keyID) = keyParameters[keyID][3]; //
function KeyHeight(keyID) = keyParameters[keyID][4]; //
function TopWidShift(keyID) = keyParameters[keyID][5];
function TopLenShift(keyID) = keyParameters[keyID][6];
function XAngleSkew(keyID) = keyParameters[keyID][7];
function YAngleSkew(keyID) = keyParameters[keyID][8];
function ZAngleSkew(keyID) = keyParameters[keyID][9];
function WidExponent(keyID) = keyParameters[keyID][10];
function LenExponent(keyID) = keyParameters[keyID][11];
function CapRound0i(keyID) = keyParameters[keyID][12];
function CapRound0f(keyID) = keyParameters[keyID][13];
function CapRound1i(keyID) = keyParameters[keyID][14];
function CapRound1f(keyID) = keyParameters[keyID][15];
function ChamExponent(keyID) = keyParameters[keyID][16];
function StemExponent(keyID) = keyParameters[keyID][17];
function FrontTrajectory(keyID) =
[
trajectory(forward = FrontForward1(keyID), pitch = FrontPitch1(keyID)), //more param available: yaw, roll, scale
trajectory(forward = FrontForward2(keyID), pitch = FrontPitch2(keyID)) //You can add more traj if you wish
];
function BackTrajectory (keyID) =
[
trajectory(forward = BackForward1(keyID), pitch = BackPitch1(keyID)),
trajectory(forward = BackForward2(keyID), pitch = BackPitch2(keyID)),
];
//------- function defining Dish Shapes
function ellipse(a, b, d = 0, rot1 = 0, rot2 = 360) = [for (t = [rot1:step:rot2]) [a*cos(t)+a, b*sin(t)*(1+d*cos(t))]]; //Centered at a apex to avoid inverted face
function DishShape (a,b,c,d) =
concat(
// [[c+a,b]],
ellipse(a, b, d = 0,rot1 = 90, rot2 = 270)
// [[c+a,-b]]
);
function oval_path(theta, phi, a, b, c, deform = 0) = [
a*cos(theta)*cos(phi), //x
c*sin(theta)*(1+deform*cos(theta)) , //
b*sin(phi),
];
path_trans2 = [for (t=[0:step:180]) translation(oval_path(t,0,10,15,2,0))*rotation([0,90,0])];
//--------------Function definng Cap
function CapTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*KeyHeight(keyID)) //Z shift
];
function InnerTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*(KeyHeight(keyID)-topthickness)) //Z shift
];
function CapRotation(t, keyID) =
[
((1-t)/layers*XAngleSkew(keyID)), //X shift
((1-t)/layers*YAngleSkew(keyID)), //Y shift
((1-t)/layers*ZAngleSkew(keyID)) //Z shift
];
function CapTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)) + (1-pow(t/layers, WidExponent(keyID)))*BottomWidth(keyID) ,
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)) + (1-pow(t/layers, LenExponent(keyID)))*BottomLength(keyID)
];
function CapRoundness(t, keyID) =
[
pow(t/layers, ChamExponent(keyID))*(CapRound0f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound0i(keyID),
pow(t/layers, ChamExponent(keyID))*(CapRound1f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound1i(keyID)
];
function CapRadius(t, keyID) = pow(t/layers, ChamExponent(keyID))*ChamfFinRad(keyID) + (1-pow(t/layers, ChamExponent(keyID)))*ChamfInitRad(keyID);
function InnerTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, WidExponent(keyID)))*(BottomWidth(keyID) -wallthickness*2+1.25),
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, LenExponent(keyID)))*(BottomLength(keyID)-wallthickness*2+1.25)
];
function StemTranslation(t, keyID) =
[
((1-t)/stemLayers*TopWidShift(keyID)), //X shift
((1-t)/stemLayers*TopLenShift(keyID)), //Y shift
stemCrossHeight+.1+StemBrimDep + (t/stemLayers*(KeyHeight(keyID)- topthickness - stemCrossHeight-.1 -StemBrimDep)) //Z shift
];
function StemRotation(t, keyID) =
[
((1-t)/stemLayers*XAngleSkew(keyID)), //X shift
((1-t)/stemLayers*YAngleSkew(keyID)), //Y shift
((1-t)/stemLayers*ZAngleSkew(keyID)) //Z shift
];
function StemTransform(t, keyID) =
[
pow(t/stemLayers, WidExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/stemLayers, WidExponent(keyID)))*(Dcyl+sin(draftAngle)*(stemCrossHeight+.1+StemBrimDep)),
pow(t/stemLayers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/stemLayers, LenExponent(keyID)))*(Dcyl+sin(draftAngle)*(stemCrossHeight+.1+StemBrimDep))
];
function StemRoundness(t, keyID) =
[
pow(t/stemLayers, ChamExponent(keyID))*(CapRound0f(keyID)) + (1-pow(t/stemLayers, ChamExponent(keyID)))*Dcyl+sin(draftAngle)*(stemCrossHeight+.1+StemBrimDep),
pow(t/stemLayers, ChamExponent(keyID))*(CapRound1f(keyID)) + (1-pow(t/stemLayers, ChamExponent(keyID)))*Dcyl+sin(draftAngle)*(stemCrossHeight+.1+StemBrimDep)
];
function periodic(a) = sign(a);
function elliptical_rectangle_position(a = [1,1], b =[1,1], fn=32, phase = 0) = [
//x
(phase > -atan(a[1]/b[1]) && phase <= atan(a[1]/b[1])) ? //IV->I quadtrant right
(b[1]*cos(phase)+ a[0]*cos(atan(b[0]/a[0])) - b[1]*cos(atan(a[1]/b[1])))/2 :
(phase > atan(a[1]/b[1]) && phase <= 3*atan(a[1]/b[1])) ? // I->II top
(a[0]*cos(atan(b[0]/a[0])-atan(a[1]/b[1])+phase))/2:
(phase > 3*atan(a[1]/b[1]) && phase <= 5*atan(a[1]/b[1])-atan(b[0]/a[0])) ? // II->III left
(b[1]*cos(phase-2*atan(a[1]/b[1])+2*atan(b[0]/a[0]))-a[0]*cos(atan(b[0]/a[0]))+b[1]*cos(atan(a[1]/b[1])))/2:
(phase > 5*atan(a[1]/b[1])-atan(b[0]/a[0]) && phase <= 7*atan(a[1]/b[1])) ? //III->IV
(a[0]*cos(phase-3*atan(a[1]/b[1])+3*atan(b[0]/a[0])))/2:0,
//y
(phase > -atan(a[1]/b[1]) && phase <= atan(a[1]/b[1])) ? //IV->I quadtrant right
(a[1]*sin(phase))/2 :
(phase > atan(a[1]/b[1]) && phase <= atan(a[1]/b[1])*3) ? // I->II top
(b[0]*sin(atan(b[0]/a[0])-atan(a[1]/b[1])+phase)-b[0]*sin(atan(b[0]/a[0]))+a[1]*sin(atan(a[1]/b[1])))/2:
(phase > atan(a[1]/b[1])*3 && phase <= 5*atan(a[1]/b[1])-atan(b[0]/a[0])) ? // II->III left
(a[1]*sin(phase-2*atan(a[1]/b[1])+2*atan(b[0]/a[0])))/2:
(phase > 5*atan(a[1]/b[1])-atan(b[0]/a[0]) && phase <= 7*atan(a[1]/b[1])) ? //III->IV
(b[0]*sin(phase-3*atan(a[1]/b[1])+3*atan(b[0]/a[0]))+b[0]*sin(atan(b[0]/a[0]))-a[1]*sin(atan(a[1]/b[1])))/2:0,
//z
0
];
function rotationMat(x,theta) =
[
x[0],// + x[0]*cos(theta[1]) + x[2]*sin(theta[1]) + x[0]*cos(theta[2]) - x[1]*sin(theta[2]), //x
x[1],// + x[1]*cos(theta[0]) - x[2]*sin(theta[0]) + + x[0]*sin(theta[2]) + x[1]*cos(theta[2]), //y
x[1]*sin(theta[0]) + x[2]*cos(theta[0]) +-x[0]*sin(theta[1]) + x[2]*cos(theta[1])+ x[2], //z
];
function KurlPathTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, WidExponent(keyID)))*(BottomWidth(keyID) -wallthickness*2+1.25),
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, LenExponent(keyID)))*(BottomLength(keyID)-wallthickness*2+1.25)
];
function KurlTranslation(t, w, phi, keyID) =
[//top surface translation
((1-t)/layers*TopWidShift(keyID)),
((1-t)/layers*TopLenShift(keyID)),
(t/layers*(KeyHeight(keyID)-topthickness)) //Z shift
] +
rotationMat( //rotation offset
elliptical_rectangle_position(
a = KurlPathTransform(t, keyID),
b = CapRoundness(t, keyID),
fn=fn,
phase = phi+w*t
),
KurlRotation(t, keyID)
);
function KurlRotation(t, keyID) = //rotate shape
[
((1-t)/layers*XAngleSkew(keyID)), //X shift
((1-t)/layers*YAngleSkew(keyID)), //Y shift
((1-t)/layers*ZAngleSkew(keyID)) //Z shift
];
///----- KEY Builder Module
module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false, Dish = true, Stem = false, Kurl = true, crossSection = true,Legends = false, homeDot = false, Stab = 0) {
//Set Parameters for dish shape
FrontPath = quantize_trajectories(FrontTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
BackPath = quantize_trajectories(BackTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
//Scaling initial and final dim tranformation by exponents
function FrontDishArc(t) = pow((t)/(len(FrontPath)),FrontArcExpo(keyID))*FrontFinArc(keyID) + (1-pow(t/(len(FrontPath)),FrontArcExpo(keyID)))*FrontInitArc(keyID);
function BackDishArc(t) = pow((t)/(len(FrontPath)),BackArcExpo(keyID))*BackFinArc(keyID) + (1-pow(t/(len(FrontPath)),BackArcExpo(keyID)))*BackInitArc(keyID);
FrontCurve = [ for(i=[0:len(FrontPath)-1]) transform(FrontPath[i], DishShape(DishDepth(keyID), FrontDishArc(i), 1, d = 0)) ];
BackCurve = [ for(i=[0:len(BackPath)-1]) transform(BackPath[i], DishShape(DishDepth(keyID), BackDishArc(i), 1, d = 0)) ];
//builds
if(Stem == false){
difference(){
skin([for (i=[0:layers-1]) transform(translation(CapTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(CapTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]); //outer shell
//cuts
if(Dish == true){
if(visualizeDish == false){
translate([-TopWidShift(keyID),.00001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
} else {
#translate([-TopWidShift(keyID),.00001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)]) rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
#translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
}
}
if(crossSection == true) {
translate([0,-15,-.1])cube([15,30,15]);
}
}
//Homing dot
if(homeDot == true)translate([0,0,KeyHeight(keyID)-DishHeightDif(keyID)-.25])sphere(d = dotRadius);
}
else {
difference(){
union(){
translate([0,0,-.001])skin([for (i=[0:layers-1]) transform(translation(InnerTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(InnerTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]);
// hull(){// cherry top housing
// translate([0,0,-.0])cube([14.5, 14, .1],center = true);
// translate([0,0,5.])cube([11,11, .1],center = true);
// }
}
// #translate([0,0,StemBrimDep])cherry_stem(KeyHeight(keyID)-StemBrimDep, slop); // generate mx cherry stem
if(KeyHeight(keyID) > stemsupportLimit) //only generate stem to top surface support when there is enough room
translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), elliptical_rectangle(StemTransform(i, keyID), b = StemRoundness(i,keyID),fn=fn))]);
// if(Kurl == true){//t, w, phi, keyID
for(n = [-1:10]){
// #skin([for (i=[0:layers-1]) transform(translation(KurlTranslation(i,0/layers,70*n,keyID)) * rotation(CapRotation(i, keyID)),circle(.5/*+.1*sin(5*360/layers*i)*/))]);
// skin([for (i=[0:layers-1]) transform(translation(KurlTranslation(i,-45/layers,500-50*n,keyID)) * rotation(CapRotation(i, keyID)),circle(.5/*+.1*sin(5*360/layers*i)*/))]);
}
// elliptical_rectangle_position(InnerTransform(i, keyID), b = CapRoundness(i,keyID), fn=fn, phase = i*5);
// }
}
}
}
//------------------stems
$fn = fn;
function outer_cherry_stem(slop) = [ stemWid - slop * 2, stemLen - slop * 2];
function outer_cherry_stabilizer_stem(slop) = [4.85 - slop * 2, 6.05 - slop * 2];
function outer_box_cherry_stem(slop) = [6 - slop, 6 - slop];
// .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],
];
module inside_cherry_cross(slop) {
// inside cross
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-0.005]) {
linear_extrude(height = stemCrossHeight) {
square(cherry_cross(slop, extra_vertical)[0], center=true);
square(cherry_cross(slop, extra_vertical)[1], center=true);
}
}
// Guides to assist insertion and mitigate first layer squishing
{
for (i = cherry_cross(slop, extra_vertical)) hull() {
linear_extrude(height = 0.01, center = false) offset(delta = 0.15) square(i, center=true);
translate([0, 0, 0.15]) linear_extrude(height = 0.01, center = false) square(i, center=true);
}
}
}
module cherry_stem(depth, slop) {
D1=.15;
D2=.05;
H1=3.5;
CrossDist = 1.75;
difference(){
// outside shape
// linear_extrude(height = depth) {
// offset(r=1){
// square(outer_cherry_stem(slop) - [2,2], center=true);
// }
// }
cylinder(d1 = Dcyl, d2= Dcyl+sin(draftAngle)*depth, depth, $fn = fn*4);
rotate([0,0,stemRot])inside_cherry_cross(slop);
// hull(){
// translate([CrossDist,CrossDist-.1,0])cylinder(d1=D1, d2=D2, H1);
// translate([-CrossDist,-CrossDist+.1,0])cylinder(d1=D1, d2=D2, H1);
// }
// hull(){
// translate([-CrossDist,CrossDist-.1])cylinder(d1=D1, d2=D2, H1);
// translate([CrossDist,-CrossDist+.1])cylinder(d1=D1, d2=D2, H1);
// }
}
}
module choc_stem() {
translate([5.7/2,0,-3.4/2+2])difference(){
cube([1.25,3, 3.4], center= true);
translate([3.9,0,0])cylinder(d=7,3.4,center = true);
translate([-3.9,0,0])cylinder(d=7,3.4,center = true);
}
translate([-5.7/2,0,-3.4/2+2])difference(){
cube([1.25,3, 3.4], center= true);
translate([3.9,0,0])cylinder(d=7,3.4,center = true);
translate([-3.9,0,0])cylinder(d=7,3.4,center = true);
}
}
/// ----- helper functions
function rounded_rectangle_profile(size=[1,1],r=1,fn=32) = [
for (index = [0:fn-1])
let(a = index/fn*360)
r * [cos(a), sin(a)]
+ sign_x(index, fn) * [size[0]/2-r,0]
+ sign_y(index, fn) * [0,size[1]/2-r]
];
function elliptical_rectangle(a = [1,1], b =[1,1], fn=32) = [
for (index = [0:fn-1]) // section right
let(theta1 = -atan(a[1]/b[1])+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta1), a[1]*sin(theta1)]
+ [a[0]*cos(atan(b[0]/a[0])) , 0]
- [b[1]*cos(atan(a[1]/b[1])) , 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
- [0, b[0]*sin(atan(b[0]/a[0]))]
+ [0, a[1]*sin(atan(a[1]/b[1]))],
for(index = [0:fn-1]) // section left
let(theta2 = -atan(a[1]/b[1])+180+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta2), a[1]*sin(theta2)]
- [a[0]*cos(atan(b[0]/a[0])) , 0]
+ [b[1]*cos(atan(a[1]/b[1])) , 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + 180 + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
+ [0, b[0]*sin(atan(b[0]/a[0]))]
- [0, a[1]*sin(atan(a[1]/b[1]))]
]/2;
function sign_x(i,n) =
i < n/4 || i > n-n/4 ? 1 :
i > n/4 && i < n-n/4 ? -1 :
0;
function sign_y(i,n) =
i > 0 && i < n/2 ? 1 :
i > n/2 ? -1 :
0;

View file

@ -1,592 +0,0 @@
use <scad-utils/morphology.scad> //for cheaper minwoski
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <scad-utils/trajectory.scad>
use <scad-utils/trajectory_path.scad>
use <sweep.scad>
use <skin.scad>
// R3 1.25x 1.75x
// R4 1.25x 1.75
// R5 1.50x 2.25, 2.75
/*DES (Distorted Elliptical Saddle) Sculpted Profile for 6x3 and corne thumb
Version 2: Eliptical Rectangle
*/
//#square([18.16, 18.16], center = true);
//#square([36.3, 19.05], center = true);
mirror([0,0,0])keycap(keyID = 36, cutLen = 0, Stem =true, Dish = true, Stab = 0 , veisualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([-19,0,0])keycap(keyID = 3, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([19,0,0])mirror([0,0,0])keycap(keyID = 5, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([19*.5,19,0])mirror([1,0,0])keycap(keyID = 6, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//n translate([0,19, 0])keycap(keyID = 3, cutLen = 0, Stem =true, Dish = true, visualizeDish = true, crossSection = true, homeDot = false, Legends = false);
// translate([0,38, 0])mirror([0,1,0])keycap(keyID = 2, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = true, homeDot = false, Legends = false);
//Low Pro rows
//for(cap = [8:10]){
//translate([-38, 19*(cap-8), 0])keycap(keyID = cap, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = true,Legends = false);
//}
//for(cap = [70:72]){
//translate([-19, 19*(cap-70), 0])keycap(keyID = cap, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
//}
//translate([-19, 19*(3), 0])keycap(keyID = 6, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = true,Legends = false);
//
//for(cap = [64:68]){
//translate([0, 19*(cap-64), 0])keycap(keyID = cap, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
//}
//for(cap = [20:24]){
//translate([0, 19*(cap-20), 0])keycap(keyID = cap, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = true,Legends = false);
//}
//translate([19, 19*(2), 0])keycap(keyID = 25, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = true,Legends = false);
//////corne thumb
// translate([-15, -4, 0])rotate([0,0,30])keycap(keyID = 0, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([6, 0, 0])rotate([0,0,15])keycap(keyID = 4, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([26, 2.2, 0])rotate([0,0,0])keycap(keyID = 8, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//LOW pro
// translate([-15, -4, 0])rotate([0,0,30])keycap(keyID =3, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false);
// translate([6, 0, 0])rotate([0,0,15])keycap(keyID = 4, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false);
// translate([26, 2.2, 0])rotate([0,0,0])keycap(keyID = 5, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false);
//kyria Thumb
// translate([-39, 0, 0])rotate([0,0,30])translate([0,-19.5, 0])keycap(keyID = 10, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//// translate([-39, 0, 0])rotate([0,0,30])translate([0,-19.5, 0])keycap(keyID = 11, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//// translate([-39, 0, 0])rotate([0,0,30])translate([0, -1, 0])keycap(keyID = 12, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//// translate([-17, 0, 0])rotate([0,0,30])translate([0, 0, 0])keycap(keyID = 13, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([-17, 0, 0])rotate([0,0,30])translate([0,-8.5, 0])mirror([1,0,0])keycap(keyID = 14, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([-17, 0, 0])rotate([0,0,30])translate([0, 10, 0])mirror([1,0,0])keycap(keyID = 15, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([6, 0, 0])rotate([0,0,15])keycap(keyID = 16, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([26, 2.2, 0])rotate([0,0,0])keycap(keyID = 17, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//normie hipro
// for(Row = [0:4]){
// translate([0, 19*Row, 0])keycap(keyID = 29+Row, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
// }
//#translate([0,38,13])cube([18-5.7, 18-5.7,1],center = true);
//echo(len(keyParameters));
//Parameters
wallthickness = 1.25; // 1.5 for norm, 1.25 for cast master
topthickness = 2.75; // 3 for norm, 2.5 for cast master
stepsize = 50; //resolution of Trajectory
step = 2; //resolution of ellipes
fn = 32; //resolution of Rounded Rectangles: 60 for output
layers = 40; //resolution of vertical Sweep: 50 for output
dotRadius = 1.25; //home dot size
//---Stem param
slop = 0.40;
stemRot = 0;
stemWid = 7.2;
stemLen = 5.5;
stemCrossHeight = 4;
extra_vertical = 0.6;
StemBrimDep = 0.25;
stemLayers = 50; //resolution of stem to cap top transition
keyParameters = //keyParameters[KeyID][ParameterID]
[
// BotWid, BotLen, TWDif, TLDif, keyh, WSft, LSft XSkew, YSkew, ZSkew, WEx, LEx, CapR0i, CapR0f, CapR1i, CapR1f, CapREx, StemEx
//corne thumb high pro
[17.16, 26.66, 6, 7, 13, 0, 0, -13, 10, -5, 2, 2, 1, 4.85, 1, 3, 2, 2], //R5 0 Corne thumb
[17.16, 17.16, 4, 5, 14, 0, 0, -13, 5, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 corne thumb
[17.16, 17.16, 4, 6, 15, 0, 0, -13, 10, 15, 2, 2, 1, 5, 1, 2, 2, 2], //R5 corne thumb
//Low profile corne thumb
[17.16, 26.66, 6, 7, 9.0, 0, 0, -8, 10, -5, 2, 2, 1, 4.85, 1, 3, 2, 2], //T1R5 external rot 3
[17.16, 26.66, 6, 7, 9.0, 0, 0, -8, 10, -0, 2, 2, 1, 4.85, 1, 3, 2, 2], //T1R5 nuetral
[17.16, 26.66, 6, 7, 9.0, 0, 0, -8, 10, 5, 2, 2, 1, 4.85, 1, 3, 2, 2], //T1R5 internal rot Corne thumb
[17.16, 17.16, 4, 5, 10., 0, 0, -12, 5, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 corne thumb
[17.16, 17.16, 4, 6, 11, 0, 0, -12, 10, 15, 2, 2, 1, 5, 1, 2, 2, 2], //R5 corne thumb
//Column high sculpt 3 row system
[17.16, 17.16, 6.5, 6.5,10.55, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4 8
[17.16, 17.16, 6.5, 6.5, 8.75, 0, .5, 4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 9.75, 0, 0, -13, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[17.16, 17.16, 6.5, 6.5, 8.75, 0, 0, 4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 deepdish
//kyria Thumbs 13 ~ 19
[17.16, 35.56, 6, 7, 11, 0, 0, -8, 10, -5, 2, 2, 1, 4.85, 1, 3.5, 2, 2], //T0R1 2u
[17.16, 17.16, 6, 5, 11, -.5, 0, -9, 7, 10, 2, 2, 1, 5, 1, 3, 2, 2], //T0R1 1u
[17.16, 17.16, 6, 5, 13, -.5, 0, -9, 7, 5, 2, 2, 1, 5, 1, 3.5, 2, 2], //T0R2 1u
[17.16, 35.56, 6, 7, 11, 0, 0, -8, 10, -5, 2, 2, 1, 4.85, 1, 3.5, 2, 2], //T1R1 2u
[17.16, 17.16, 4, 6, 12, .5, 0, -13, -7, 10, 2, 2, 1, 5, 1, 2, 2, 2], //T1R1 1u
[17.16, 17.16, 6, 5, 15, -.5, 0, -9, -7, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //T1R2 1u
[17.16, 17.16, 4, 6, 13, .5, 0, -13, 10, 15, 2, 2, 1, 5, 1, 2, 2, 2], //T2R1
[17.16, 17.16, 4, 6, 13, 0, 0, -8, 10, 20, 2, 2, 1, 5, 1, 2, 2, 2], //T3R1
//normie hi-sculpt 4 row system 17~23
[17.16, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[17.16, 17.16, 6.5, 6.5, 9.5, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[17.16, 17.16, 6.5, 6.5, 8.5, 0, .5, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 10, 0, 0, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[17.16, 17.16, 6.5, 6.5, 14.0, 0, -.25, -14, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
[17.16, 17.16, 6.5, 6.5, 9, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home Deeper
//1.25u 25~30
[21.86, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[21.86, 17.16, 6.5, 6.5, 9.5, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[21.86, 17.16, 6.5, 6.5, 8.5, 0, .5, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[21.86, 17.16, 6.5, 6.5, 10, 0, 0, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[21.86, 17.16, 6.5, 6.5, 14.0, 0, -.25, -14, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//1.5u 31~36
[26.66, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[26.66, 17.16, 6.5, 6.5, 9.5, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[26.66, 17.16, 6.5, 6.5, 8.5, 0, .5, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[26.66, 17.16, 6.5, 6.5, 10, 0, 0, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[26.66, 17.16, 6.5, 6.5, 14.0, 0, -.25, -14, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//1.75u 37~42
[31.06, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[31.06, 17.16, 6.5, 6.5, 9.5, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[31.06, 17.16, 6.5, 6.5, 8.5, 0, .5, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[31.06, 17.16, 6.5, 6.5, 10, 0, 0, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[31.06, 17.16, 6.5, 6.5, 14.0, 0, -.25, -14, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//2.0u
[35.46, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[35.46, 17.16, 6.5, 6.5, 9.5, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[35.46, 17.16, 6.5, 6.5, 8.5, 0, .5, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[35.46, 17.16, 6.5, 6.5, 10, 0, 0, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[35.46, 17.16, 6.5, 6.5, 14.0, 0, -.25, -14, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//normie mild 4 row system
[17.16, 17.16, 6.5, 6.5, 9.3, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[17.16, 17.16, 6.5, 6.5, 8.8, 0, 0, 7, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[17.16, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 8.8, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[17.16, 17.16, 6.5, 6.5, 11.0, 0, -.25, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
[17.16, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home Deeper
//1.25u
[21.86, 17.16, 6.5, 6.5, 9.3, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[21.86, 17.16, 6.5, 6.5, 8.8, 0, 0, 7, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[21.86, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[21.86, 17.16, 6.5, 6.5, 8.8, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[21.86, 17.16, 6.5, 6.5, 11.0, 0, -.25, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//1.5u
[26.66, 17.16, 6.5, 6.5, 9.3, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[26.66, 17.16, 6.5, 6.5, 8.8, 0, 0, 7, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[26.66, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[26.66, 17.16, 6.5, 6.5, 8.8, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[26.66, 17.16, 6.5, 6.5, 11.0, 0, -.25, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//1.75u
[31.06, 17.16, 6.5, 6.5, 9.3, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[31.06, 17.16, 6.5, 6.5, 8.8, 0, 0, 7, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[31.06, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[31.06, 17.16, 6.5, 6.5, 8.8, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[31.06, 17.16, 6.5, 6.5, 11.0, 0, -.25, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//2.0u
[35.56, 17.16, 6.5, 6.5, 9.3, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[35.56, 17.16, 6.5, 6.5, 8.8, 0, 0, 7, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[35.56, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[35.56, 17.16, 6.5, 6.5, 8.8, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[35.56, 17.16, 6.5, 6.5, 11.0, 0, -.25, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//lowest profile
[17.16, 17.16, 6.5, 6.5, 7.25, 0, 0, 3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4 6
[17.16, 17.16, 6.5, 6.5, 7, 0, .5, .001, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 7.25, 0, -.25, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[17.16, 17.16, 6.5, 6.5, 7, 0, .5, .001, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 deepdish
];
dishParameters = //dishParameter[keyID][ParameterID]
[
//FFwd1 FFwd2 FPit1 FPit2 DshDep DshHDif FArcIn FArcFn FArcEx BFwd1 BFwd2 BPit1 BPit2 BArcIn BArcFn BArcEx
//higt corne thumb
[ 8, 4.5, 7, -39, 4, 1.8, 9.5, 15, 2, 10, 4, 8, -30, 9.5, 20, 2], //R5
[ 5, 4.3, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 13, -30, 10.5, 18, 2], //R5
[ 5, 4.3, 5, -48, 4, 1.9, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //R5
[ 8.5, 5.0, 7, -39, 4, 1.9, 9.5, 15, 2, 10, 4, 8, -30, 9.5, 20, 2], //R5
[ 8.3, 5.0, 7, -39, 4, 1.9, 9.5, 15, 2, 10, 4, 8, -30, 9.5, 20, 2], //R5
[ 8.5, 5.0, 7, -39, 4, 1.9, 9.5, 15, 2, 10, 4, 8, -30, 9.5, 20, 2], //R5
[ 5, 4.8, 5, -48, 5, 2.2, 10.5, 10, 2, 6, 4, 13, -30, 10.5, 18, 2], //R5
[ 5, 4.8, 5, -48, 4, 2.0, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //R5
// low pro 3 row system
[ 6, 3, 18, -50, 5, 1.8, 8.8, 15, 2, 5, 4.4, 5, -55, 8.8, 15, 2], //R4
[ 5, 3.5, 10, -55, 5, 1.8, 8.5, 15, 2, 5, 3.7, 10, -55, 8.5, 15, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R2
[ 4.8, 3.3, 18, -55, 5, 2.0, 8.5, 15, 2, 4.8, 3.3, 18, -55, 8.5, 15, 2], //R3 deep
//kyria
[ 13, 4.5, 7, -39, 4, 1.8, 9.5, 15, 2, 13, 4, 8, -30, 9.5, 20, 2], //T1R1 2u
[ 5, 4.4, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 2, -30, 10.5, 18, 2], //T0R1 1u
[ 5, 4.3, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 2, -30, 10.5, 18, 2], //T0R2 1u
[ 13, 4.5, 7, -39, 4, 1.8, 9.5, 15, 2, 13, 4, 8, -30, 9.5, 20, 2], //T1R1 2u
[ 5, 4.4, 5, -48, 4, 1.9, 11, 12, 2, 5.5, 3.5, 8, -50, 11, 28, 2], //T1R1 1u
[ 5, 4.3, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 2, -30, 10.5, 18, 2], //T1R2 1u
[ 5, 4.4, 5, -48, 4, 1.9, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //T2R1
[ 5, 4.4, 5, -48, 4, 1.9, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //T3R1
//heavy
[ 6, 3, -5, -50, 5, 1.8, 8.8, 15, 2, 6, 3.5, 13, -50, 8.8, 16, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 8.8, 15, 2, 5, 4.4, 5, -55, 8.8, 15, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 8.8, 15, 2, 5, 3.5, 8, -55, 8.8, 15, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 8.8, 15, 2, 5, 4, 12, -55, 8.8, 16, 2], //R2
[ 5, 3.5, 8, -50, 5, 1.9, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R1
[ 5.5, 2.8, 23, -50, 5, 1.8, 8.5, 15, 2, 5, 3.3, 13, -55, 8.5, 15, 2], //R3 deep
// 1.25
[ 6, 3, -5, -50, 5, 1.8, 12.4, 18, 2, 6, 3.5, 13, -50, 12.4, 19, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 12.4, 20, 2, 5, 4.4, 5, -55, 12.4, 19, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 12.4, 18, 2, 5, 3.7, 8, -55, 12.4, 19, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 12.4, 18, 2, 5, 4, 12, -55, 12.4, 19, 2], //R2
[ 5, 3.5, 8, -50, 5, 1.9, 12.5, 18, 2, 6, 4, 13, 30, 12.5, 19, 2], //R1
//1.5
[ 6, 3, -5, -50, 5, 1.8, 15.5, 22, 2, 6, 3.5, 13, -50, 15.5, 22, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 15.5, 27.2, 2, 5, 4.4, 5, -55, 15.5, 22, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 15.5, 22, 2, 5, 3.7, 8, -55, 15.5, 22, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 15.7, 22, 2, 5, 4, 12, -55, 15.7, 23, 2], //R2
[ 5, 3.5, 8, -50, 5, 1.9, 15.7, 22, 2, 6, 4, 13, 30, 15.7, 23.5, 2], //R1
//1.75
[ 6, 3, -5, -50, 5, 1.8, 18.7, 25, 2, 6, 3.5, 13, -50, 18.7, 25, 2], //R5
[ 6, 3, 17, -50, 5, 1.8, 18.7, 32, 2, 5, 4.4, 5, -55, 18.7, 25, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 18.7, 27, 2, 5, 3.8, 8, -55, 18.7, 25, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 18.7, 25, 2, 5, 4, 12, -55, 18.7, 28, 2], //R2
[ 5, 3.7, 8, -50, 5, 1.9, 18.8, 25, 2, 6, 4, 12, 30, 18.8, 28, 2], //R1
//2
[ 6, 3, -5, -50, 5, 1.8, 21.9, 30, 2, 6, 3.5, 13, -50, 21.9, 31, 2], //R5
[ 6, 3, 15, -50, 5, 1.8, 21.9, 34, 2, 5, 4.4, 5, -55, 21.9, 31, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 21.9, 32.5, 2, 5, 3.7, 8, -55, 21.9, 31, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 21.9, 30, 2, 5, 4, 11.5, -55, 21.9, 33, 2], //R2
[ 5, 3.7, 8, -50, 5, 1.9, 22.1, 30, 2, 6, 4, 12, 30, 22.1, 33.5, 2], //R1
//mild
[ 6, 3, -5, -35, 5, 1.8, 8.8, 15, 2, 6, 3.5, 13, -50, 8.8, 16, 2], //R5
[ 6, 3, 15, -55, 5, 1.8, 8.8, 15, 2, 5, 4.4, 5, -55, 8.8, 15, 2], //R4
[ 5, 3.5, 8, -55, 5, 1.8, 8.8, 15, 2, 5, 3.8, 8, -55, 8.8, 15, 2], //R3
[ 5, 4.4, 5, -55, 5, 1.8, 8.8, 15, 2, 6, 3, 15, -55, 8.8, 15, 2], //R2
[ 5, 3.5, 8, -50, 5, 1.8, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R1
[ 5, 3.3, 15, -55, 5, 1.8, 8.5, 15, 2, 5, 3.3, 15, -55, 8.5, 15, 2], //R3 deep
// 1.25
[ 6, 3, -5, -50, 5, 1.8, 12.4, 18, 2, 6, 3.5, 13, -50, 12.4, 19, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 12.4, 20, 2, 5, 4.6, 5, -55, 12.4, 19, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 12.4, 18, 2, 5, 3.9, 8, -55, 12.4, 19, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 12.4, 18, 2, 5, 4, 12, -55, 12.4, 19, 2], //R2
[ 5, 3.8, 8, -50, 5, 1.9, 12.5, 18, 2, 6, 4, 13, 30, 12.5, 19, 2], //R1
//1.5
[ 6, 3, -5, -50, 5, 1.8, 15.5, 22, 2, 6, 3.5, 13, -50, 15.5, 22, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 15.5, 27.2, 2, 5, 4.4, 5, -55, 15.5, 22, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 15.5, 22, 2, 5, 3.9, 8, -55, 15.5, 22, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 15.7, 22, 2, 5, 4, 12, -55, 15.7, 23, 2], //R2
[ 5, 3.9, 8, -50, 5, 1.9, 15.7, 22, 2, 6, 4, 13, 30, 15.7, 23.5, 2], //R1
//1.75
[ 6, 3.2, -5, -50, 5, 1.8, 18.7, 25, 2, 6, 3.5, 13, -50, 18.7, 25, 2], //R5
[ 6, 3, 17, -50, 5, 1.8, 18.7, 32, 2, 5, 4.4, 5, -55, 18.7, 25, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 18.7, 27, 2, 5, 3.9, 8, -55, 18.7, 25, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 18.7, 25, 2, 5, 4, 12, -55, 18.7, 28, 2], //R2
[ 5, 3.9, 8, -50, 5, 1.9, 18.8, 25, 2, 6, 4, 12, 30, 18.8, 28, 2], //R1
//2
[ 6, 3.1, -5, -50, 5, 1.8, 21.9, 30, 2, 6, 3.5, 13, -50, 21.9, 31, 2], //R5
[ 6, 3, 15, -50, 5, 1.8, 21.9, 34, 2, 5, 4.4, 5, -55, 21.9, 31, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 21.9, 32.5, 2, 5, 3.9, 8, -55, 21.9, 31, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 21.9, 30, 2, 5, 4, 11.5, -55, 21.9, 33, 2], //R2
[ 5, 3.9, 8, -50, 5, 1.9, 22.1, 30, 2, 6, 4, 12, 30, 22.1, 33.5, 2], //R1
// low pro mil sculpt 3 row system
[ 6, 3, 18, -50, 5, 1.8, 8.8, 15, 2, 5, 4.4, 5, -55, 8.8, 15, 2], //R4
[ 5, 3.8, 8, -55, 5, 1.8, 8.5, 15, 2, 5, 4.2, 8, -55, 8.5, 15, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R2
[5.25, 3., 16, -55, 5, 1.8, 8.5, 15, 2, 5.25, 3.1, 16, -55, 8.5, 15, 2], //R3 deep
];
function FrontForward1(keyID) = dishParameters[keyID][0]; //
function FrontForward2(keyID) = dishParameters[keyID][1]; //
function FrontPitch1(keyID) = dishParameters[keyID][2]; //
function FrontPitch2(keyID) = dishParameters[keyID][3]; //
function DishDepth(keyID) = dishParameters[keyID][4]; //
function DishHeightDif(keyID) = dishParameters[keyID][5]; //
function FrontInitArc(keyID) = dishParameters[keyID][6];
function FrontFinArc(keyID) = dishParameters[keyID][7];
function FrontArcExpo(keyID) = dishParameters[keyID][8];
function BackForward1(keyID) = dishParameters[keyID][9]; //
function BackForward2(keyID) = dishParameters[keyID][10]; //
function BackPitch1(keyID) = dishParameters[keyID][11]; //
function BackPitch2(keyID) = dishParameters[keyID][12]; //
function BackInitArc(keyID) = dishParameters[keyID][13];
function BackFinArc(keyID) = dishParameters[keyID][14];
function BackArcExpo(keyID) = dishParameters[keyID][15];
function BottomWidth(keyID) = keyParameters[keyID][0]; //
function BottomLength(keyID) = keyParameters[keyID][1]; //
function TopWidthDiff(keyID) = keyParameters[keyID][2]; //
function TopLenDiff(keyID) = keyParameters[keyID][3]; //
function KeyHeight(keyID) = keyParameters[keyID][4]; //
function TopWidShift(keyID) = keyParameters[keyID][5];
function TopLenShift(keyID) = keyParameters[keyID][6];
function XAngleSkew(keyID) = keyParameters[keyID][7];
function YAngleSkew(keyID) = keyParameters[keyID][8];
function ZAngleSkew(keyID) = keyParameters[keyID][9];
function WidExponent(keyID) = keyParameters[keyID][10];
function LenExponent(keyID) = keyParameters[keyID][11];
function CapRound0i(keyID) = keyParameters[keyID][12];
function CapRound0f(keyID) = keyParameters[keyID][13];
function CapRound1i(keyID) = keyParameters[keyID][14];
function CapRound1f(keyID) = keyParameters[keyID][15];
function ChamExponent(keyID) = keyParameters[keyID][16];
function StemExponent(keyID) = keyParameters[keyID][17];
function FrontTrajectory(keyID) =
[
trajectory(forward = FrontForward1(keyID), pitch = FrontPitch1(keyID)), //more param available: yaw, roll, scale
trajectory(forward = FrontForward2(keyID), pitch = FrontPitch2(keyID)) //You can add more traj if you wish
];
function BackTrajectory (keyID) =
[
trajectory(forward = BackForward1(keyID), pitch = BackPitch1(keyID)),
trajectory(forward = BackForward2(keyID), pitch = BackPitch2(keyID)),
];
//------- function defining Dish Shapes
function ellipse(a, b, d = 0, rot1 = 0, rot2 = 360) = [for (t = [rot1:step:rot2]) [a*cos(t)+a, b*sin(t)*(1+d*cos(t))]]; //Centered at a apex to avoid inverted face
function DishShape (a,b,c,d) =
concat(
// [[c+a,b]],
ellipse(a, b, d = 0,rot1 = 90, rot2 = 270)
// [[c+a,-b]]
);
function oval_path(theta, phi, a, b, c, deform = 0) = [
a*cos(theta)*cos(phi), //x
c*sin(theta)*(1+deform*cos(theta)) , //
b*sin(phi),
];
path_trans2 = [for (t=[0:step:180]) translation(oval_path(t,0,10,15,2,0))*rotation([0,90,0])];
//--------------Function definng Cap
function CapTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*KeyHeight(keyID)) //Z shift
];
function InnerTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*(KeyHeight(keyID)-topthickness)) //Z shift
];
function CapRotation(t, keyID) =
[
((1-t)/layers*XAngleSkew(keyID)), //X shift
((1-t)/layers*YAngleSkew(keyID)), //Y shift
((1-t)/layers*ZAngleSkew(keyID)) //Z shift
];
function CapTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)) + (1-pow(t/layers, WidExponent(keyID)))*BottomWidth(keyID) ,
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)) + (1-pow(t/layers, LenExponent(keyID)))*BottomLength(keyID)
];
function CapRoundness(t, keyID) =
[
pow(t/layers, ChamExponent(keyID))*(CapRound0f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound0i(keyID),
pow(t/layers, ChamExponent(keyID))*(CapRound1f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound1i(keyID)
];
function CapRadius(t, keyID) = pow(t/layers, ChamExponent(keyID))*ChamfFinRad(keyID) + (1-pow(t/layers, ChamExponent(keyID)))*ChamfInitRad(keyID);
function InnerTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, WidExponent(keyID)))*(BottomWidth(keyID) -wallthickness*2),
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, LenExponent(keyID)))*(BottomLength(keyID)-wallthickness*2)
];
function StemTranslation(t, keyID) =
[
((1-t)/stemLayers*TopWidShift(keyID)), //X shift
((1-t)/stemLayers*TopLenShift(keyID)), //Y shift
stemCrossHeight+.1+StemBrimDep + (t/stemLayers*(KeyHeight(keyID)- topthickness - stemCrossHeight-.1 -StemBrimDep)) //Z shift
];
function StemRotation(t, keyID) =
[
((1-t)/stemLayers*XAngleSkew(keyID)), //X shift
((1-t)/stemLayers*YAngleSkew(keyID)), //Y shift
((1-t)/stemLayers*ZAngleSkew(keyID)) //Z shift
];
function StemTransform(t, keyID) =
[
pow(t/stemLayers, StemExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemWid - 2*slop),
pow(t/stemLayers, StemExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemLen - 2*slop)
];
function StemRadius(t, keyID) = pow(t/stemLayers,3)*3 + (1-pow(t/stemLayers, 3))*1;
//Stem Exponent
///----- KEY Builder Module
module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false, Dish = true, Stem = false, crossSection = true,Legends = false, homeDot = false, Stab = 0) {
//Set Parameters for dish shape
FrontPath = quantize_trajectories(FrontTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
BackPath = quantize_trajectories(BackTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
//Scaling initial and final dim tranformation by exponents
function FrontDishArc(t) = pow((t)/(len(FrontPath)),FrontArcExpo(keyID))*FrontFinArc(keyID) + (1-pow(t/(len(FrontPath)),FrontArcExpo(keyID)))*FrontInitArc(keyID);
function BackDishArc(t) = pow((t)/(len(FrontPath)),BackArcExpo(keyID))*BackFinArc(keyID) + (1-pow(t/(len(FrontPath)),BackArcExpo(keyID)))*BackInitArc(keyID);
FrontCurve = [ for(i=[0:len(FrontPath)-1]) transform(FrontPath[i], DishShape(DishDepth(keyID), FrontDishArc(i), 1, d = 0)) ];
BackCurve = [ for(i=[0:len(BackPath)-1]) transform(BackPath[i], DishShape(DishDepth(keyID), BackDishArc(i), 1, d = 0)) ];
//builds
difference(){
union(){
difference(){
skin([for (i=[0:layers-1]) transform(translation(CapTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(CapTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]); //outer shell
//Cut inner shell
if(Stem == true){
translate([0,0,-.001])skin([for (i=[0:layers-1]) transform(translation(InnerTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(InnerTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]);
}
}
if(Stem == true){
translate([0,0,StemBrimDep])cherry_stem(KeyHeight(keyID)-StemBrimDep, slop); // generate mx cherry stem, not compatible with box
if (Stab != 0){
translate([Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
translate([-Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
//TODO add binding support?
}
// translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), rounded_rectangle_profile(StemTransform(i, keyID),fn=fn,r=StemRadius(i, keyID)))]); //Transition Support for taller profile
}
//cut for fonts and extra pattern for light?
}
//Cuts
//Fonts
if(Legends == true){
#rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([-1,-5,KeyHeight(keyID)-2.5])linear_extrude(height = 1)text( text = "ver2", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
// #rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([0,-3.5,0])linear_extrude(height = 0.5)text( text = "Me", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
}
//Dish Shape
if(Dish == true){
if(visualizeDish == false){
translate([-TopWidShift(keyID),.00001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
} else {
#translate([-TopWidShift(keyID),.00001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)]) rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
#translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
}
}
if(crossSection == true) {
translate([0,-15,-.1])cube([15,30,15]);
}
}
//Homing dot
if(homeDot == true)translate([0,0,KeyHeight(keyID)-DishHeightDif(keyID)-.25])sphere(d = dotRadius);
}
//------------------stems
$fn = fn;
function outer_cherry_stem(slop) = [ stemWid - slop * 2, stemLen - slop * 2];
function outer_cherry_stabilizer_stem(slop) = [4.85 - slop * 2, 6.05 - slop * 2];
function outer_box_cherry_stem(slop) = [6 - slop, 6 - slop];
// .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],
];
module inside_cherry_cross(slop) {
// inside cross
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-0.005]) {
linear_extrude(height = stemCrossHeight) {
square(cherry_cross(slop, extra_vertical)[0], center=true);
square(cherry_cross(slop, extra_vertical)[1], center=true);
}
}
// Guides to assist insertion and mitigate first layer squishing
{
for (i = cherry_cross(slop, extra_vertical)) hull() {
linear_extrude(height = 0.01, center = false) offset(delta = 0.4) square(i, center=true);
translate([0, 0, 0.5]) linear_extrude(height = 0.01, center = false) square(i, center=true);
}
}
}
module cherry_stem(depth, slop) {
D1=.15;
D2=.05;
H1=3.5;
CrossDist = 1.75;
difference(){
// outside shape
linear_extrude(height = depth) {
offset(r=1){
square(outer_cherry_stem(slop) - [2,2], center=true);
}
}
rotate([0,0,stemRot])inside_cherry_cross(slop);
hull(){
translate([CrossDist,CrossDist-.1,0])cylinder(d1=D1, d2=D2, H1);
translate([-CrossDist,-CrossDist+.1,0])cylinder(d1=D1, d2=D2, H1);
}
hull(){
translate([-CrossDist,CrossDist-.1])cylinder(d1=D1, d2=D2, H1);
translate([CrossDist,-CrossDist+.1])cylinder(d1=D1, d2=D2, H1);
}
}
}
module choc_stem() {
translate([5.7/2,0,-3.4/2+2])difference(){
cube([1.25,3, 3.4], center= true);
translate([3.9,0,0])cylinder(d=7,3.4,center = true);
translate([-3.9,0,0])cylinder(d=7,3.4,center = true);
}
translate([-5.7/2,0,-3.4/2+2])difference(){
cube([1.25,3, 3.4], center= true);
translate([3.9,0,0])cylinder(d=7,3.4,center = true);
translate([-3.9,0,0])cylinder(d=7,3.4,center = true);
}
}
/// ----- helper functions
function rounded_rectangle_profile(size=[1,1],r=1,fn=32) = [
for (index = [0:fn-1])
let(a = index/fn*360)
r * [cos(a), sin(a)]
+ sign_x(index, fn) * [size[0]/2-r,0]
+ sign_y(index, fn) * [0,size[1]/2-r]
];
function elliptical_rectangle(a = [1,1], b =[1,1], fn=32) = [
for (index = [0:fn-1]) // section right
let(theta1 = -atan(a[1]/b[1])+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta1), a[1]*sin(theta1)]
+ [a[0]*cos(atan(b[0]/a[0])) , 0]
- [b[1]*cos(atan(a[1]/b[1])) , 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
- [0, b[0]*sin(atan(b[0]/a[0]))]
+ [0, a[1]*sin(atan(a[1]/b[1]))],
for(index = [0:fn-1]) // section left
let(theta2 = -atan(a[1]/b[1])+180+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta2), a[1]*sin(theta2)]
- [a[0]*cos(atan(b[0]/a[0])) , 0]
+ [b[1]*cos(atan(a[1]/b[1])) , 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + 180 + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
+ [0, b[0]*sin(atan(b[0]/a[0]))]
- [0, a[1]*sin(atan(a[1]/b[1]))]
]/2;
function sign_x(i,n) =
i < n/4 || i > n-n/4 ? 1 :
i > n/4 && i < n-n/4 ? -1 :
0;
function sign_y(i,n) =
i > 0 && i < n/2 ? 1 :
i > n/2 ? -1 :
0;

View file

@ -1,592 +0,0 @@
use <scad-utils/morphology.scad> //for cheaper minwoski
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <scad-utils/trajectory.scad>
use <scad-utils/trajectory_path.scad>
use <sweep.scad>
use <skin.scad>
// R3 1.25x 1.75x
// R4 1.25x 1.75
// R5 1.50x 2.25, 2.75
/*DES (Distorted Elliptical Saddle) Sculpted Profile for 6x3 and corne thumb
Version 2: Eliptical Rectangle
*/
//#square([18.16, 18.16], center = true);
//#square([36.3, 19.05], center = true);
mirror([0,0,0])keycap(keyID = 36, cutLen = 0, Stem =true, Dish = true, Stab = 0 , veisualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([-19,0,0])keycap(keyID = 3, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([19,0,0])mirror([0,0,0])keycap(keyID = 5, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([19*.5,19,0])mirror([1,0,0])keycap(keyID = 6, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//n translate([0,19, 0])keycap(keyID = 3, cutLen = 0, Stem =true, Dish = true, visualizeDish = true, crossSection = true, homeDot = false, Legends = false);
// translate([0,38, 0])mirror([0,1,0])keycap(keyID = 2, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = true, homeDot = false, Legends = false);
//Low Pro rows
//for(cap = [8:10]){
//translate([-38, 19*(cap-8), 0])keycap(keyID = cap, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = true,Legends = false);
//}
//for(cap = [70:72]){
//translate([-19, 19*(cap-70), 0])keycap(keyID = cap, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
//}
//translate([-19, 19*(3), 0])keycap(keyID = 6, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = true,Legends = false);
//
//for(cap = [64:68]){
//translate([0, 19*(cap-64), 0])keycap(keyID = cap, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
//}
//for(cap = [20:24]){
//translate([0, 19*(cap-20), 0])keycap(keyID = cap, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = true,Legends = false);
//}
//translate([19, 19*(2), 0])keycap(keyID = 25, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = true,Legends = false);
//////corne thumb
// translate([-15, -4, 0])rotate([0,0,30])keycap(keyID = 0, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([6, 0, 0])rotate([0,0,15])keycap(keyID = 4, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([26, 2.2, 0])rotate([0,0,0])keycap(keyID = 8, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//LOW pro
// translate([-15, -4, 0])rotate([0,0,30])keycap(keyID =3, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false);
// translate([6, 0, 0])rotate([0,0,15])keycap(keyID = 4, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false);
// translate([26, 2.2, 0])rotate([0,0,0])keycap(keyID = 5, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false);
//kyria Thumb
// translate([-39, 0, 0])rotate([0,0,30])translate([0,-19.5, 0])keycap(keyID = 10, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//// translate([-39, 0, 0])rotate([0,0,30])translate([0,-19.5, 0])keycap(keyID = 11, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//// translate([-39, 0, 0])rotate([0,0,30])translate([0, -1, 0])keycap(keyID = 12, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//// translate([-17, 0, 0])rotate([0,0,30])translate([0, 0, 0])keycap(keyID = 13, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([-17, 0, 0])rotate([0,0,30])translate([0,-8.5, 0])mirror([1,0,0])keycap(keyID = 14, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([-17, 0, 0])rotate([0,0,30])translate([0, 10, 0])mirror([1,0,0])keycap(keyID = 15, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([6, 0, 0])rotate([0,0,15])keycap(keyID = 16, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([26, 2.2, 0])rotate([0,0,0])keycap(keyID = 17, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//normie hipro
// for(Row = [0:4]){
// translate([0, 19*Row, 0])keycap(keyID = 29+Row, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
// }
//#translate([0,38,13])cube([18-5.7, 18-5.7,1],center = true);
//echo(len(keyParameters));
//Parameters
wallthickness = 1.25; // 1.5 for norm, 1.25 for cast master
topthickness = 2.75; // 3 for norm, 2.5 for cast master
stepsize = 50; //resolution of Trajectory
step = 2; //resolution of ellipes
fn = 32; //resolution of Rounded Rectangles: 60 for output
layers = 40; //resolution of vertical Sweep: 50 for output
dotRadius = 1.25; //home dot size
//---Stem param
slop = 0.40;
stemRot = 0;
stemWid = 7.2;
stemLen = 5.5;
stemCrossHeight = 4;
extra_vertical = 0.6;
StemBrimDep = 0.25;
stemLayers = 50; //resolution of stem to cap top transition
keyParameters = //keyParameters[KeyID][ParameterID]
[
// BotWid, BotLen, TWDif, TLDif, keyh, WSft, LSft XSkew, YSkew, ZSkew, WEx, LEx, CapR0i, CapR0f, CapR1i, CapR1f, CapREx, StemEx
//corne thumb high pro
[17.16, 26.66, 6, 7, 13, 0, 0, -13, 10, -5, 2, 2, 1, 4.85, 1, 3, 2, 2], //R5 0 Corne thumb
[17.16, 17.16, 4, 5, 14, 0, 0, -13, 5, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 corne thumb
[17.16, 17.16, 4, 6, 15, 0, 0, -13, 10, 15, 2, 2, 1, 5, 1, 2, 2, 2], //R5 corne thumb
//Low profile corne thumb
[17.16, 26.66, 6, 7, 9.0, 0, 0, -8, 10, -5, 2, 2, 1, 4.85, 1, 3, 2, 2], //T1R5 external rot 3
[17.16, 26.66, 6, 7, 9.0, 0, 0, -8, 10, -0, 2, 2, 1, 4.85, 1, 3, 2, 2], //T1R5 nuetral
[17.16, 26.66, 6, 7, 9.0, 0, 0, -8, 10, 5, 2, 2, 1, 4.85, 1, 3, 2, 2], //T1R5 internal rot Corne thumb
[17.16, 17.16, 4, 5, 10., 0, 0, -12, 5, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 corne thumb
[17.16, 17.16, 4, 6, 11, 0, 0, -12, 10, 15, 2, 2, 1, 5, 1, 2, 2, 2], //R5 corne thumb
//Column high sculpt 3 row system
[17.16, 17.16, 6.5, 6.5,10.55, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4 8
[17.16, 17.16, 6.5, 6.5, 8.75, 0, .5, 4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 9.75, 0, 0, -13, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[17.16, 17.16, 6.5, 6.5, 8.75, 0, 0, 4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 deepdish
//kyria Thumbs 13 ~ 19
[17.16, 35.56, 6, 7, 11, 0, 0, -8, 10, -5, 2, 2, 1, 4.85, 1, 3.5, 2, 2], //T0R1 2u
[17.16, 17.16, 6, 5, 11, -.5, 0, -9, 7, 10, 2, 2, 1, 5, 1, 3, 2, 2], //T0R1 1u
[17.16, 17.16, 6, 5, 13, -.5, 0, -9, 7, 5, 2, 2, 1, 5, 1, 3.5, 2, 2], //T0R2 1u
[17.16, 35.56, 6, 7, 11, 0, 0, -8, 10, -5, 2, 2, 1, 4.85, 1, 3.5, 2, 2], //T1R1 2u
[17.16, 17.16, 4, 6, 12, .5, 0, -13, -7, 10, 2, 2, 1, 5, 1, 2, 2, 2], //T1R1 1u
[17.16, 17.16, 6, 5, 15, -.5, 0, -9, -7, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //T1R2 1u
[17.16, 17.16, 4, 6, 13, .5, 0, -13, 10, 15, 2, 2, 1, 5, 1, 2, 2, 2], //T2R1
[17.16, 17.16, 4, 6, 13, 0, 0, -8, 10, 20, 2, 2, 1, 5, 1, 2, 2, 2], //T3R1
//normie hi-sculpt 4 row system 17~23
[17.16, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[17.16, 17.16, 6.5, 6.5, 9.5, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[17.16, 17.16, 6.5, 6.5, 8.5, 0, .5, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 10, 0, 0, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[17.16, 17.16, 6.5, 6.5, 14.0, 0, -.25, -14, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
[17.16, 17.16, 6.5, 6.5, 9, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home Deeper
//1.25u 25~30
[21.86, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[21.86, 17.16, 6.5, 6.5, 9.5, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[21.86, 17.16, 6.5, 6.5, 8.5, 0, .5, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[21.86, 17.16, 6.5, 6.5, 10, 0, 0, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[21.86, 17.16, 6.5, 6.5, 14.0, 0, -.25, -14, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//1.5u 31~36
[26.66, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[26.66, 17.16, 6.5, 6.5, 9.5, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[26.66, 17.16, 6.5, 6.5, 8.5, 0, .5, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[26.66, 17.16, 6.5, 6.5, 10, 0, 0, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[26.66, 17.16, 6.5, 6.5, 14.0, 0, -.25, -14, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//1.75u 37~42
[31.06, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[31.06, 17.16, 6.5, 6.5, 9.5, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[31.06, 17.16, 6.5, 6.5, 8.5, 0, .5, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[31.06, 17.16, 6.5, 6.5, 10, 0, 0, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[31.06, 17.16, 6.5, 6.5, 14.0, 0, -.25, -14, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//2.0u
[35.46, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[35.46, 17.16, 6.5, 6.5, 9.5, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[35.46, 17.16, 6.5, 6.5, 8.5, 0, .5, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[35.46, 17.16, 6.5, 6.5, 10, 0, 0, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[35.46, 17.16, 6.5, 6.5, 14.0, 0, -.25, -14, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//normie mild 4 row system
[17.16, 17.16, 6.5, 6.5, 9.3, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[17.16, 17.16, 6.5, 6.5, 8.8, 0, 0, 7, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[17.16, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 8.8, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[17.16, 17.16, 6.5, 6.5, 11.0, 0, -.25, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
[17.16, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home Deeper
//1.25u
[21.86, 17.16, 6.5, 6.5, 9.3, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[21.86, 17.16, 6.5, 6.5, 8.8, 0, 0, 7, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[21.86, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[21.86, 17.16, 6.5, 6.5, 8.8, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[21.86, 17.16, 6.5, 6.5, 11.0, 0, -.25, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//1.5u
[26.66, 17.16, 6.5, 6.5, 9.3, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[26.66, 17.16, 6.5, 6.5, 8.8, 0, 0, 7, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[26.66, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[26.66, 17.16, 6.5, 6.5, 8.8, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[26.66, 17.16, 6.5, 6.5, 11.0, 0, -.25, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//1.75u
[31.06, 17.16, 6.5, 6.5, 9.3, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[31.06, 17.16, 6.5, 6.5, 8.8, 0, 0, 7, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[31.06, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[31.06, 17.16, 6.5, 6.5, 8.8, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[31.06, 17.16, 6.5, 6.5, 11.0, 0, -.25, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//2.0u
[35.56, 17.16, 6.5, 6.5, 9.3, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[35.56, 17.16, 6.5, 6.5, 8.8, 0, 0, 7, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[35.56, 17.16, 6.5, 6.5, 8.0, 0, .5, 0.01, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[35.56, 17.16, 6.5, 6.5, 8.8, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[35.56, 17.16, 6.5, 6.5, 11.0, 0, -.25, -11, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//lowest profile
[17.16, 17.16, 6.5, 6.5, 7.25, 0, 0, 3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4 6
[17.16, 17.16, 6.5, 6.5, 7, 0, .5, .001, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 7.25, 0, -.25, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[17.16, 17.16, 6.5, 6.5, 7, 0, .5, .001, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 deepdish
];
dishParameters = //dishParameter[keyID][ParameterID]
[
//FFwd1 FFwd2 FPit1 FPit2 DshDep DshHDif FArcIn FArcFn FArcEx BFwd1 BFwd2 BPit1 BPit2 BArcIn BArcFn BArcEx
//higt corne thumb
[ 8, 4.5, 7, -39, 4, 1.8, 9.5, 15, 2, 10, 4, 8, -30, 9.5, 20, 2], //R5
[ 5, 4.3, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 13, -30, 10.5, 18, 2], //R5
[ 5, 4.3, 5, -48, 4, 1.9, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //R5
[ 8.5, 5.0, 7, -39, 4, 1.9, 9.5, 15, 2, 10, 4, 8, -30, 9.5, 20, 2], //R5
[ 8.3, 5.0, 7, -39, 4, 1.9, 9.5, 15, 2, 10, 4, 8, -30, 9.5, 20, 2], //R5
[ 8.5, 5.0, 7, -39, 4, 1.9, 9.5, 15, 2, 10, 4, 8, -30, 9.5, 20, 2], //R5
[ 5, 4.8, 5, -48, 5, 2.2, 10.5, 10, 2, 6, 4, 13, -30, 10.5, 18, 2], //R5
[ 5, 4.8, 5, -48, 4, 2.0, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //R5
// low pro 3 row system
[ 6, 3, 18, -50, 5, 1.8, 8.8, 15, 2, 5, 4.4, 5, -55, 8.8, 15, 2], //R4
[ 5, 3.5, 10, -55, 5, 1.8, 8.5, 15, 2, 5, 3.7, 10, -55, 8.5, 15, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R2
[ 4.8, 3.3, 18, -55, 5, 2.0, 8.5, 15, 2, 4.8, 3.3, 18, -55, 8.5, 15, 2], //R3 deep
//kyria
[ 13, 4.5, 7, -39, 4, 1.8, 9.5, 15, 2, 13, 4, 8, -30, 9.5, 20, 2], //T1R1 2u
[ 5, 4.4, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 2, -30, 10.5, 18, 2], //T0R1 1u
[ 5, 4.3, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 2, -30, 10.5, 18, 2], //T0R2 1u
[ 13, 4.5, 7, -39, 4, 1.8, 9.5, 15, 2, 13, 4, 8, -30, 9.5, 20, 2], //T1R1 2u
[ 5, 4.4, 5, -48, 4, 1.9, 11, 12, 2, 5.5, 3.5, 8, -50, 11, 28, 2], //T1R1 1u
[ 5, 4.3, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 2, -30, 10.5, 18, 2], //T1R2 1u
[ 5, 4.4, 5, -48, 4, 1.9, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //T2R1
[ 5, 4.4, 5, -48, 4, 1.9, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //T3R1
//heavy
[ 6, 3, -5, -50, 5, 1.8, 8.8, 15, 2, 6, 3.5, 13, -50, 8.8, 16, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 8.8, 15, 2, 5, 4.4, 5, -55, 8.8, 15, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 8.8, 15, 2, 5, 3.5, 8, -55, 8.8, 15, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 8.8, 15, 2, 5, 4, 12, -55, 8.8, 16, 2], //R2
[ 5, 3.5, 8, -50, 5, 1.9, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R1
[ 5.5, 2.8, 23, -50, 5, 1.8, 8.5, 15, 2, 5, 3.3, 13, -55, 8.5, 15, 2], //R3 deep
// 1.25
[ 6, 3, -5, -50, 5, 1.8, 12.4, 18, 2, 6, 3.5, 13, -50, 12.4, 19, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 12.4, 20, 2, 5, 4.4, 5, -55, 12.4, 19, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 12.4, 18, 2, 5, 3.7, 8, -55, 12.4, 19, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 12.4, 18, 2, 5, 4, 12, -55, 12.4, 19, 2], //R2
[ 5, 3.5, 8, -50, 5, 1.9, 12.5, 18, 2, 6, 4, 13, 30, 12.5, 19, 2], //R1
//1.5
[ 6, 3, -5, -50, 5, 1.8, 15.5, 22, 2, 6, 3.5, 13, -50, 15.5, 22, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 15.5, 27.2, 2, 5, 4.4, 5, -55, 15.5, 22, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 15.5, 22, 2, 5, 3.7, 8, -55, 15.5, 22, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 15.7, 22, 2, 5, 4, 12, -55, 15.7, 23, 2], //R2
[ 5, 3.5, 8, -50, 5, 1.9, 15.7, 22, 2, 6, 4, 13, 30, 15.7, 23.5, 2], //R1
//1.75
[ 6, 3, -5, -50, 5, 1.8, 18.7, 25, 2, 6, 3.5, 13, -50, 18.7, 25, 2], //R5
[ 6, 3, 17, -50, 5, 1.8, 18.7, 32, 2, 5, 4.4, 5, -55, 18.7, 25, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 18.7, 27, 2, 5, 3.8, 8, -55, 18.7, 25, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 18.7, 25, 2, 5, 4, 12, -55, 18.7, 28, 2], //R2
[ 5, 3.7, 8, -50, 5, 1.9, 18.8, 25, 2, 6, 4, 12, 30, 18.8, 28, 2], //R1
//2
[ 6, 3, -5, -50, 5, 1.8, 21.9, 30, 2, 6, 3.5, 13, -50, 21.9, 31, 2], //R5
[ 6, 3, 15, -50, 5, 1.8, 21.9, 34, 2, 5, 4.4, 5, -55, 21.9, 31, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 21.9, 32.5, 2, 5, 3.7, 8, -55, 21.9, 31, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 21.9, 30, 2, 5, 4, 11.5, -55, 21.9, 33, 2], //R2
[ 5, 3.7, 8, -50, 5, 1.9, 22.1, 30, 2, 6, 4, 12, 30, 22.1, 33.5, 2], //R1
//mild
[ 6, 3, -5, -35, 5, 1.8, 8.8, 15, 2, 6, 3.5, 13, -50, 8.8, 16, 2], //R5
[ 6, 3, 15, -55, 5, 1.8, 8.8, 15, 2, 5, 4.4, 5, -55, 8.8, 15, 2], //R4
[ 5, 3.5, 8, -55, 5, 1.8, 8.8, 15, 2, 5, 3.8, 8, -55, 8.8, 15, 2], //R3
[ 5, 4.4, 5, -55, 5, 1.8, 8.8, 15, 2, 6, 3, 15, -55, 8.8, 15, 2], //R2
[ 5, 3.5, 8, -50, 5, 1.8, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R1
[ 5, 3.3, 15, -55, 5, 1.8, 8.5, 15, 2, 5, 3.3, 15, -55, 8.5, 15, 2], //R3 deep
// 1.25
[ 6, 3, -5, -50, 5, 1.8, 12.4, 18, 2, 6, 3.5, 13, -50, 12.4, 19, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 12.4, 20, 2, 5, 4.6, 5, -55, 12.4, 19, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 12.4, 18, 2, 5, 3.9, 8, -55, 12.4, 19, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 12.4, 18, 2, 5, 4, 12, -55, 12.4, 19, 2], //R2
[ 5, 3.8, 8, -50, 5, 1.9, 12.5, 18, 2, 6, 4, 13, 30, 12.5, 19, 2], //R1
//1.5
[ 6, 3, -5, -50, 5, 1.8, 15.5, 22, 2, 6, 3.5, 13, -50, 15.5, 22, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 15.5, 27.2, 2, 5, 4.4, 5, -55, 15.5, 22, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 15.5, 22, 2, 5, 3.9, 8, -55, 15.5, 22, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 15.7, 22, 2, 5, 4, 12, -55, 15.7, 23, 2], //R2
[ 5, 3.9, 8, -50, 5, 1.9, 15.7, 22, 2, 6, 4, 13, 30, 15.7, 23.5, 2], //R1
//1.75
[ 6, 3.2, -5, -50, 5, 1.8, 18.7, 25, 2, 6, 3.5, 13, -50, 18.7, 25, 2], //R5
[ 6, 3, 17, -50, 5, 1.8, 18.7, 32, 2, 5, 4.4, 5, -55, 18.7, 25, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 18.7, 27, 2, 5, 3.9, 8, -55, 18.7, 25, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 18.7, 25, 2, 5, 4, 12, -55, 18.7, 28, 2], //R2
[ 5, 3.9, 8, -50, 5, 1.9, 18.8, 25, 2, 6, 4, 12, 30, 18.8, 28, 2], //R1
//2
[ 6, 3.1, -5, -50, 5, 1.8, 21.9, 30, 2, 6, 3.5, 13, -50, 21.9, 31, 2], //R5
[ 6, 3, 15, -50, 5, 1.8, 21.9, 34, 2, 5, 4.4, 5, -55, 21.9, 31, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 21.9, 32.5, 2, 5, 3.9, 8, -55, 21.9, 31, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 21.9, 30, 2, 5, 4, 11.5, -55, 21.9, 33, 2], //R2
[ 5, 3.9, 8, -50, 5, 1.9, 22.1, 30, 2, 6, 4, 12, 30, 22.1, 33.5, 2], //R1
// low pro mil sculpt 3 row system
[ 6, 3, 18, -50, 5, 1.8, 8.8, 15, 2, 5, 4.4, 5, -55, 8.8, 15, 2], //R4
[ 5, 3.8, 8, -55, 5, 1.8, 8.5, 15, 2, 5, 4.2, 8, -55, 8.5, 15, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R2
[5.25, 3., 16, -55, 5, 1.8, 8.5, 15, 2, 5.25, 3.1, 16, -55, 8.5, 15, 2], //R3 deep
];
function FrontForward1(keyID) = dishParameters[keyID][0]; //
function FrontForward2(keyID) = dishParameters[keyID][1]; //
function FrontPitch1(keyID) = dishParameters[keyID][2]; //
function FrontPitch2(keyID) = dishParameters[keyID][3]; //
function DishDepth(keyID) = dishParameters[keyID][4]; //
function DishHeightDif(keyID) = dishParameters[keyID][5]; //
function FrontInitArc(keyID) = dishParameters[keyID][6];
function FrontFinArc(keyID) = dishParameters[keyID][7];
function FrontArcExpo(keyID) = dishParameters[keyID][8];
function BackForward1(keyID) = dishParameters[keyID][9]; //
function BackForward2(keyID) = dishParameters[keyID][10]; //
function BackPitch1(keyID) = dishParameters[keyID][11]; //
function BackPitch2(keyID) = dishParameters[keyID][12]; //
function BackInitArc(keyID) = dishParameters[keyID][13];
function BackFinArc(keyID) = dishParameters[keyID][14];
function BackArcExpo(keyID) = dishParameters[keyID][15];
function BottomWidth(keyID) = keyParameters[keyID][0]; //
function BottomLength(keyID) = keyParameters[keyID][1]; //
function TopWidthDiff(keyID) = keyParameters[keyID][2]; //
function TopLenDiff(keyID) = keyParameters[keyID][3]; //
function KeyHeight(keyID) = keyParameters[keyID][4]; //
function TopWidShift(keyID) = keyParameters[keyID][5];
function TopLenShift(keyID) = keyParameters[keyID][6];
function XAngleSkew(keyID) = keyParameters[keyID][7];
function YAngleSkew(keyID) = keyParameters[keyID][8];
function ZAngleSkew(keyID) = keyParameters[keyID][9];
function WidExponent(keyID) = keyParameters[keyID][10];
function LenExponent(keyID) = keyParameters[keyID][11];
function CapRound0i(keyID) = keyParameters[keyID][12];
function CapRound0f(keyID) = keyParameters[keyID][13];
function CapRound1i(keyID) = keyParameters[keyID][14];
function CapRound1f(keyID) = keyParameters[keyID][15];
function ChamExponent(keyID) = keyParameters[keyID][16];
function StemExponent(keyID) = keyParameters[keyID][17];
function FrontTrajectory(keyID) =
[
trajectory(forward = FrontForward1(keyID), pitch = FrontPitch1(keyID)), //more param available: yaw, roll, scale
trajectory(forward = FrontForward2(keyID), pitch = FrontPitch2(keyID)) //You can add more traj if you wish
];
function BackTrajectory (keyID) =
[
trajectory(forward = BackForward1(keyID), pitch = BackPitch1(keyID)),
trajectory(forward = BackForward2(keyID), pitch = BackPitch2(keyID)),
];
//------- function defining Dish Shapes
function ellipse(a, b, d = 0, rot1 = 0, rot2 = 360) = [for (t = [rot1:step:rot2]) [a*cos(t)+a, b*sin(t)*(1+d*cos(t))]]; //Centered at a apex to avoid inverted face
function DishShape (a,b,c,d) =
concat(
// [[c+a,b]],
ellipse(a, b, d = 0,rot1 = 90, rot2 = 270)
// [[c+a,-b]]
);
function oval_path(theta, phi, a, b, c, deform = 0) = [
a*cos(theta)*cos(phi), //x
c*sin(theta)*(1+deform*cos(theta)) , //
b*sin(phi),
];
path_trans2 = [for (t=[0:step:180]) translation(oval_path(t,0,10,15,2,0))*rotation([0,90,0])];
//--------------Function definng Cap
function CapTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*KeyHeight(keyID)) //Z shift
];
function InnerTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*(KeyHeight(keyID)-topthickness)) //Z shift
];
function CapRotation(t, keyID) =
[
((1-t)/layers*XAngleSkew(keyID)), //X shift
((1-t)/layers*YAngleSkew(keyID)), //Y shift
((1-t)/layers*ZAngleSkew(keyID)) //Z shift
];
function CapTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)) + (1-pow(t/layers, WidExponent(keyID)))*BottomWidth(keyID) ,
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)) + (1-pow(t/layers, LenExponent(keyID)))*BottomLength(keyID)
];
function CapRoundness(t, keyID) =
[
pow(t/layers, ChamExponent(keyID))*(CapRound0f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound0i(keyID),
pow(t/layers, ChamExponent(keyID))*(CapRound1f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound1i(keyID)
];
function CapRadius(t, keyID) = pow(t/layers, ChamExponent(keyID))*ChamfFinRad(keyID) + (1-pow(t/layers, ChamExponent(keyID)))*ChamfInitRad(keyID);
function InnerTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, WidExponent(keyID)))*(BottomWidth(keyID) -wallthickness*2),
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, LenExponent(keyID)))*(BottomLength(keyID)-wallthickness*2)
];
function StemTranslation(t, keyID) =
[
((1-t)/stemLayers*TopWidShift(keyID)), //X shift
((1-t)/stemLayers*TopLenShift(keyID)), //Y shift
stemCrossHeight+.1+StemBrimDep + (t/stemLayers*(KeyHeight(keyID)- topthickness - stemCrossHeight-.1 -StemBrimDep)) //Z shift
];
function StemRotation(t, keyID) =
[
((1-t)/stemLayers*XAngleSkew(keyID)), //X shift
((1-t)/stemLayers*YAngleSkew(keyID)), //Y shift
((1-t)/stemLayers*ZAngleSkew(keyID)) //Z shift
];
function StemTransform(t, keyID) =
[
pow(t/stemLayers, StemExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemWid - 2*slop),
pow(t/stemLayers, StemExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemLen - 2*slop)
];
function StemRadius(t, keyID) = pow(t/stemLayers,3)*3 + (1-pow(t/stemLayers, 3))*1;
//Stem Exponent
///----- KEY Builder Module
module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false, Dish = true, Stem = false, crossSection = true,Legends = false, homeDot = false, Stab = 0) {
//Set Parameters for dish shape
FrontPath = quantize_trajectories(FrontTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
BackPath = quantize_trajectories(BackTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
//Scaling initial and final dim tranformation by exponents
function FrontDishArc(t) = pow((t)/(len(FrontPath)),FrontArcExpo(keyID))*FrontFinArc(keyID) + (1-pow(t/(len(FrontPath)),FrontArcExpo(keyID)))*FrontInitArc(keyID);
function BackDishArc(t) = pow((t)/(len(FrontPath)),BackArcExpo(keyID))*BackFinArc(keyID) + (1-pow(t/(len(FrontPath)),BackArcExpo(keyID)))*BackInitArc(keyID);
FrontCurve = [ for(i=[0:len(FrontPath)-1]) transform(FrontPath[i], DishShape(DishDepth(keyID), FrontDishArc(i), 1, d = 0)) ];
BackCurve = [ for(i=[0:len(BackPath)-1]) transform(BackPath[i], DishShape(DishDepth(keyID), BackDishArc(i), 1, d = 0)) ];
//builds
difference(){
union(){
difference(){
skin([for (i=[0:layers-1]) transform(translation(CapTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(CapTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]); //outer shell
//Cut inner shell
if(Stem == true){
translate([0,0,-.001])skin([for (i=[0:layers-1]) transform(translation(InnerTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(InnerTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]);
}
}
if(Stem == true){
translate([0,0,StemBrimDep])cherry_stem(KeyHeight(keyID)-StemBrimDep, slop); // generate mx cherry stem, not compatible with box
if (Stab != 0){
translate([Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
translate([-Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
//TODO add binding support?
}
// translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), rounded_rectangle_profile(StemTransform(i, keyID),fn=fn,r=StemRadius(i, keyID)))]); //Transition Support for taller profile
}
//cut for fonts and extra pattern for light?
}
//Cuts
//Fonts
if(Legends == true){
#rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([-1,-5,KeyHeight(keyID)-2.5])linear_extrude(height = 1)text( text = "ver2", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
// #rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([0,-3.5,0])linear_extrude(height = 0.5)text( text = "Me", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
}
//Dish Shape
if(Dish == true){
if(visualizeDish == false){
translate([-TopWidShift(keyID),.00001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
} else {
#translate([-TopWidShift(keyID),.00001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)]) rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
#translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
}
}
if(crossSection == true) {
translate([0,-15,-.1])cube([15,30,15]);
}
}
//Homing dot
if(homeDot == true)translate([0,0,KeyHeight(keyID)-DishHeightDif(keyID)-.25])sphere(d = dotRadius);
}
//------------------stems
$fn = fn;
function outer_cherry_stem(slop) = [ stemWid - slop * 2, stemLen - slop * 2];
function outer_cherry_stabilizer_stem(slop) = [4.85 - slop * 2, 6.05 - slop * 2];
function outer_box_cherry_stem(slop) = [6 - slop, 6 - slop];
// .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],
];
module inside_cherry_cross(slop) {
// inside cross
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-0.005]) {
linear_extrude(height = stemCrossHeight) {
square(cherry_cross(slop, extra_vertical)[0], center=true);
square(cherry_cross(slop, extra_vertical)[1], center=true);
}
}
// Guides to assist insertion and mitigate first layer squishing
{
for (i = cherry_cross(slop, extra_vertical)) hull() {
linear_extrude(height = 0.01, center = false) offset(delta = 0.4) square(i, center=true);
translate([0, 0, 0.5]) linear_extrude(height = 0.01, center = false) square(i, center=true);
}
}
}
module cherry_stem(depth, slop) {
D1=.15;
D2=.05;
H1=3.5;
CrossDist = 1.75;
difference(){
// outside shape
linear_extrude(height = depth) {
offset(r=1){
square(outer_cherry_stem(slop) - [2,2], center=true);
}
}
rotate([0,0,stemRot])inside_cherry_cross(slop);
hull(){
translate([CrossDist,CrossDist-.1,0])cylinder(d1=D1, d2=D2, H1);
translate([-CrossDist,-CrossDist+.1,0])cylinder(d1=D1, d2=D2, H1);
}
hull(){
translate([-CrossDist,CrossDist-.1])cylinder(d1=D1, d2=D2, H1);
translate([CrossDist,-CrossDist+.1])cylinder(d1=D1, d2=D2, H1);
}
}
}
module choc_stem() {
translate([5.7/2,0,-3.4/2+2])difference(){
cube([1.25,3, 3.4], center= true);
translate([3.9,0,0])cylinder(d=7,3.4,center = true);
translate([-3.9,0,0])cylinder(d=7,3.4,center = true);
}
translate([-5.7/2,0,-3.4/2+2])difference(){
cube([1.25,3, 3.4], center= true);
translate([3.9,0,0])cylinder(d=7,3.4,center = true);
translate([-3.9,0,0])cylinder(d=7,3.4,center = true);
}
}
/// ----- helper functions
function rounded_rectangle_profile(size=[1,1],r=1,fn=32) = [
for (index = [0:fn-1])
let(a = index/fn*360)
r * [cos(a), sin(a)]
+ sign_x(index, fn) * [size[0]/2-r,0]
+ sign_y(index, fn) * [0,size[1]/2-r]
];
function elliptical_rectangle(a = [1,1], b =[1,1], fn=32) = [
for (index = [0:fn-1]) // section right
let(theta1 = -atan(a[1]/b[1])+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta1), a[1]*sin(theta1)]
+ [a[0]*cos(atan(b[0]/a[0])) , 0]
- [b[1]*cos(atan(a[1]/b[1])) , 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
- [0, b[0]*sin(atan(b[0]/a[0]))]
+ [0, a[1]*sin(atan(a[1]/b[1]))],
for(index = [0:fn-1]) // section left
let(theta2 = -atan(a[1]/b[1])+180+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta2), a[1]*sin(theta2)]
- [a[0]*cos(atan(b[0]/a[0])) , 0]
+ [b[1]*cos(atan(a[1]/b[1])) , 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + 180 + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
+ [0, b[0]*sin(atan(b[0]/a[0]))]
- [0, a[1]*sin(atan(a[1]/b[1]))]
]/2;
function sign_x(i,n) =
i < n/4 || i > n-n/4 ? 1 :
i > n/4 && i < n-n/4 ? -1 :
0;
function sign_y(i,n) =
i > 0 && i < n/2 ? 1 :
i > n/2 ? -1 :
0;

View file

@ -1,392 +0,0 @@
use <scad-utils/morphology.scad> //for cheaper minwoski
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <scad-utils/trajectory.scad>
use <scad-utils/trajectory_path.scad>
use <sweep.scad>
use <skin.scad>
/*DES (Distorted Elliptical Saddle) Sculpted Profile for 6x3 and corne thumb
Version 2: Eliptical Rectangle
*/
//#square([18.16, 18.16], center = true);
//TODO add shift
mirror([0,0,0])keycap(keyID = 0, cutLen = 0, Stem =true, Dish = false, Stab = 0 , visualizeDish = true, crossSection = false, homeDot = false, Legends = false);
//#translate([0,0,0])cube([14.5, 13.5, 10], center = true); // internal check
//#translate([0,0,0])cube([17.5, 16.5, 10], center = true); // external check
//n translate([0,19, 0])keycap(keyID = 3, cutLen = 0, Stem =true, Dish = true, visualizeDish = true, crossSection = true, homeDot = false, Legends = false);
// translate([0,38, 0])mirror([0,1,0])keycap(keyID = 2, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = true, homeDot = false, Legends = false);
RowHome = [0,2.5,5,2.5,0,0];
//for(Col = [6:6]){
// for(Row = [1:3]){
// translate([19*Col, 19*Row +RowHome[Col], 0])keycap(keyID = Col*4+Row, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
// }
//}
//#translate([0,38,13])cube([18-5.7, 18-5.7,1],center = true);
//Parameters
wallthickness = 1.2;
topthickness = 3; //
stepsize = 50; //resolution of Trajectory
step = 1; //resolution of ellipes
fn = 32; //resolution of Rounded Rectangles: 60 for output
layers = 40; //resolution of vertical Sweep: 50 for output
dotRadius = 1.25; //home dot size
//---Stem param
slop = 0.25;
stemRot = 0;
stemWid = 8;
stemLen = 6;
stemCrossHeight = 1.8;
extra_vertical = 0.6;
StemBrimDep = 0;
stemLayers = 50; //resolution of stem to cap top transition
driftAngle = 0;
keyParameters = //keyParameters[KeyID][ParameterID]
[
// BotWid, BotLen, TWDif, TLDif, keyh, WSft, LSft XSkew, YSkew, ZSkew, WEx, LEx, CapR0i, CapR0f, CapR1i, CapR1f, CapREx, StemEx
//normie hipro
[17.16, 17.16, 3, 3, 5, 0, 0, 0, 0, 0, 2, 2, .1, 5, .1, 3.5, 2, 2], //R5
[17.16*2,17.16, 6.5, 6.5, 5.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 2u ver 1
[17.16*2,17.16, 6.5, 6.5, 5.5, 0, 0, -0, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4 2u ver 1
[17.16*2,17.16, 6.5, 6.5, 5.5, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 2u ver 1
[16.80, 15.80, 7, 4, 5.5, 0, .0, 5, -0, -0, 2, 3, .75, 1, .75, 4, 2, 2],
[16.80, 15.80, 7, 4, 5.5, 0, .0, 5, -0, -0, 2, 3, .75, 1, .75, 4, 2, 2],
[17.16, 17.16, 6.5, 6.5, 14.0, 0, 0, -14, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
];
dishParameters = //dishParameter[keyID][ParameterID]
[
//FFwd1 FFwd2 FPit1 FPit2 DshDepi DishDepf,DshHDif FArcIn FArcFn FArcEx BFwd1 BFwd2 BPit1 BPit2 BArcIn BArcFn BArcEx
[ 3, 3, -10, -50, 3, 7, 8.2, 9, 2, 5, 3, 0, -30, 8.2, 9, 2], //R5
[ 4, 4.2, -5, -15, 1, 3, 18.2, 21, 2, 5, 3, 0, -30, 18.2, 21, 2], //R5 2u
[ 4, 4.2, -5, -15, 1, 3, 18.2, 21, 2, 4, 4.2, -5, -15, 18.2, 21, 2], //R4 2u
[ 4, 4.2, -5, -15, 1, 3, 18.2, 21, 2, 5, 3, -5, -15, 18.2, 21, 2], //R3 2u
[ 4., 1.5, 8, -55, 3, 7, 9.0, 9, 2, 4, 3, 3, -50, 9, 9, 2], //R3
[ 4., 1.5, -0, -50, 3, 7, 9.0, 9, 2, 4, 3, -10, -50, 9, 9, 2], //R3
[ 5, 3.5, 8, -50, 5, 1.8, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R1
];
function FrontForward1(keyID) = dishParameters[keyID][0]; //
function FrontForward2(keyID) = dishParameters[keyID][1]; //
function FrontPitch1(keyID) = dishParameters[keyID][2]; //
function FrontPitch2(keyID) = dishParameters[keyID][3]; //
function DishDepth(keyID) = dishParameters[keyID][4]; //
function DishHeightDif(keyID) = dishParameters[keyID][5]; //
function FrontInitArc(keyID) = dishParameters[keyID][6];
function FrontFinArc(keyID) = dishParameters[keyID][7];
function FrontArcExpo(keyID) = dishParameters[keyID][8];
function BackForward1(keyID) = dishParameters[keyID][9]; //
function BackForward2(keyID) = dishParameters[keyID][10]; //
function BackPitch1(keyID) = dishParameters[keyID][11]; //
function BackPitch2(keyID) = dishParameters[keyID][12]; //
function BackInitArc(keyID) = dishParameters[keyID][13];
function BackFinArc(keyID) = dishParameters[keyID][14];
function BackArcExpo(keyID) = dishParameters[keyID][15];
function BottomWidth(keyID) = keyParameters[keyID][0]; //
function BottomLength(keyID) = keyParameters[keyID][1]; //
function TopWidthDiff(keyID) = keyParameters[keyID][2]; //
function TopLenDiff(keyID) = keyParameters[keyID][3]; //
function KeyHeight(keyID) = keyParameters[keyID][4]; //
function TopWidShift(keyID) = keyParameters[keyID][5];
function TopLenShift(keyID) = keyParameters[keyID][6];
function XAngleSkew(keyID) = keyParameters[keyID][7];
function YAngleSkew(keyID) = keyParameters[keyID][8];
function ZAngleSkew(keyID) = keyParameters[keyID][9];
function WidExponent(keyID) = keyParameters[keyID][10];
function LenExponent(keyID) = keyParameters[keyID][11];
function CapRound0i(keyID) = keyParameters[keyID][12];
function CapRound0f(keyID) = keyParameters[keyID][13];
function CapRound1i(keyID) = keyParameters[keyID][14];
function CapRound1f(keyID) = keyParameters[keyID][15];
function ChamExponent(keyID) = keyParameters[keyID][16];
function StemExponent(keyID) = keyParameters[keyID][17];
function FrontTrajectory(keyID) =
[
trajectory(forward = FrontForward1(keyID), pitch = FrontPitch1(keyID)), //more param available: yaw, roll, scale
trajectory(forward = FrontForward2(keyID), pitch = FrontPitch2(keyID)) //You can add more traj if you wish
];
function BackTrajectory (keyID) =
[
trajectory(forward = BackForward1(keyID), pitch = BackPitch1(keyID)),
trajectory(forward = BackForward2(keyID), pitch = BackPitch2(keyID)),
];
//------- function defining Dish Shapes
function ellipse(a, b, d = 0, rot1 = 0, rot2 = 360) = [for (t = [rot1:step:rot2]) [a*cos(t)+a, b*sin(t)*(1+d*cos(t))]]; //Centered at a apex to avoid inverted face
function DishShape (a,b,c,d) =
concat(
[[c+a,-b]],
ellipse(a, b, d = 0,rot1 = 270, rot2 =450),
[[c+a,b]]
);
function oval_path(theta, phi, a, b, c, deform = 0) = [
a*cos(theta)*cos(phi), //x
c*sin(theta)*(1+deform*cos(theta)) , //
b*sin(phi),
];
path_trans2 = [for (t=[0:step:180]) translation(oval_path(t,0,10,15,2,0))*rotation([0,90,0])];
//--------------Function definng Cap
function CapTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*KeyHeight(keyID)) //Z shift
];
function InnerTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*(KeyHeight(keyID)-topthickness)) //Z shift
];
function CapRotation(t, keyID) =
[
((1-t)/layers*XAngleSkew(keyID)), //X shift
((1-t)/layers*YAngleSkew(keyID)), //Y shift
((1-t)/layers*ZAngleSkew(keyID)) //Z shift
];
function CapTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)) + (1-pow(t/layers, WidExponent(keyID)))*BottomWidth(keyID) ,
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)) + (1-pow(t/layers, LenExponent(keyID)))*BottomLength(keyID)
];
function CapRoundness(t, keyID) =
[
pow(t/layers, ChamExponent(keyID))*(CapRound0f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound0i(keyID),
pow(t/layers, ChamExponent(keyID))*(CapRound1f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound1i(keyID)
];
function CapRadius(t, keyID) = pow(t/layers, ChamExponent(keyID))*ChamfFinRad(keyID) + (1-pow(t/layers, ChamExponent(keyID)))*ChamfInitRad(keyID);
function InnerTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, WidExponent(keyID)))*(BottomWidth(keyID) -wallthickness*2),
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, LenExponent(keyID)))*(BottomLength(keyID)-wallthickness*2)
];
function StemTranslation(t, keyID) =
[
((1-t)/stemLayers*TopWidShift(keyID)), //X shift
((1-t)/stemLayers*TopLenShift(keyID)), //Y shift
stemCrossHeight+.1 + (t/stemLayers*(KeyHeight(keyID)- topthickness - stemCrossHeight-.1)) //Z shift
];
function StemRotation(t, keyID) =
[
((1-t)/stemLayers*XAngleSkew(keyID)), //X shift
((1-t)/stemLayers*YAngleSkew(keyID)), //Y shift
((1-t)/stemLayers*ZAngleSkew(keyID)) //Z shift
];
function StemTransform(t, keyID) =
[
pow(t/stemLayers, StemExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemWid - 2*slop),
pow(t/stemLayers, StemExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemLen - 2*slop)
];
function StemRadius(t, keyID) = pow(t/stemLayers,3)*3 + (1-pow(t/stemLayers, 3))*1;
//Stem Exponent
///----- KEY Builder Module
module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false, Dish = true, Stem = false, homeDot = false, Stab = 0) {
//Set Parameters for dish shape
FrontPath = quantize_trajectories(FrontTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
BackPath = quantize_trajectories(BackTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
//Scaling initial and final dim tranformation by exponents
function FrontDishArc(t) = pow((t)/(len(FrontPath)),FrontArcExpo(keyID))*FrontFinArc(keyID) + (1-pow(t/(len(FrontPath)),FrontArcExpo(keyID)))*FrontInitArc(keyID);
function BackDishArc(t) = pow((t)/(len(FrontPath)),BackArcExpo(keyID))*BackFinArc(keyID) + (1-pow(t/(len(FrontPath)),BackArcExpo(keyID)))*BackInitArc(keyID);
FrontCurve = [ for(i=[0:len(FrontPath)-1]) transform(FrontPath[i], DishShape(DishDepth(keyID), FrontDishArc(i), DishDepth(keyID)+1.5, d = 0)) ];
BackCurve = [ for(i=[0:len(BackPath)-1]) transform(BackPath[i], DishShape(DishDepth(keyID), BackDishArc(i), DishDepth(keyID)+1.5, d = 0)) ];
//builds
difference(){
union(){
difference(){
skin([for (i=[0:layers-1]) transform(translation(CapTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(CapTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]); //outer shell
//Cut inner shell
if(Stem == true){
translate([0,0,-.001])skin([for (i=[0:layers-1]) transform(translation(InnerTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(InnerTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]);
}
}
if(Stem == true){
translate([0,0,StemBrimDep])rotate([0,0,stemRot])choc_stem(); // generate mx cherry stem, not compatible with box
if (Stab != 0){
translate([Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
translate([-Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
//TODO add binding support?
}
#translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), rounded_rectangle_profile(StemTransform(i, keyID),fn=fn,r=StemRadius(i, keyID)))]); //Transition Support for taller profile
}
//cut for fonts and extra pattern for light?
}
//Cuts
//Fonts
if(Legends == true){
#rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([-1,-5,KeyHeight(keyID)-2.5])linear_extrude(height = 1)text( text = "ver2", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
// #rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([0,-3.5,0])linear_extrude(height = 0.5)text( text = "Me", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
}
//Dish Shape
if(Dish == true){
if(visualizeDish == false){
translate([-TopWidShift(keyID),.00001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
} else {
#translate([-TopWidShift(keyID),.00001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)]) rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
#translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
}
}
if(crossSection == true) {
translate([0,-15,-.1])cube([15,30,15]);
}
}
//Homing dot
if(homeDot == true)translate([0,0,KeyHeight(keyID)-DishHeightDif(keyID)-.25])sphere(d = dotRadius);
}
//------------------stems
$fn = fn;
function outer_cherry_stem(slop) = [ stemWid - slop * 2, stemLen - slop * 2];
function outer_cherry_stabilizer_stem(slop) = [4.85 - slop * 2, 6.05 - slop * 2];
function outer_box_cherry_stem(slop) = [6 - slop, 6 - slop];
// .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],
];
module inside_cherry_cross(slop) {
// inside cross
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-0.005]) {
linear_extrude(height = stemCrossHeight) {
square(cherry_cross(slop, extra_vertical)[0], center=true);
square(cherry_cross(slop, extra_vertical)[1], center=true);
}
}
// Guides to assist insertion and mitigate first layer squishing
{
for (i = cherry_cross(slop, extra_vertical)) hull() {
linear_extrude(height = 0.01, center = false) offset(delta = 0.4) square(i, center=true);
translate([0, 0, 0.5]) linear_extrude(height = 0.01, center = false) square(i, center=true);
}
}
}
module cherry_stem(depth, slop) {
D1=.15;
D2=.05;
H1=3.5;
CrossDist = 1.75;
difference(){
// outside shape
linear_extrude(height = depth) {
offset(r=1){
square(outer_cherry_stem(slop) - [2,2], center=true);
}
}
inside_cherry_cross(slop);
hull(){
translate([CrossDist,CrossDist-.1,0])cylinder(d1=D1, d2=D2, H1);
translate([-CrossDist,-CrossDist+.1,0])cylinder(d1=D1, d2=D2, H1);
}
hull(){
translate([-CrossDist,CrossDist-.1])cylinder(d1=D1, d2=D2, H1);
translate([CrossDist,-CrossDist+.1])cylinder(d1=D1, d2=D2, H1);
}
}
}
module choc_stem(draftAng = 2) {
stemHeinght = 3.1;
module Stem() {
difference(){
hull(){
translate([0,0,-stemHeinght/2])cube([1.25-sin(draftAng)*stemHeinght,3-sin(draftAng)*stemHeinght,.001], center= true);
translate([0,0,stemHeinght/2])cube([1.25,3,.001], center= true);
}
//cuts
translate([3.9,0])cylinder(d1=7+sin(draftAng)*stemHeinght, d2=7,3.5, center = true);
translate([-3.9,0])cylinder(d1=7+sin(draftAng)*stemHeinght,d2=7,3.5, center = true);
}
}
translate([5.7/2,0,-stemHeinght/2+2])Stem();
translate([-5.7/2,0,-stemHeinght/2+2])Stem();
}
/// ----- helper functions
function rounded_rectangle_profile(size=[1,1],r=1,fn=32) = [
for (index = [0:fn-1])
let(a = index/fn*360)
r * [cos(a), sin(a)]
+ sign_x(index, fn) * [size[0]/2-r,0]
+ sign_y(index, fn) * [0,size[1]/2-r]
];
function elliptical_rectangle(a = [1,1], b =[1,1], fn=32) = [
for (index = [0:fn-1]) // section right
let(theta1 = -atan(a[1]/b[1])+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta1), a[1]*sin(theta1)]
+ [a[0]*cos(atan(b[0]/a[0])) , 0]
- [b[1]*cos(atan(a[1]/b[1])) , 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
- [0, b[0]*sin(atan(b[0]/a[0]))]
+ [0, a[1]*sin(atan(a[1]/b[1]))],
for(index = [0:fn-1]) // section left
let(theta2 = -atan(a[1]/b[1])+180+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta2), a[1]*sin(theta2)]
- [a[0]*cos(atan(b[0]/a[0])) , 0]
+ [b[1]*cos(atan(a[1]/b[1])) , 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + 180 + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
+ [0, b[0]*sin(atan(b[0]/a[0]))]
- [0, a[1]*sin(atan(a[1]/b[1]))]
]/2;
function sign_x(i,n) =
i < n/4 || i > n-n/4 ? 1 :
i > n/4 && i < n-n/4 ? -1 :
0;
function sign_y(i,n) =
i > 0 && i < n/2 ? 1 :
i > n/2 ? -1 :
0;

407
Knob.scad
View file

@ -1,407 +0,0 @@
use <scad-utils/morphology.scad> //for cheaper minwoski
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <scad-utils/trajectory.scad>
use <scad-utils/trajectory_path.scad>
use <sweep.scad>
use <skin.scad>
//DP (Distored Pyramidal) [Double Penetration] Profile
//TODO add shift
difference(){
union(){
difference(){
translate([0, 0, 0])keycap(keyID = 0, cutLen = 0, knull = true, Dish = true, visualizeDish = true, crossSection = false, homeDot = false);
#translate([0, 0, 7.5])rotate([0, 180, 0])keycap(keyID = 2, cutLen = 0, Stem =false, Dish = false, visualizeDish = true, crossSection = false, homeDot = false, Legends = false);
}
rotate([180, 0, 0])keycap(keyID = 1, cutLen = 0, knull = true, Dish = false, visualizeDish = true, crossSection = false, homeDot = false, Legends = false);
}
translate([0,0,-4.5])
intersection(){
cylinder(d = stemR, 10);
translate([0,stemR-stemSlot,5])cube([stemR, stemR, 10],center = true);
}
#translate([0,0,-7])cylinder(d = 12, 2.5);
translate([0,0,-2]) rotate([90,0,0])cylinder(d = 4, 10);
}
//translate([0, 0, 5.5])keycap(keyID = 3, cutLen = 0, Stem =false, Dish = false, visualizeDish = true, crossSection = false, homeDot = false, Legends = false);
////fullsetee
RowHome = [0,2.5,5,2.5,0,0];
//Parameters
wallthickness = 1.95;
topthickness = 2.5;
stepsize = 50; //resolution of Trajectory
step = 30; //resolution of ellipes
fn = 32; //resolution of Rounded Rectangles: 60 for output
layers = 50; //resolution of vertical Sweep: 50 for output
knullNum = 24;
//---Stem param
slop = 0.3;
stemRot = 0;
stemWid = 7.2;
stemLen = 5.5;
stemCrossHeight = 4;
extra_vertical = 0.6;
StemBrimDep = 0;
stemLayers = 50; //resolution of stem to cap top transition
dishLayers = 30;
stemR = 6.2;
stemSlot = 4.6;
keyParameters = //keyParameters[KeyID][ParameterID]
[
// BotWid, BotLen, TWDif, TLDif, keyh, WSft, LSft XSkew, YSkew, ZSkew, WEx, LEx, CapR0i, CapR0f, CapR1i, CapR1f, CapREx, StemEx
//Column 0
[10, 17.16, 1.6, 5.5, 5, 0, 0, 0, 0, 30, 2, 2, .25, .25, .5, .5, 2, 2], //R4
[10, 17.16, 3, 5.5, 7, 0, 0, 0, 0, 30, 2, 2, .25, .25, .5, .5, 2, 2], //R3
[3.8, 17.16, 3.6, 5.5, 1, 0, 0, 0, 0, -0, 3, 2, 1, 3.399, 1, 5, 2, 2], //R2 Home
[4.4, 17.16, 1, 5.5, 3, 0, 0, 0, 0, -0, 3, 2, 1, 3.399, 1, 5, 2, 2], //R1
];
function BottomWidth(keyID) = keyParameters[keyID][0]; //
function BottomLength(keyID) = keyParameters[keyID][1]; //
function TopWidthDiff(keyID) = keyParameters[keyID][2]; //
function TopLenDiff(keyID) = keyParameters[keyID][3]; //
function KeyHeight(keyID) = keyParameters[keyID][4]; //
function TopWidShift(keyID) = keyParameters[keyID][5];
function TopLenShift(keyID) = keyParameters[keyID][6];
function XAngleSkew(keyID) = keyParameters[keyID][7];
function YAngleSkew(keyID) = keyParameters[keyID][8];
function ZAngleSkew(keyID) = keyParameters[keyID][9];
function WidExponent(keyID) = keyParameters[keyID][10];
function LenExponent(keyID) = keyParameters[keyID][11];
function KnullRound0i(keyID) = keyParameters[keyID][12];
function KnullRound0f(keyID) = keyParameters[keyID][13];
function KnullRound1i(keyID) = keyParameters[keyID][14];
function KnullRound1f(keyID) = keyParameters[keyID][15];
function ChamExponent(keyID) = keyParameters[keyID][16];
function StemExponent(keyID) = keyParameters[keyID][17];
dishParameters = //dishParameter[keyID][ParameterID]
[
// EdOf fn LEx WEx DshDep Ch0i, ch1i, Ch0f, Ch1f, DishExp
//Column 0
[ 1, 4, 0, 2, 2.5, .5, 1, .25, .5, 2], //R4
[ 1, 2, 0, 2, 1.0, 3.399, .25, 2, 2, 2], //R3
[ 1, 1, 0, .9, 1.0, 3.399, 5, .001, .001, 1.5], //R2
[ 1, .005, 3, 3, 2.0, 3.399, 5, .001, .001, 1.5], //R1
];
function EdgeOffset(keyID) = dishParameters[keyID][0]; //
function LenFinal(keyID) = dishParameters[keyID][1]; //
function LenExpo(keyID) = dishParameters[keyID][2]; //
function WidExpo(keyID) = dishParameters[keyID][3]; //
function DishDepth(keyID) = dishParameters[keyID][4]; //
function DishCham0i(keyID) = dishParameters[keyID][5]; //
function DishCham1i(keyID) = dishParameters[keyID][6]; //
function DishCham0f(keyID) = dishParameters[keyID][7]; //
function DishCham1f(keyID) = dishParameters[keyID][8]; //
function DishExpo(keyID) = dishParameters[keyID][9];
//function FrontTrajectory(keyID) =
// [
// trajectory(forward = FrontForward1(keyID), pitch = FrontPitch1(keyID)), //more param available: yaw, roll, scale
// trajectory(forward = FrontForward2(keyID), pitch = FrontPitch2(keyID)) //You can add more traj if you wish
// ];
//
//function BackTrajectory (keyID) =
// [
// trajectory(forward = BackForward1(keyID), pitch = BackPitch1(keyID)),
// trajectory(forward = BackForward2(keyID), pitch = BackPitch2(keyID)),
// ];
//------- function defining Dish Shapes
function ellipse(a, b, d = 0, rot1 = 0, rot2 = 360) = [for (t = [rot1:step:rot2]) [a*cos(t)+a, b*sin(t)*(1+d*cos(t))]]; //Centered at a apex to avoid inverted face
function DishShape (a,b,c,d) =
concat(
// [[c+a,b]],
ellipse(a, b, d = 0,rot1 = 90, rot2 = 270)
// [[c+a,-b]]
);
function oval_path(theta, phi, a, b, c, deform = 0) = [
a*cos(theta)*cos(phi), //x
c*sin(theta)*(1+deform*cos(theta)) , //
b*sin(phi),
];
path_trans2 = [for (t=[0:step:180]) translation(oval_path(t,0,10,15,2,0))*rotation([0,90,0])];
//--------------Function definng Cap
function CapTranslation(t, keyID) =
[
((t)/layers*TopWidShift(keyID)), //X shift
((t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*KeyHeight(keyID)) //Z shift
];
function InnerTranslation(t, keyID) =
[
((t)/layers*TopWidShift(keyID)), //X shift
((t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*(KeyHeight(keyID)-topthickness)) //Z shift
];
function CapRotation(t, keyID) =
[
((t)/layers*XAngleSkew(keyID)), //X shift
((t)/layers*YAngleSkew(keyID)), //Y shift
((t)/layers*ZAngleSkew(keyID)) //Z shift
];
function CapTransform(t, keyID) =
// [
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)) + (1-pow(t/layers, WidExponent(keyID)))*BottomWidth(keyID);
// pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)) + (1-pow(t/layers, LenExponent(keyID)))*BottomLength(keyID)
// ];
function CapRoundness(t, keyID) =
[
pow(t/layers, ChamExponent(keyID))*(CapRound0f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound0i(keyID),
pow(t/layers, ChamExponent(keyID))*(CapRound1f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound1i(keyID)
];
function KnullTranslation(t, keyID) =
[
cos((t)/layers*ZAngleSkew(keyID))*(pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)) + (1-pow(t/layers, WidExponent(keyID)))*BottomWidth(keyID)),
sin((t)/layers*ZAngleSkew(keyID))*(pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)) + (1-pow(t/layers, WidExponent(keyID)))*BottomWidth(keyID)),
(t/layers*KeyHeight(keyID)) //Z shift
];
function KnullRotation(t, keyID) =
[
((t)/layers*XAngleSkew(keyID)), //X shift
((t)/layers*YAngleSkew(keyID)), //Y shift
((t)/layers*ZAngleSkew(keyID)) //Z shift
];
function KnullTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(KnullRound0i(keyID)) + (1-pow(t/layers, WidExponent(keyID)))*KnullRound0f(keyID),
pow(t/layers, LenExponent(keyID))*(KnullRound1i(keyID)) + (1-pow(t/layers, LenExponent(keyID)))*KnullRound1f(keyID)
];
//function InnerTransform(t, keyID) =
// [
// pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, WidExponent(keyID)))*(BottomWidth(keyID) -wallthickness*2),
// pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, LenExponent(keyID)))*(BottomLength(keyID)-wallthickness*2)
// ];
function StemTranslation(t, keyID) =
[
((t)/stemLayers*TopWidShift(keyID)), //X shift
((t)/stemLayers*TopLenShift(keyID)), //Y shift
stemCrossHeight+.1+StemBrimDep + (t/stemLayers*(KeyHeight(keyID)- topthickness - stemCrossHeight-.1 -StemBrimDep)) //Z shift
];
function StemRotation(t, keyID) =
[
((t)/stemLayers*XAngleSkew(keyID)), //X shift
((t)/stemLayers*YAngleSkew(keyID)), //Y shift
((t)/stemLayers*ZAngleSkew(keyID)) //Z shift
];
function StemTransform(t, keyID) =
[
pow(t/stemLayers, StemExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)-wallthickness) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemWid - 2*slop),
pow(t/stemLayers, StemExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemLen - 2*slop)
];
function StemRadius(t, keyID) = pow(t/stemLayers,3)*3 + (1-pow(t/stemLayers, 3))*1;
//----- Distorted Pyramidal Dish
function DishTranslation(t, keyID) =
[
((t)/dishLayers*TopWidShift(keyID)), //X shift
((t)/dishLayers*TopLenShift(keyID)), //Y shift
KeyHeight(keyID)+DishDepth(keyID)-(t)/dishLayers*(DishDepth(keyID)) //Z shift
];
function DishRotation(t, keyID) =
[
(-XAngleSkew(keyID)), //X shift
(-YAngleSkew(keyID)), //Y shift
2*(ZAngleSkew(keyID))-((t)/dishLayers*ZAngleSkew(keyID)) //Z shift
];
function DishTransform(t, keyID) =
(BottomWidth(keyID) -TopWidthDiff(keyID)) - (1-pow(t/dishLayers, WidExpo(keyID)))*(LenFinal(keyID));
function DishRoundness(t, keyID) =
[
pow(t/dishLayers, DishExpo(keyID))*(DishCham0f(keyID)) + (1-pow(t/dishLayers, DishExpo(keyID)))*DishCham0i(keyID),
pow(t/dishLayers, DishExpo(keyID))*(DishCham1f(keyID)) + (1-pow(t/dishLayers, DishExpo(keyID)))*DishCham1i(keyID)
];
function KnullTranslation2(t, keyID) =
[
cos((t)/dishLayers*ZAngleSkew(keyID))*((BottomWidth(keyID) -TopWidthDiff(keyID)) - (1-pow(t/dishLayers, WidExpo(keyID)))*(LenFinal(keyID))),
sin((t)/dishLayers*ZAngleSkew(keyID))*((BottomWidth(keyID) -TopWidthDiff(keyID)) - (1-pow(t/dishLayers, WidExpo(keyID)))*(LenFinal(keyID))),
KeyHeight(keyID)+DishDepth(keyID)-(t)/dishLayers*(DishDepth(keyID)) //Z shift
];
function KnullRotation2(t, keyID) =
[
0, //X shift
0, //Y shift
((t)/dishLayers*ZAngleSkew(keyID)) //Z shift
];
function KnullTransform2(t, keyID) =
[
KnullRound0i(keyID)*1,
KnullRound0i(keyID)*2
// pow(t/layers, DishExpo(keyID))*(KnullRound0i(keyID)) + (1-pow(t/dishLayers, DishExpo(keyID)))*KnullRound0f(keyID),
// pow(t/layers, DishExpo(keyID))*(KnullRound1i(keyID)) + (1-pow(t/dishLayers, DishExpo(keyID)))*KnullRound1f(keyID)
];
///----- KEY Builder Module
module keycap(keyID = 0, cutLen = 0, visualizeDish = false, knull = false, rossSection = false, Dish = true, Stem = false, homeDot = false, Stab = false, Stab = 0) {
// //Set Parameters for dish shape
// FrontPath = quantize_trajectories(FrontTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
// BackPath = quantize_trajectories(BackTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
//
// //Scaling initial and final dim tranformation by exponents
// function FrontDishArc(t) = pow((t)/(len(FrontPath)),FrontArcExpo(keyID))*FrontFinArc(keyID) + (1-pow(t/(len(FrontPath)),FrontArcExpo(keyID)))*FrontInitArc(keyID);
// function BackDishArc(t) = pow((t)/(len(FrontPath)),BackArcExpo(keyID))*BackFinArc(keyID) + (1-pow(t/(len(FrontPath)),BackArcExpo(keyID)))*BackInitArc(keyID);
//
// FrontCurve = [ for(i=[0:len(FrontPath)-1]) transform(FrontPath[i], DishShape(DishDepth(keyID), FrontDishArc(i), 1, d = 0)) ];
// BackCurve = [ for(i=[0:len(BackPath)-1]) transform(BackPath[i], DishShape(DishDepth(keyID), BackDishArc(i), 1, d = 0)) ];
//builds
difference(){
union(){
skin([for (i=[0:layers]) transform(translation(CapTranslation(i, keyID)) * rotation(CapRotation(i, keyID)),
circle(CapTransform(i, keyID)))]); //second
if(Dish == true){
skin([for (i=[0:dishLayers]) transform(translation(DishTranslation(i, keyID)) * rotation(DishRotation(i, keyID)),
circle(DishTransform(i, keyID)))]); //top dome
}
}
//Cut
if(knull == true){
for(i = [0:knullNum]){
rotate([0,0,i*360/knullNum])#skin([for (i=[0:layers]) transform(translation(KnullTranslation(i, keyID)) * rotation(KnullRotation(i, keyID)),
ellipse(KnullTransform(i, keyID), d = 0))]); //second
rotate([0,0,i*360/knullNum])mirror([0,1,0])#skin([for (i=[0:layers]) transform(translation(KnullTranslation(i, keyID)) * rotation(KnullRotation(i, keyID)),
ellipse(KnullTransform(i, keyID), d = 0))]); //second
if(Dish == true){
rotate([0,0,i*360/knullNum])#skin([for (i=[0:dishLayers]) transform(translation(KnullTranslation2(i, keyID)) * rotation(KnullRotation2(i, keyID)),
ellipse(KnullTransform2(i, keyID), d = 0))]); //second
rotate([0,0,i*360/knullNum])mirror([0,1,0])#skin([for (i=[0:dishLayers]) transform(translation(KnullTranslation2(i, keyID)) * rotation(KnullRotation2(i, keyID)),
ellipse(KnullTransform2(i, keyID), d = 0))]); //second
}
}
}
}
}
//------------------stems
$fn = fn;
function outer_cherry_stem(slop) = [ stemWid - slop * 2, stemLen - slop * 2];
function outer_cherry_stabilizer_stem(slop) = [4.85 - slop * 2, 6.05 - slop * 2];
function outer_box_cherry_stem(slop) = [6 - slop, 6 - slop];
// .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],
];
module inside_cherry_cross(slop) {
// inside cross
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-0.005]) {
linear_extrude(height = stemCrossHeight) {
square(cherry_cross(slop, extra_vertical)[0], center=true);
square(cherry_cross(slop, extra_vertical)[1], center=true);
}
}
// Guides to assist insertion and mitigate first layer squishing
{
for (i = cherry_cross(slop, extra_vertical)) hull() {
linear_extrude(height = 0.01, center = false) offset(delta = 0.4) square(i, center=true);
translate([0, 0, 0.5]) linear_extrude(height = 0.01, center = false) square(i, center=true);
}
}
}
module cherry_stem(depth, slop) {
D1=.15;
D2=.05;
H1=3.5;
CrossDist = 1.75;
difference(){
// outside shape
linear_extrude(height = depth) {
offset(r=1){
square(outer_cherry_stem(slop) - [2,2], center=true);
}
}
inside_cherry_cross(slop);
hull(){
translate([CrossDist,CrossDist-.1,0])cylinder(d1=D1, d2=D2, H1);
translate([-CrossDist,-CrossDist+.1,0])cylinder(d1=D1, d2=D2, H1);
}
hull(){
translate([-CrossDist,CrossDist-.1])cylinder(d1=D1, d2=D2, H1);
translate([CrossDist,-CrossDist+.1])cylinder(d1=D1, d2=D2, H1);
}
}
}
/// ----- helper functions
function rounded_rectangle_profile(size=[1,1],r=1,fn=32) = [
for (index = [0:fn-1])
let(a = index/fn*360)
r * [cos(a), sin(a)]
+ sign_x(index, fn) * [size[0]/2-r,0]
+ sign_y(index, fn) * [0,size[1]/2-r]
];
function ellipse(axis, d = 0) = [for (t = [0:step:360]) [axis[0]*cos(t), axis[1]*sin(t)*(1+d*cos(t))]]; //shape to
function elliptical_rectangle(a = [1,1], b =[1,1], fn=32) = [
for (index = [0:fn-1]) // section right
let(theta1 = -atan(a[1]/b[1])+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta1), a[1]*sin(theta1)]
+ [a[0]*cos(atan(b[0]/a[0])), 0]
- [b[1]*cos(atan(a[1]/b[1])), 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
- [0, b[0]*sin(atan(b[0]/a[0]))]
+ [0, a[1]*sin(atan(a[1]/b[1]))],
for(index = [0:fn-1]) // section left
let(theta3 = -atan(a[1]/b[1])+180+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta3), a[1]*sin(theta3)]
- [a[0]*cos(atan(b[0]/a[0])), 0]
+ [b[1]*cos(atan(a[1]/b[1])), 0],
for(index = [0:fn-1]) // section Top
let(theta4 = atan(b[0]/a[0]) + 180 + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta4), b[0]*sin(theta4)]
+ [0, b[0]*sin(atan(b[0]/a[0]))]
- [0, a[1]*sin(atan(a[1]/b[1]))]
]/2;
function sign_x(i,n) =
i < n/4 || i > n-n/4 ? 1 :
i > n/4 && i < n-n/4 ? -1 :
0;
function sign_y(i,n) =
i > 0 && i < n/2 ? 1 :
i > n/2 ? -1 :
0;

View file

@ -1,4 +1,4 @@
use <scad-utils/morphology.scad> //for cheaper minwoski
use <scad-utils/morphology.scad> //for cheaper minwoski
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <scad-utils/trajectory.scad>
@ -6,52 +6,55 @@ use <scad-utils/trajectory_path.scad>
use <sweep.scad>
use <skin.scad>
/*DES (Distorted Elliptical Saddle) Sculpted Profile for 6x3 and corne thumb
/*DES (Distorted Elliptical Saddle) Sculpted Profile
Version 2: Eliptical Rectangle
*/
//#square([18.16, 18.16], center = true);
//TODO add shift
mirror([0,0,0])keycap(keyID = 14, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = true, crossSection = false, homeDot = false, Legends = false);
//NOTE: with sweep cuts, top surface may not be visible in review, it should be visible once rendered
//n translate([0,19, 0])keycap(keyID = 3, cutLen = 0, Stem =true, Dish = true, visualizeDish = true, crossSection = true, homeDot = false, Legends = false);
// translate([0,38, 0])mirror([0,1,0])keycap(keyID = 2, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = true, homeDot = false, Legends = false);
RowHome = [0,2.5,5,2.5,0,0];
//for(Col = [6:6]){
// for(Row = [1:3]){
// translate([19*Col, 19*Row +RowHome[Col], 0])keycap(keyID = Col*4+Row, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
// }
//}
//#translate([0,38,13])cube([18-5.7, 18-5.7,1],center = true);
mirror([0,0,0])keycap(
keyID = 4, //change profile refer to KeyParameters Struct
cutLen = 0, //Don't change. for chopped caps
Stem = true, //tusn on shell and stems
Dish = true, //turn on dish cut
Stab = 0,
visualizeDish = false, // turn on debug visual of Dish
crossSection = false, // center cut to check internal
homeDot = false, //turn on homedots
Legends = false
);
//Parameters
wallthickness = 1.25;
wallthickness = 1.5;
topthickness = 3; //
stepsize = 50; //resolution of Trajectory
step = 1; //resolution of ellipes
fn = 64; //resolution of Rounded Rectangles: 60 for output
step = 2; //resolution of ellipes
fn = 32; //resolution of Rounded Rectangles: 60 for output
layers = 40; //resolution of vertical Sweep: 50 for output
dotRadius = 1.25; //home dot size
// roll for trajectories
fr1 = 0;
fr2 = 0;
br1 = 0;
br2 = 0;
//---Stem param
slop = 0.4;
Tol = 0.10; //stem tolarance
stemRot = 0;
stemWid = 7.2;
stemLen = 5.5;
stemRad = 5.55; // stem outer radius
stemLen = 5.55 ;
stemCrossHeight = 4;
extra_vertical = 0.6;
StemBrimDep = 0.75;
StemBrimDep = 0.25;
stemLayers = 50; //resolution of stem to cap top transition
keyParameters = //keyParameters[KeyID][ParameterID]
[
// BotWid, BotLen, TWDif, TLDif, keyh, WSft, LSft XSkew, YSkew, ZSkew, WEx, LEx, CapR0i, CapR0f, CapR1i, CapR1f, CapREx, StemEx
//normie hipro v1
[17.16, 17.16, 6.5, 6.5, 11, 0, 0, -10, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[17.16*2,17.16, 6.5, 6.5, 11, 0, 0, -10, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 2u
[17.16, 17.16, 6.5, 6.5, 11.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[35.46, 17.16, 6.5, 6.5, 11.0, 0, 0, -10, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 2u
[17.16, 17.16, 6.5, 6.5, 9, 0, 0, 3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16*2,17.16, 6.5, 6.5, 8.6, 0, 0, -8, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 2u low pro 3
//normie hi-sculpt 4 row system 17~23
@ -60,6 +63,8 @@ keyParameters = //keyParameters[KeyID][ParameterID]
[26.66, 17.16, 6.5, 6.5, 11.0, 0, 0, -9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 1.5u
[31.06, 17.16, 6.5, 6.5, 11.0, 0, 0, -9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 1.75u
[35.56, 17.16, 6.5, 6.5, 11.0, 0, 0, -9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 2.0u 8
[40.86, 17.16, 6.5, 6.5, 11.0, 0, 0, -9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 2.25u 8
[50.66, 17.16, 6.5, 6.5, 11.0, 0, 0, -9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 2.75u 8
//normie mild 4 row system
[17.16, 17.16, 6.5, 6.5, 10.3, 0, 0, -9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 9
@ -68,17 +73,17 @@ keyParameters = //keyParameters[KeyID][ParameterID]
[31.06, 17.16, 6.5, 6.5, 10.3, 0, 0, -9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 12
[35.56, 17.16, 6.5, 6.5, 10.3, 0, 0, -9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 13
//nueron R5s
[17.96, 17.96, 8, 8, 13.0, 0, 0, -11, 0, 0, 2, 2, .1, 3.399, .1, 3.399, 2, 2], //R5 14
[26.66, 17.16, 8, 8, 13.0, 0, 0, -11, 0, 0, 2, 2, .1, 3.399, .1, 3.399, 2, 2], //R5 1.5u
[40.66, 17.16, 8, 8, 13.0, 0, 0, -11, 0, 0, 2, 2, .1, 3.399, .1, 3.399, 2, 2], //R5 2.25u
[49.86, 17.16, 8, 8, 13.0, 0, 0, -11, 0, 0, 2, 2, .1, 3.399, .1, 3.399, 2, 2], //R5 2.75u
[35.46, 17.96, 6.5, 6.5, 10.5, 0, 0, -5, 0, 0, 2, 2, 1, 5, 1, 5, 2, 2], //R5 2u
[26.66, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 5, 2, 2], //R5 1.5u
[40.66, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 5, 2, 2], //R5 2.25u
[49.86, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 5, 2, 2], //R5 2.75u
];
dishParameters = //dishParameter[keyID][ParameterID]
[
//FFwd1 FFwd2 FPit1 FPit2 DshDepi DishDepf,DshHDif FArcIn FArcFn FArcEx BFwd1 BFwd2 BPit1 BPit2 BArcIn BArcFn BArcEx
[ 3, 3, -10, -50, 3, 7, 8.2, 9, 2, 5, 3, 0, -30, 8.2, 9, 2], //R5
[ 3, 3, -10, -50, 3, 7, 18.2, 21, 2, 5, 3, 0, -30, 18.2, 21, 2], //R4
[ 4, 4, -10, -20, 3, 7, 8.2, 9, 2, 4, 9, 3, 15, 8.2, 9, 2], //R5
[ 4, 3.5, -13, -50, 2, 4.5, 18.2, 17.5, 2, 4.5, 2.5, -5, -50, 18.2, 17, 2], //R5 2u
[ 3, 3, -10, -50, 3, 7, 8.8, 9, 2, 4, 3, -5, -30, 8.8, 9, 2], //R3
[ 3, 3.25, -10, -45, 2, 4.3, 18.2, 21, 2, 5, 3, -10, -30, 18.2, 21, 2], //R4
//normie hi-sculpt 4 row system 17~23
@ -87,6 +92,8 @@ dishParameters = //dishParameter[keyID][ParameterID]
[ 4, 3, -10, -20, 1.5, 4, 12.4, 13, 2, 4, 3, -10, -30, 12.4, 13, 2], //R5 1.5u
[ 4, 3, -10, -20, 1.5, 4, 14.6, 15, 2, 4, 3, -10, -30, 14.6, 15, 2], //R5 1.75u
[ 4, 3, -10, -20, 1.5, 4, 16.8, 17, 2, 4, 3, -10, -30, 16.8, 17, 2], //R5 2.0u
[ 4, 3, -10, -20, 1.5, 4, 19.5, 20, 2, 4, 3, -10, -30, 19.5, 20, 2], //R5 2.25u
[ 4, 3, -10, -20, 1.5, 4, 24.5, 24.5, 2, 4, 3, -10, -30, 24.5, 24.5, 2], //R5 2.75u
//normie hi-sculpt 4 row system 17~23
[ 4, 3, -10, -20, 1.5, 4, 8.2, 9, 2, 4, 3, -10, -30, 8.2, 9, 2], //R5
[ 4, 3, -10, -20, 1.5, 4, 10.2, 11, 2, 4, 3, -10, -30, 10.2, 11, 2],//R5 1.25u
@ -94,7 +101,7 @@ dishParameters = //dishParameter[keyID][ParameterID]
[ 4, 3, -10, -20, 1.5, 4, 14.6, 15, 2, 4, 3, -10, -30, 14.6, 15, 2], //R5 1.75u
[ 4, 3, -10, -20, 1.5, 4, 16.8, 17, 2, 4, 3, -10, -30, 16.8, 17, 2], //R5 2.0u
//
[ 4, 3, -10, -20, 1.5, 4, 7.2, 7.2, 2, 4, 3, -10, -30, 7.2, 7.2, 2], //R5
[ 4, 3, -10, -20, 1.8, 4.5, 17.5, 19, 2, 4, 10, 3, 15, 17.5, 19, 2], //R5
[ 4, 3, -10, -20, 1.5, 4, 11.8, 12, 2, 4, 3, -10, -30, 11.8, 12, 2], //R5 1.5u
[ 4, 3, -10, -20, 1.5, 4, 18.8, 18.8, 2, 4, 3, -10, -30, 18.8, 18.8, 2], //R5 2.25u
[ 4, 3, -10, -20, 1.5, 4, 23.5, 24, 2, 4, 3, -10, -30, 23.5, 24, 2], //R5 2.75u
@ -138,14 +145,14 @@ function StemExponent(keyID) = keyParameters[keyID][17];
function FrontTrajectory(keyID) =
[
trajectory(forward = FrontForward1(keyID), pitch = FrontPitch1(keyID)), //more param available: yaw, roll, scale
trajectory(forward = FrontForward2(keyID), pitch = FrontPitch2(keyID)) //You can add more traj if you wish
trajectory(forward = FrontForward1(keyID), pitch = FrontPitch1(keyID), roll = fr1), //more param available: yaw, roll, scale
trajectory(forward = FrontForward2(keyID), pitch = FrontPitch2(keyID), roll = fr2) //You can add more traj if you wish
];
function BackTrajectory (keyID) =
[
trajectory(forward = BackForward1(keyID), pitch = BackPitch1(keyID)),
trajectory(forward = BackForward2(keyID), pitch = BackPitch2(keyID)),
trajectory(forward = BackForward1(keyID), pitch = BackPitch1(keyID), roll = br1),
trajectory(forward = BackForward2(keyID), pitch = BackPitch2(keyID), roll = br2),
];
//------- function defining Dish Shapes
@ -259,13 +266,17 @@ module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false,
}
}
if(Stem == true){
translate([0,0,StemBrimDep])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID)-StemBrimDep, slop); // generate mx cherry stem, not compatible with box
if (Stab != 0){
translate([Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
translate([-Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
//TODO add binding support?
translate([0,0,StemBrimDep])rotate(stemRot)difference(){
//cylinderical Stem body
cylinder(d =5.5,KeyHeight(keyID)-StemBrimDep, $fn= 32);
skin(StemCurve);
skin(StemCurve2);
// generate smooth trantion to ceiling
// translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), elliptical_rectangle(StemTransform(i, keyID),b= StemRadius(i, keyID), fn=fn))]);
// InnerTransform(i, keyID), = CapRoundness(i,keyID),fn=fn)
}
translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), rounded_rectangle_profile(StemTransform(i, keyID),fn=fn,r=StemRadius(i, keyID)))]); //Transition Support for taller profile
}
//cut for fonts and extra pattern for light?
}
@ -296,37 +307,36 @@ module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false,
}
//------------------stems
$fn = fn;
function outer_cherry_stem(slop) = [ stemWid - slop * 2, stemLen - slop * 2];
function outer_cherry_stabilizer_stem(slop) = [4.85 - slop * 2, 6.05 - slop * 2];
function outer_box_cherry_stem(slop) = [6 - slop, 6 - slop];
MXWid = 4.03/2+Tol; //horizontal lenght
MXLen = 4.23/2+Tol; //vertical length
// .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],
];
module inside_cherry_cross(slop) {
// inside cross
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-0.005]) {
linear_extrude(height = stemCrossHeight) {
square(cherry_cross(slop, extra_vertical)[0], center=true);
square(cherry_cross(slop, extra_vertical)[1], center=true);
}
}
MXWidT = 1.15/2+Tol; //horizontal thickness
MXLenT = 1.25/2+Tol; //vertical thickness
// Guides to assist insertion and mitigate first layer squishing
{
for (i = cherry_cross(slop, extra_vertical)) hull() {
linear_extrude(height = 0.01, center = false) offset(delta = 0.4) square(i, center=true);
translate([0, 0, 0.5]) linear_extrude(height = 0.01, center = false) square(i, center=true);
}
}
}
function stem_internal(sc=1) = sc*[
[MXLenT, MXLen],[MXLenT, MXWidT],[MXWid, MXWidT],
[MXWid, -MXWidT],[MXLenT, -MXWidT],[MXLenT, -MXLen],
[-MXLenT, -MXLen],[-MXLenT, -MXWidT],[-MXWid, -MXWidT],
[-MXWid,MXWidT],[-MXLenT, MXWidT],[-MXLenT, MXLen]
]; //2D stem cross with tolance offset and additonal transformation via jog
//trajectory();
function StemTrajectory() =
[
trajectory(forward = 5.25) //You can add more traj if you wish
];
StemPath = quantize_trajectories(StemTrajectory(), steps = 1 , loop=false, start_position= $t*4);
StemCurve = [ for(i=[0:len(StemPath)-1]) transform(StemPath[i], stem_internal()) ];
function StemTrajectory2() =
[
trajectory(forward = .5) //You can add more traj if you wish
];
StemPath2 = quantize_trajectories(StemTrajectory2(), steps = 10, loop=false, start_position= $t*4);
StemCurve2 = [ for(i=[0:len(StemPath2)-1]) transform(StemPath2[i]*scaling([(1.1-.1*i/(len(StemPath2)-1)),(1.1-.1*i/(len(StemPath2)-1)),1]), stem_internal()) ];
module cherry_stem(depth, slop) {
D1=.15;

View file

@ -1,56 +1,42 @@
use <scad-utils/morphology.scad> //for cheaper minwoski
use <scad-utils/morphology.scad> //for cheaper minwoski
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <scad-utils/trajectory.scad>
use <scad-utils/trajectory_path.scad>
use <sweep.scad>
use <skin.scad>
// R3 1.25=5 1.75 13
// R4 1.25=6 1.75 14
// R5 1.50=8 2.25=20, 2.75=24
//use <z-butt.scad>
/*DES (Distorted Elliptical Saddle) Sculpted Profile for 6x3 and corne thumb
Version 2: Eliptical Rectangle
*/
//#square([18.16, 18.16], center = true);
//#square([41.3, 19.05], center = true);
mirror([0,0,0])rotate([22.94,0,0])keycap(keyID = 24, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//mirror([0,0,0])translate([19*2.5,0,0])keycap(keyID = 24, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//mirror([0,0,0])translate([-19.00*1.875,0,0])keycap(keyID = 8, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//mirror([0,0,0])translate([19.00*4.625,0,0])keycap(keyID = 8, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//
//translate([-19,0,0])keycap(keyID = 3, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([19,0,0])mirror([0,0,0])keycap(keyID = 5, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([19*.5,19,0])mirror([1,0,0])keycap(keyID = 6, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//for(i=[0:2]){translate([0,(i+1)*19,0])keycap(keyID = i, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false, homeDot = false, Legends = false);}
//n translate([0,19, 0])keycap(keyID = 3, cutLen = 0, Stem =true, Dish = true, visualizeDish = true, crossSection = true, homeDot = false, Legends = false);
// translate([0,38, 0])mirror([0,1,0])keycap(keyID = 2, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = true, homeDot = false, Legends = false);
//for(i=[0:11]){translate([i*19-19*6,(3)*19,0])keycap(keyID = 2, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false, homeDot = false, Legends = false);}
//for(i=[0:8]){translate([i*19-19*4.75,(2)*19,0])keycap(keyID = 1, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false, homeDot = false, Legends = false);}
//for(i=[0:8]){color("royalblue")translate([i*19-19*2.375,(1)*19,0])keycap(keyID = 0, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false, homeDot = false, Legends = false);}
//for(i=[8:11]){translate([19,(i-8)*19,0])keycap(keyID = i, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false, homeDot = false, Legends = false);}
//for(i=[12:15]){translate([25,(i-12)*19,0])keycap(keyID = i, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false, homeDot = false, Legends = false);}
//for(i=[20:23]){translate([30,(i-20)*19,0])keycap(keyID = i, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false, homeDot = false, Legends = false);}
//for(i=[24:27]){translate([25,(i-24)*19,0])keycap(keyID = i, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false, homeDot = false, Legends = false);}
mirror([0,0,0])keycap(
keyID = 1, //change profile refer to KeyParameters Struct
cutLen = 0, //Don't change. for chopped caps
Stem = true, //tusn on shell and stems
Dish = true, //turn on dish cut
Stab = 0,
visualizeDish = false, // turn on debug visual of Dish
crossSection = false, // center cut to check internal
homeDot = false, //turn on homedots
Legends = false
);
//#translate([0,38,13])cube([18-5.7, 18-5.7,1],center = true);
//echo(len(keyParameters));
//Parameters
wallthickness = 1.25; // 1.5 for norm, 1.25 for cast master
topthickness = 2.75; // 3 for norm, 2.5 for cast master
stepsize = 50; //resolution of Trajectory
step = 2; //resolution of ellipes
fn = 32; //resolution of Rounded Rectangles: 60 for output
wallthickness = 2.0; // 1.5 for norm, 1.25 for cast master
topthickness = 2.5; // 3 for norm, 2.5 for cast master
stepsize = 40; //resolution of Trajectory
step = 6; //resolution of ellipes
fn = 16; //resolution of Rounded Rectangles: 60 for output
layers = 40; //resolution of vertical Sweep: 50 for output
dotRadius = 0.55; //home dot size
//---Stem param
slop = 0.40;
Tol = 0.10;
stemRot = 0;
stemWid = 7.2;
stemLen = 5.5;
stemWid = 7.55;
stemLen = 5.55 ;
stemCrossHeight = 4;
extra_vertical = 0.6;
StemBrimDep = 0.25;
@ -60,46 +46,67 @@ keyParameters = //keyParameters[KeyID][ParameterID]
[
// BotWid, BotLen, TWDif, TLDif, keyh, WSft, LSft XSkew, YSkew, ZSkew, WEx, LEx, CapR0i, CapR0f, CapR1i, CapR1f, CapREx, StemEx
//Column high sculpt 3 row system
//0~3
[17.16, 17.16, 6.5, 6.5,10.55, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4 8
//0~5
[17.16, 17.16, 6.5, 6.5,10.55, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4 8
// [17.16, 17.16, 6.5, 6.5, 10.0, 0, 0, 15, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4 8
[17.16, 17.16, 6.5, 6.5, 8.75, 0, .5, 4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 9.75, 0, 0, -13, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[17.16, 17.16, 6.5, 6.5, 8.75, 0, 0, 4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 deepdish
[17.16, 17.16, 6.5, 6.5, 11.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 mod
[17.16, 17.16, 6.5, 6.5, 15.0, 0, -.5, 20, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1 num
//1.25u 4~7
//1.25u 6~9
[21.86, 17.16, 6.5, 6.5, 11.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[21.86, 17.16, 6.5, 6.5,10.55, .5, 0, 9, 3, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[21.86, 17.16, 6.5, 6.5, 8.75, -.5, .5, 4, -3, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[21.86, 17.16, 6.5, 6.5,10.55, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4 // neuron 3 deg
[21.86, 17.16, 6.5, 6.5, 8.75, 0, .5, 4, -0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[21.86, 17.16, 6.5, 6.5, 9.75, 0, 0, -13, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
//1.5u 8~11
//1.5u 10~13
[26.66, 17.16, 6.5, 6.5, 11.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[26.66, 17.16, 6.5, 6.5,10.55, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[26.66, 17.16, 6.5, 6.5, 8.75, 0, .5, 4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[26.66, 17.16, 6.5, 6.5, 9.75, 0, 0, -13, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
//1.75u 12~15
[31.06, 17.16, 6.5, 6.5, 11.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[31.06, 17.16, 6.5, 6.5,10.55, 0, 0, 9, -3, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[31.06, 17.16, 6.5, 6.5, 8.75, 0, .5, 4, 3, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[31.06, 17.16, 6.5, 6.5, 9.75, 0, 0, -13, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
//2.0u 16~19
[35.46, 17.16, 6.5, 6.5, 11.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[35.46, 17.16, 6.5, 6.5,10.55, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[35.46, 17.16, 6.5, 6.5, 8.75, 0, .5, 4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[35.46, 17.16, 6.5, 6.5, 9.75, 0, 0, -13, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
//2.25u 20~23
[40.66, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, -3, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[35.46, 17.16, 6.5, 6.5,10.55, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[35.46, 17.16, 6.5, 6.5, 8.75, 0, .5, 4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[35.46, 17.16, 6.5, 6.5, 9.75, 0, 0, -13, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
//2.75u 24
[50.66, 17.16, 6.5, 6.5, 10.5, 0, 0, -3, 2, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[35.46, 17.16, 6.5, 6.5,10.55, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[35.46, 17.16, 6.5, 6.5, 8.75, 0, .5, -4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[35.46, 17.16, 6.5, 6.5, 9.75, 0, 0, -13, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
//1.75u 14~17
[31.40, 17.16, 6.5, 6.5, 11.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[31.40, 17.16, 6.5, 6.5,10.55, 0, 0, 9, -0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[31.40, 17.16, 6.5, 6.5, 8.75, 0, .5, 4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[31.40, 17.16, 6.5, 6.5, 9.75, 0, 0, -13, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
//2.0u 18~22
[36.26, 17.16, 6.5, 6.5, 11.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[36.26, 17.16, 6.5, 6.5,10.55, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[36.26, 17.16, 6.5, 6.5, 8.75, 0, .5, 4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[36.26, 17.16, 6.5, 6.5, 9.75, 0, 0, -13, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[36.26, 17.16, 6.5, 6.5, 15, 0, -.5, 20, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R1
//2.25u 23~26
[40.96, 17.16, 6.5, 6.5, 11.5, 0, 0, -3, -0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[40.96, 17.16, 6.5, 6.5,10.55, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[40.96, 17.16, 6.5, 6.5, 8.75, 0, .5, 4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[40.96, 17.16, 6.5, 6.5, 9.75, 0, 0, -13, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
//2.50u 27~30
[45.66, 17.16, 6.5, 6.5, 11.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5 // neuron 2deg height to 10.5
[45.66, 17.16, 6.5, 6.5,10.55, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[45.66, 17.16, 6.5, 6.5, 8.75, 0, .5, 4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[45.66, 17.16, 6.5, 6.5, 9.75, 0, 0, -13, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
//2.75u 31~34
[50.66, 17.16, 6.5, 6.5, 11.5, 0, 0, -3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[50.66, 17.16, 6.5, 6.5,10.55, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[50.66, 17.16, 6.5, 6.5, 8.75, 0, .5, -4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[50.66, 17.16, 6.5, 6.5, 9.75, 0, 0, -13, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
//3.00u 34~37
[55.36, 17.16, 6.5, 6.5, 11.5, 0, 0, -3, -0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
[55.36, 17.16, 6.5, 6.5,10.55, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
[55.36, 17.16, 6.5, 6.5, 8.75, 0, .5, 4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[55.36, 17.16, 6.5, 6.5, 9.75, 0, 0, -13, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
//6.25u 39
[117.1, 17.16, 6.5, 6.5, 11.5, 0, 0, -3, -0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
//7.00u 40
[131.4, 17.16, 6.5, 6.5, 11.5, 0, 0, -3, -0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R5
//num pad vert 2u 41
[17.16, 36.26, 6.5, 6.5,10.00, 0, 0, -5, 0, 0, 2, 2, 1, 6, 1, 3.5, 2, 2], //R4
[17.16, 36.26, 6.5, 6.5,10.55, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4
];
dishParameters = //dishParameter[keyID][ParameterID]
dishParameters = //dishParameter[keyID][ParameteID]
[
//FFwd1 FFwd2 FPit1 FPit2 DshDep DshHDif FArcIn FArcFn FArcEx BFwd1 BFwd2 BPit1 BPit2 BArcIn BArcFn BArcEx
// low pro 3 row system
@ -107,28 +114,36 @@ dishParameters = //dishParameter[keyID][ParameterID]
[ 5, 3.5, 10, -55, 5, 1.8, 8.5, 15, 2, 5, 3.7, 10, -55, 8.5, 15, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R2
[ 4.8, 3.3, 18, -55, 5, 2.0, 8.5, 15, 2, 4.8, 3.3, 18, -55, 8.5, 15, 2], //R3 deep
[ 6, 3, -5, -50, 5, 1.8, 8.8, 15, 2, 6, 3.5, 13, -50, 8.8, 15, 2], //R5 mod
[ 6, 3, 13, 30, 5, 1.9, 8.9, 15, 2, 5, 4.4, 10, -50, 8.9, 16, 2], //R1
//1.25
[ 6, 3, -5, -50, 5, 1.8, 12.4, 18, 2, 6, 3.5, 13, -50, 12.4, 19, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 12.4, 20, 2, 5, 4.4, 5, -55, 12.4, 19, 2], //R4
[ 6, 3, 18, -50, 5, 1.8, 12.4, 21, 2, 5, 4.4, 5, -55, 12.4, 19, 2], //R4
[ 5, 3.5, 10, -55, 5, 1.8, 12.4, 18, 2, 5, 3.7, 10, -55, 12.4, 19, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 12.4, 18, 2, 6, 4, 13, 30, 12.4, 19, 2], //R2
//1.5
[ 6, 3, -5, -50, 5, 1.8, 15.5, 22, 2, 6, 3.5, 13, -50, 15.5, 22, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 15.5, 27.2, 2, 5, 4.4, 5, -55, 15.5, 22, 2], //R4
[ 6, 3, -5, -50, 5, 1.8, 15.6, 22, 2, 6, 3.5, 13, -50, 15.6, 22, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 15.6, 27.2, 2, 5, 4.4, 5, -55, 15.6, 22, 2], //R4
[ 5, 3.5, 10, -55, 5, 1.8, 15.5, 22, 2, 5, 3.7, 10, -55, 15.5, 22, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 15.7, 22, 2, 6, 4, 13, 30, 15.7, 23, 2], //R2
//1.75
[ 6, 3, -5, -50, 5, 1.8, 18.7, 25, 2, 6, 3.5, 13, -50, 18.7, 25, 2], //R5
[ 6, 3, -5, -50, 5, 1.8, 18.7, 25, 2, 6, 3.5, 13, -50, 18.7, 26, 2], //R5
[ 6, 3, 17, -50, 5, 1.8, 18.7, 32, 2, 5, 4.4, 5, -55, 18.7, 25, 2], //R4
[ 5, 3.5, 10, -55, 5, 1.8, 18.7, 27, 2, 5, 3.8, 10, -55, 18.7, 25, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 18.7, 25, 2, 6, 4, 13, 30, 18.7, 28, 2], //R2
//2
[ 6, 3, -5, -50, 5, 1.8, 21.9, 30, 2, 6, 3.5, 13, -50, 21.9, 31, 2], //R5
[ 6, 3, 15, -50, 5, 1.8, 21.9, 34, 2, 5, 4.4, 5, -55, 21.9, 31, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 21.9, 32.5, 2, 5, 3.7, 8, -55, 21.9, 31, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 21.9, 30, 2, 5, 4, 11.5, -55, 21.9, 33, 2], //R2
[ 6, 3, -5, -50, 5, 1.8, 22.3, 30, 2, 6, 3.5, 13, -50, 22.3, 31, 2], //R5
[ 6, 3, 15, -50, 5, 1.8, 22.3, 35, 2, 5, 4.4, 5, -55, 22.3, 31, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 22.3, 32.5, 2, 5, 3.7, 8, -55, 22.3, 31, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 22.3, 30, 2, 5, 4, 11.5, -55, 22.3, 33, 2], //R2
[ 6.4, 3.2, 13, 30, 5, 1.9, 23.1, 38, 2, 5, 4.4, 10, -50, 23.1, 34, 2], //R1
//2.25
[ 6, 3, -5, -50, 5, 1.8, 25.6, 30, 2, 6, 3.5, 13, -50, 25.6, 40, 2], //R5
[ 6, 3, -5, -50, 5, 1.8, 25.6, 30, 2, 6, 3.5, 13, -50, 25.6, 40, 2], //R5
[ 6, 3, 15, -50, 5, 1.8, 25.6, 41, 2, 5, 4.4, 5, -55, 25.6, 34, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 25.6, 32.5, 2, 5, 3.7, 8, -55, 21.9, 31, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 21.9, 30, 2, 5, 4, 11.5, -55, 21.9, 33, 2], //R2
//2.50
[ 6, 3, -5, -50, 5, 1.8, 29.0, 40, 2, 6, 3.5, 13, -50, 29.0, 43, 2], //R5
[ 6, 3, 15, -50, 5, 1.8, 21.9, 34, 2, 5, 4.4, 5, -55, 21.9, 31, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 21.9, 32.5, 2, 5, 3.7, 8, -55, 21.9, 31, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 21.9, 30, 2, 5, 4, 11.5, -55, 21.9, 33, 2], //R2
@ -137,6 +152,19 @@ dishParameters = //dishParameter[keyID][ParameterID]
[ 6, 3, 15, -50, 5, 1.8, 21.9, 34, 2, 5, 4.4, 5, -55, 21.9, 31, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 21.9, 32.5, 2, 5, 3.7, 8, -55, 21.9, 31, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 21.9, 30, 2, 5, 4, 11.5, -55, 21.9, 33, 2], //R2
//3
[ 6, 3, -5, -50, 5, 1.8, 35.85, 46, 2, 6, 3.5, 13, -50, 35.85, 55, 2], //R5
[ 6, 3, 15, -50, 5, 1.8, 21.9, 34, 2, 5, 4.4, 5, -55, 21.9, 31, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 21.9, 32.5, 2, 5, 3.7, 8, -55, 21.9, 31, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 21.9, 30, 2, 5, 4, 11.5, -55, 21.9, 33, 2], //R2
//6.25u
[ 6, 3, -5, -50, 5, 1.8, 79.1, 95, 2, 6, 3.5, 13, -50, 79.1, 127, 2], //R5
//7.00u
[ 6, 3, -5, -50, 5, 1.8, 89.7, 105, 2, 6, 3.5, 13, -50, 89.7, 143, 2], //R5
//2.00u vert
[ 13, 5.5, 5, -30, 4, 1.8, 8.5, 12, 1.5, 10, 8, 7, -10, 8.5, 12, 1.5], //R5
[ 6, 3, -5, -50, 5, 1.8, 79.1, 95, 2, 6, 3.5, 13, -50, 79.1, 127, 2], //R5
];
@ -232,7 +260,7 @@ function CapRotation(t, keyID) =
function CapTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)) + (1-pow(t/layers, WidExponent(keyID)))*BottomWidth(keyID) ,
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)) + (1-pow(t/layers, WidExponent(keyID)))*BottomWidth(keyID),
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)) + (1-pow(t/layers, LenExponent(keyID)))*BottomLength(keyID)
];
function CapRoundness(t, keyID) =
@ -299,11 +327,10 @@ module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false,
}
}
if(Stem == true){
translate([0,0,StemBrimDep])cherry_stem(KeyHeight(keyID)-StemBrimDep, slop); // generate mx cherry stem, not compatible with box
if (Stab != 0){
translate([Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
translate([-Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
//TODO add binding support?
translate([0,0,StemBrimDep])rotate(stemRot)difference(){
cylinder(d =5.5,KeyHeight(keyID)-StemBrimDep, $fn= 32);
skin(StemCurve);
skin(StemCurve2);
}
// translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), rounded_rectangle_profile(StemTransform(i, keyID),fn=fn,r=StemRadius(i, keyID)))]); //Transition Support for taller profile
}
@ -314,7 +341,8 @@ module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false,
//Fonts
if(Legends == true){
#rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([-1,-5,KeyHeight(keyID)-2.5])linear_extrude(height = 1)text( text = "ver2", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
// #rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])
translate([0,0,KeyHeight(keyID)-5])linear_extrude(height =5)text( text = "A", font = "Calibri:style=Bold", size = 4, valign = "center", halign = "center" );
// #rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([0,-3.5,0])linear_extrude(height = 0.5)text( text = "Me", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
}
//Dish Shape
@ -328,71 +356,54 @@ module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false,
}
}
if(crossSection == true) {
translate([0,-15,-.1])cube([15,30,15]);
translate([0,-15,-.1])cube([15,30,20]);
// translate([-15.1,-15,-.1])cube([15,30,20]);
}
if(homeDot == true)#translate([0,0,KeyHeight(keyID)-DishHeightDif(keyID)-0.1])sphere(r = dotRadius);
if(homeDot == true){
// center dot
#translate([0,0,KeyHeight(keyID)-DishHeightDif(keyID)-0.1])sphere(r = dotRadius); // center dot
// double bar dots
// rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([.75,-4.5,KeyHeight(keyID)-DishHeightDif(keyID)+0.5])sphere(r = dotRadius); // center dot
// rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([-.75,-4.5,KeyHeight(keyID)-DishHeightDif(keyID)+0.5])sphere(r = dotRadius); // center dot
//tri center dots
// #rotate([0,YAngleSkew(keyID),ZAngleSkew(keyID)])translate([0,0,KeyHeight(keyID)-DishHeightDif(keyID)-0.1]){
// rotate([0,0,0])translate([0,.75,0])sphere(r = dotRadius); // center dot
// rotate([0,0,120])translate([0,.75,0])sphere(r = dotRadius); // center dot
// rotate([0,0,240])translate([0,.75,0])sphere(r = dotRadius); // center dot
// }
}
}
//Homing dot
}
//------------------stems
$fn = fn;
function outer_cherry_stem(slop) = [ stemWid - slop * 2, stemLen - slop * 2];
function outer_cherry_stabilizer_stem(slop) = [4.85 - slop * 2, 6.05 - slop * 2];
function outer_box_cherry_stem(slop) = [6 - slop, 6 - slop];
MXWid = 4.03/2+Tol; //horizontal lenght
MXLen = 4.23/2+Tol; //vertical length
// .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],
];
module inside_cherry_cross(slop) {
// inside cross
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-0.005]) {
linear_extrude(height = stemCrossHeight) {
square(cherry_cross(slop, extra_vertical)[0], center=true);
square(cherry_cross(slop, extra_vertical)[1], center=true);
}
}
MXWidT = 1.15/2+Tol; //horizontal thickness
MXLenT = 1.25/2+Tol; //vertical thickness
// Guides to assist insertion and mitigate first layer squishing
{
for (i = cherry_cross(slop, extra_vertical)) hull() {
linear_extrude(height = 0.01, center = false) offset(delta = 0.4) square(i, center=true);
translate([0, 0, 0.5]) linear_extrude(height = 0.01, center = false) square(i, center=true);
}
}
}
function stem_internal(sc=1) = sc*[
[MXLenT, MXLen],[MXLenT, MXWidT],[MXWid, MXWidT],
[MXWid, -MXWidT],[MXLenT, -MXWidT],[MXLenT, -MXLen],
[-MXLenT, -MXLen],[-MXLenT, -MXWidT],[-MXWid, -MXWidT],
[-MXWid,MXWidT],[-MXLenT, MXWidT],[-MXLenT, MXLen]
]; //2D stem cross with tolance offset and additonal transformation via jog
//trajectory();
function StemTrajectory() =
[ trajectory(forward = 5.25) ];
StemPath = quantize_trajectories(StemTrajectory(), steps = 1 , loop=false, start_position= $t*4);
StemCurve = [ for(i=[0:len(StemPath)-1]) transform(StemPath[i], stem_internal()) ];
function StemTrajectory2() =
[trajectory(forward = .5)];
StemPath2 = quantize_trajectories(StemTrajectory2(), steps = 10, loop=false, start_position= $t*4);
StemCurve2 = [for(i=[0:len(StemPath2)-1]) transform(StemPath2[i]*scaling([(1.1-.1*i/(len(StemPath2)-1)),(1.1-.1*i/(len(StemPath2)-1)),1]), stem_internal())];
module cherry_stem(depth, slop) {
D1=.15;
D2=.05;
H1=3.5;
CrossDist = 1.75;
difference(){
// outside shape
linear_extrude(height = depth) {
offset(r=1){
square(outer_cherry_stem(slop) - [2,2], center=true);
}
}
rotate([0,0,stemRot])inside_cherry_cross(slop);
hull(){
translate([CrossDist,CrossDist-.1,0])cylinder(d1=D1, d2=D2, H1);
translate([-CrossDist,-CrossDist+.1,0])cylinder(d1=D1, d2=D2, H1);
}
hull(){
translate([-CrossDist,CrossDist-.1])cylinder(d1=D1, d2=D2, H1);
translate([CrossDist,-CrossDist+.1])cylinder(d1=D1, d2=D2, H1);
}
}
}
module choc_stem() {
@ -452,3 +463,12 @@ function sign_y(i,n) =
i > 0 && i < n/2 ? 1 :
i > n/2 ? -1 :
0;
//#square([18.16, 18.16], center = true);
//#square([41.3, 19.05], center = true);
//scale(1.03)difference(){// assume 1% from infill and 2% for easy removal
//translate([0,0,13/2+.1])cube([21,21,13], center = true);
//
// projection()
// translate([0,28,0])rotate([0,-90,0]){
//translate([0,0,0])mx_master_base(xu = 7, yu = 1 );

View file

@ -10,72 +10,55 @@ use <skin.scad>
Version 2: Eliptical Rectangle
*/
//#square([18.16, 18.16], center = true);
//#square([36.3, 19.05], center = true);
mirror([0,0,0])keycap(
keyID = 3, //change profile refer to KeyParameters Struct
cutLen = 0, //Don't change. for chopped caps
Stem = true, //tusn on shell and stems
Dish = true, //turn on dish cut
Stab = 0,
visualizeDish = false, // turn on debug visual of Dish
crossSection = false, // center cut to check internal
homeDot = false, //turn on homedots
Legends = false
);
mirror([1,0,0])keycap(keyID = 18, cutLen = 0, Stem =true, Dish = true, Stab = 0 , veisualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([-19,0,0])keycap(keyID = 3, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([19,0,0])mirror([0,0,0])keycap(keyID = 5, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([19*.5,19,0])mirror([1,0,0])keycap(keyID = 6, cutLen = 0, Stem =true, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//n translate([0,19, 0])keycap(keyID = 3, cutLen = 0, Stem =true, Dish = true, visualizeDish = true, crossSection = true, homeDot = false, Legends = false);
// translate([0,38, 0])mirror([0,1,0])keycap(keyID = 2, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = true, homeDot = false, Legends = false);
//Low Pro rows
//for(cap = [8:10]){
////translate([19, 19*(cap-8), 0])keycap(keyID = cap, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
/*corne thumb hi pro*/
//color("royalblue")translate([-0,33,0]){
// translate([-15, -4, 0])rotate([0,0,30])mirror([1,0,0])keycap(keyID = 0, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([6, 0, 0])rotate([0,0,15])keycap(keyID = 1, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([26, 2.2, 0])rotate([0,0,0])keycap(keyID = 2, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//}
//for(cap = [12:15]){
//translate([-0, 19*(cap-12), 0])keycap(keyID = cap, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
//}
//translate([-19, 19*(3), 0])keycap(keyID = 6, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = true,Legends = false);
//
//for(cap = [64:68]){
//translate([0, 19*(cap-64), 0])keycap(keyID = cap, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = false,Legends = false);
//}
//for(cap = [20:24]){
//translate([0, 19*(cap-20), 0])keycap(keyID = cap, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = true,Legends = false);
//}
//translate([19, 19*(2), 0])keycap(keyID = 25, cutLen = 0, Stem = false, Dish = true, visualizeDish = false, crossSection = true,Legends = false);
//////corne thumb
// translate([-15, -4, 0])rotate([0,0,30])keycap(keyID = 0, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([6, 0, 0])rotate([0,0,15])keycap(keyID = 4, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([26, 2.2, 0])rotate([0,0,0])keycap(keyID = 8, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//LOW pro
/*corne thumb low pro*/
//color("gray"){
// translate([-15, -4, 0])rotate([0,0,30])keycap(keyID =3, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false);
// translate([6, 0, 0])rotate([0,0,15])keycap(keyID = 4, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false);
// translate([26, 2.2, 0])rotate([0,0,0])keycap(keyID = 5, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false);
//DM Thumb
// top row
//mirror([1,0,0]){
//translate([-39, 0, 0])rotate([0,0,30])translate([0, -1, 0])mirror([1,0,0])keycap(keyID = 7, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//translate([-17, 0, 0])rotate([0,0,30])translate([0, 10, 0])mirror([0,0,0])keycap(keyID = 7, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//
////bottom row
//translate([-39, 0, 0])rotate([0,0,30])translate([0,-19.5, 0])keycap(keyID = 16, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false);
//translate([-17, 0, 0])rotate([0,0,30])translate([0,-8.5, 0])mirror([0,0,0])keycap(keyID = 17, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false);
//
////inner
// translate([-3, 16, 0])rotate([0,0,15])keycap(keyID = 18, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([6, 0, 0])rotate([0,0,15])keycap(keyID = 6, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false);
// translate([26, 2.2, 0])rotate([0,0,0])keycap(keyID = 7, cutLen = 0, Stem =true, Dish = true, visualizeDish = false, crossSection = false);
//}
/*kyria Thumb*/
//// translate([-39, 0, 0])rotate([0,0,30])translate([0,-19.5, 0])keycap(keyID = 15 , cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([-39, 0, 0])rotate([0,0,30])translate([0,-19.5, 0])keycap(keyID = 13, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([-39, 0, 0])rotate([0,0,30])translate([0,0, 0])keycap(keyID = 14, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//// translate([-39, 0, 0])rotate([0,0,30])translate([0, -1, 0])keycap(keyID = 13, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// // translate([-17, 0, 0])rotate([0,0,30])translate([0, 1 , 0])keycap(keyID = 12, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([-17, 0, 0])rotate([0,0,30])translate([0,-8.5, 0])mirror([1,0,0])keycap(keyID = 16, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([-17, 0, 0])rotate([0,0,30])translate([0, 10, 0])mirror([1,0,0])keycap(keyID = 17, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([6, 0, 0])rotate([0,0,15])keycap(keyID = 18, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([26, 2.2, 0])rotate([0,0,0])keycap(keyID = 19, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//#translate([0,38,13])cube([18-5.7, 18-5.7,1],center = true);
//echo(len(keyParameters));
//Parameters
wallthickness = 1.25; // 1.5 for norm, 1.25 for cast master
topthickness = 2.75; // 3 for norm, 2.5 for cast master
wallthickness = 2; // 1.5 for norm, 1.25 for cast master
topthickness = 2.5; // 3 for norm, 2.5 for cast master
stepsize = 50; //resolution of Trajectory
step = 2; //resolution of ellipes
fn = 32; //resolution of Rounded Rectangles: 60 for output
step = 6; //resolution of ellipes
fn = 16; //resolution of Rounded Rectangles: 60 for output
layers = 40; //resolution of vertical Sweep: 50 for output
dotRadius = 1.25; //home dot size
//---Stem param
slop = 0.40;
Tol = 0.10;
stemRot = 0;
stemWid = 7.2;
stemLen = 5.5;
@ -88,39 +71,44 @@ keyParameters = //keyParameters[KeyID][ParameterID]
[
// BotWid, BotLen, TWDif, TLDif, keyh, WSft, LSft XSkew, YSkew, ZSkew, WEx, LEx, CapR0i, CapR0f, CapR1i, CapR1f, CapREx, StemEx
//corne thumb high pro
[17.16, 26.66, 6, 7, 13, 0, 0, -13, 10, -5, 2, 2, 1, 4.85, 1, 3, 2, 2], //R5 0 Corne thumb
[17.16, 17.16, 4, 5, 14, 0, 0, -13, 5, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 corne thumb
[17.16, 17.16, 4, 6, 15, 0, 0, -13, 10, 15, 2, 2, 1, 5, 1, 2, 2, 2], //R5 corne thumb
//Low profile corne 3
[17.16, 26.66, 6, 7, 12, 0, 0, -0, 10, -5, 2, 2, 1, 4.85, 1, 3, 2, 2], //R5 1.5 Corne thumb
[17.16, 17.16, 4, 5, 11, 0, 0, -0, 5, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 corne thumb
[17.16, 17.16, 4, 6, 13, 0, 0, -0, 10, 15, 2, 2, 1, 5, 1, 2, 2, 2], //R5 corne thumb
//Low profile corne thumb
[17.16, 26.66, 6, 7, 9.0, 0, 0, -8, 10, -5, 2, 2, 1, 4.85, 1, 3, 2, 2], //T1R5 external rot 3
[17.16, 26.66, 6, 7, 9.0, 0, 0, -8, 10, -0, 2, 2, 1, 4.85, 1, 3, 2, 2], //T1R5 nuetral
[17.16, 26.66, 6, 7, 9.0, 0, 0, -8, 10, 5, 2, 2, 1, 4.85, 1, 3, 2, 2], //T1R5 internal rot Corne thumb
[17.16, 17.16, 4, 5, 10., 0, 0, -12, 5, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 corne thumb
[17.16, 17.16, 4, 6, 11, 0, 0, -12, 10, 15, 2, 2, 1, 5, 1, 2, 2, 2], //R5 corne thumb
//Column high sculpt 3 row system 8
//Column high sculpt 3 row system
[17.16, 17.16, 6.5, 6.5,10.55, 0, 0, 9, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4 8
[17.16, 17.16, 6.5, 6.5, 8.75, 0, .5, 4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 9.75, 0, 0, -13, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[17.16, 17.16, 6.5, 6.5, 8.75, 0, 0, 4, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 deepdish
//Column 0 high sculpt 3 row system 13
[17.16, 17.16, 6.5, 6.5,11.55, .5, 0, 9, -8, 5, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4 8
[17.16, 17.16, 6.5, 6.5,11.55, .5, 0, 9, -8, -5, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4 8
[17.16, 17.16, 6.5, 6.5, 9.75, .5, .5, 4, -9, -5, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5,10.75, .5, 0, -13, -8, -5, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
//DM 16 ~ 19
[17.16, 17.16, 6, 5, 7.5, -.0, 0, -3, 3, -15, 2, 2, 1, 5, 1, 3, 2, 2], //T0R1 1u
[17.16, 17.16, 6, 5, 8, -.0, 0, -5, 0, -10, 2, 2, 1, 5, 1, 3.5, 2, 2], //T0R2 1u
[17.16, 17.16, 4, 6, 12, .5, 0, -8, 18, 0, 2, 2, 1, 5, 1, 2, 2, 2], //T1R1 1u
//kyria Thumbs 13 ~ 19
[17.16, 35.56, 4, 7, 13.5, 0, 0, -8, 5, 0, 2, 2, 1, 6., 1, 3.5, 2, 2], //T0R1 2u
[17.16, 17.16, 6, 5, 11, -.5, 0, -9, 7, 10, 2, 2, 1, 5, 1, 3, 2, 2], //T0R1 1u
[17.16, 17.16, 6, 5, 13, -.5, 0, -9, 7, 5, 2, 2, 1, 5, 1, 3.5, 2, 2], //T0R2 1u
[17.16, 35.56, 6, 7, 11, 0, 0, -8, 10, -5, 2, 2, 1, 4.85, 1, 3.5, 2, 2], //T1R1 2u
[17.16, 17.16, 4, 6, 12, .5, 0, -13, -7, 10, 2, 2, 1, 5, 1, 2, 2, 2], //T1R1 1u
[17.16, 17.16, 6, 5, 15, -.5, 0, -9, -7, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //T1R2 1u
[17.16, 17.16, 4, 6, 13, .5, 0, -13, 10, 15, 2, 2, 1, 5, 1, 2, 2, 2], //T2R1
[17.16, 17.16, 4, 6, 13, 0, 0, -8, 10, 20, 2, 2, 1, 5, 1, 2, 2, 2], //T3R1
//lowest profile
[17.16, 17.16, 6.5, 6.5, 7.25, 0, 0, 3, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R4 6
[17.16, 17.16, 6.5, 6.5, 7, 0, .5, .001, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 7.25, 0, -.25, -5, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R2
[17.16, 17.16, 6.5, 6.5, 7, 0, .5, .001, 0, 0, 2, 2, 1, 5, 1, 3.5, 2, 2], //R3 deepdish
];
dishParameters = //dishParameter[keyID][ParameterID]
[
//FFwd1 FFwd2 FPit1 FPit2 DshDep DshHDif FArcIn FArcFn FArcEx BFwd1 BFwd2 BPit1 BPit2 BArcIn BArcFn BArcEx
//higt corne thumb
[ 8, 4.5, 7, -39, 4, 1.8, 9.5, 15, 2, 10, 4, 8, -30, 9.5, 20, 2], //R5
[ 5, 4.3, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 13, -30, 10.5, 18, 2], //R5
[ 5, 4.3, 5, -48, 4, 1.9, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //R5
[ 8, 5, -1, -39, 4, 1.8, 9.5, 15, 2, 10, 4, 8, -30, 9.5, 20, 2], //R5
[ 5, 4.3, -2, -48, 5, 2, 10.5, 10, 2, 6, 4, 13, -30, 10.5, 18, 2], //R5
[ 5, 4.3, -2, -48, 4, 1.9, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //R5
[ 8.5, 5.0, 7, -39, 4, 1.9, 9.5, 15, 2, 10, 4, 8, -30, 9.5, 20, 2], //R5
[ 8.3, 5.0, 7, -39, 4, 1.9, 9.5, 15, 2, 10, 4, 8, -30, 9.5, 20, 2], //R5
@ -133,15 +121,20 @@ dishParameters = //dishParameter[keyID][ParameterID]
[ 5, 3.5, 10, -55, 5, 1.8, 8.5, 15, 2, 5, 3.7, 10, -55, 8.5, 15, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R2
[ 4.8, 3.3, 18, -55, 5, 2.0, 8.5, 15, 2, 4.8, 3.3, 18, -55, 8.5, 15, 2], //R3 deep
//C0
[ 6, 3, 18, -50, 5, 1.8, 9.1, 17, 2, 5, 4.4, 5, -55, 9.1, 15, 2], //R4
[ 6, 3, 18, -50, 5, 1.8, 9.1, 15, 2, 5, 4.4, 5, -55, 9.1, 15, 2], //R4
[ 5, 3.5, 10, -55, 5, 1.8, 9.0, 15, 2, 5, 3.7, 10, -55, 9.0, 15, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 9.1, 15, 2, 6, 4, 13, 30, 9.1, 16, 2], //R2
//kyria
[ 13, 5.5, 5, -40, 4, 1.8, 10.5, 30, 2, 12, 8, 5, -5, 10.5, 40, 2], //T1R1 2u
[ 5, 4.4, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 2, -30, 10.5, 18, 2], //T0R1 1u
[ 5, 4.3, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 2, -30, 10.5, 18, 2], //T0R2 1u
[ 13, 4.5, 7, -39, 4, 1.8, 10.5, 15, 2, 13, 4, 8, -30, 10.5, 20, 2], //T1R1 2u
[ 5, 4.4, 5, -48, 4, 1.9, 11, 12, 2, 5.5, 3.5, 8, -50, 11, 28, 2], //T1R1 1u
[ 5, 4.3, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 2, -30, 10.5, 18, 2], //T1R2 1u
[ 5, 4.4, 5, -48, 4, 1.9, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //T2R1
[ 5, 4.4, 5, -48, 4, 1.9, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //T3R1
// low pro mil sculpt 3 row system
[ 6, 3, 18, -50, 5, 1.8, 8.8, 15, 2, 5, 4.4, 5, -55, 8.8, 15, 2], //R4
[ 5, 3.8, 8, -55, 5, 1.8, 8.5, 15, 2, 5, 4.2, 8, -55, 8.5, 15, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R2
[5.25, 3., 16, -55, 5, 1.8, 8.5, 15, 2, 5.25, 3.1, 16, -55, 8.5, 15, 2], //R3 deep
];
function FrontForward1(keyID) = dishParameters[keyID][0]; //
@ -182,13 +175,13 @@ function StemExponent(keyID) = keyParameters[keyID][17];
function FrontTrajectory(keyID) =
[
trajectory(forward = FrontForward1(keyID), pitch = FrontPitch1(keyID)), //more param available: yaw, roll, scale
trajectory(forward = FrontForward1(keyID), pitch = FrontPitch1(keyID), roll = 0), //more param available: yaw, roll, scale
trajectory(forward = FrontForward2(keyID), pitch = FrontPitch2(keyID)) //You can add more traj if you wish
];
function BackTrajectory (keyID) =
[
trajectory(forward = BackForward1(keyID), pitch = BackPitch1(keyID)),
trajectory(forward = BackForward1(keyID), pitch = BackPitch1(keyID), roll = -0, yaw = 0),
trajectory(forward = BackForward2(keyID), pitch = BackPitch2(keyID)),
];
@ -303,13 +296,13 @@ module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false,
}
}
if(Stem == true){
translate([0,0,StemBrimDep])cherry_stem(KeyHeight(keyID)-StemBrimDep, slop); // generate mx cherry stem, not compatible with box
if (Stab != 0){
translate([Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
translate([-Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
//TODO add binding support?
translate([0,0,StemBrimDep])rotate(stemRot)difference(){
//cylinderical Stem body
cylinder(d =5.5,KeyHeight(keyID)-StemBrimDep, $fn= 32);
skin(StemCurve);
skin(StemCurve2);
}
// translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), rounded_rectangle_profile(StemTransform(i, keyID),fn=fn,r=StemRadius(i, keyID)))]); //Transition Support for taller profile
}
//cut for fonts and extra pattern for light?
}
@ -340,61 +333,37 @@ module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false,
}
//------------------stems
$fn = fn;
function outer_cherry_stem(slop) = [ stemWid - slop * 2, stemLen - slop * 2];
function outer_cherry_stabilizer_stem(slop) = [4.85 - slop * 2, 6.05 - slop * 2];
function outer_box_cherry_stem(slop) = [6 - slop, 6 - slop];
MXWid = 4.03/2+Tol; //horizontal lenght
MXLen = 4.23/2+Tol; //vertical length
// .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],
];
module inside_cherry_cross(slop) {
// inside cross
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-0.005]) {
linear_extrude(height = stemCrossHeight) {
square(cherry_cross(slop, extra_vertical)[0], center=true);
square(cherry_cross(slop, extra_vertical)[1], center=true);
}
}
MXWidT = 1.15/2+Tol; //horizontal thickness
MXLenT = 1.25/2+Tol; //vertical thickness
// Guides to assist insertion and mitigate first layer squishing
{
for (i = cherry_cross(slop, extra_vertical)) hull() {
linear_extrude(height = 0.01, center = false) offset(delta = 0.4) square(i, center=true);
translate([0, 0, 0.5]) linear_extrude(height = 0.01, center = false) square(i, center=true);
}
}
}
function stem_internal(sc=1) = sc*[
[MXLenT, MXLen],[MXLenT, MXWidT],[MXWid, MXWidT],
[MXWid, -MXWidT],[MXLenT, -MXWidT],[MXLenT, -MXLen],
[-MXLenT, -MXLen],[-MXLenT, -MXWidT],[-MXWid, -MXWidT],
[-MXWid,MXWidT],[-MXLenT, MXWidT],[-MXLenT, MXLen]
]; //2D stem cross with tolance offset and additonal transformation via jog
//trajectory();
function StemTrajectory() =
[
trajectory(forward = 5.25) //You can add more traj if you wish
];
StemPath = quantize_trajectories(StemTrajectory(), steps = 1 , loop=false, start_position= $t*4);
StemCurve = [ for(i=[0:len(StemPath)-1]) transform(StemPath[i], stem_internal()) ];
function StemTrajectory2() =
[
trajectory(forward = .5) //You can add more traj if you wish
];
StemPath2 = quantize_trajectories(StemTrajectory2(), steps = 10, loop=false, start_position= $t*4);
StemCurve2 = [ for(i=[0:len(StemPath2)-1]) transform(StemPath2[i]*scaling([(1.1-.1*i/(len(StemPath2)-1)),(1.1-.1*i/(len(StemPath2)-1)),1]), stem_internal()) ];
module cherry_stem(depth, slop) {
D1=.15;
D2=.05;
H1=3.5;
CrossDist = 1.75;
difference(){
// outside shape
linear_extrude(height = depth) {
offset(r=1){
square(outer_cherry_stem(slop) - [2,2], center=true);
}
}
rotate([0,0,stemRot])inside_cherry_cross(slop);
hull(){
translate([CrossDist,CrossDist-.1,0])cylinder(d1=D1, d2=D2, H1);
translate([-CrossDist,-CrossDist+.1,0])cylinder(d1=D1, d2=D2, H1);
}
hull(){
translate([-CrossDist,CrossDist-.1])cylinder(d1=D1, d2=D2, H1);
translate([CrossDist,-CrossDist+.1])cylinder(d1=D1, d2=D2, H1);
}
}
}
module choc_stem() {

View file

@ -0,0 +1,572 @@
use <scad-utils/morphology.scad> //for cheaper minwoski
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <scad-utils/trajectory.scad>
use <scad-utils/trajectory_path.scad>
use <sweep.scad>
use <skin.scad>
use <z-butt.scad>
//TODOs
//add shell towards bottom to make it rounder
//add o-ring portion
//add variable radius for outer fillet
//Fanning? for thumbs
//MX stem
//enum
Choc = 0;
MX = 1;
Null =2;
// override Z-butt param
lp_key = [
// "base_sx", 18.5,
// "base_sy", 18.5,
"base_sx", 17.65,
"base_sy", 16.5,
"cavity_sx", 16.1,
"cavity_sy", 14.9,
"cavity_sz", 1.6,
"cavity_ch_xy", 1.6,
"indent_inset", 1.5
];
/*Tester */
//translate([0,0,0])lp_master_base(xu = 2, yu = 1 );
translate([0, 0, -.05])rotate([0,0,0])mirror([0,1,0]){
// keycap(keyID = 6, cutLen = 0, Stem = Choc, Dish = false, SecondaryDish = false, visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
}
translate([0, -8, -.05])rotate([0,0,0])mirror([0,0,0]){
keycap(keyID = 6, cutLen = 0, Stem = Choc, Dish = false, SecondaryDish = false, visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
}
// translate([14, 14, 0])rotate([0,0,90]) keycap(keyID = 0, cutLen = 0, Stem =true, Dish = true, SecondaryDish = false,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
// translate([0, 14, 0])rotate([0,0,90]) keycap(keyID = 0, cutLen = 0, Stem =true, Dish = true, SecondaryDish = false,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
// translate([14, 0, 0])rotate([0,0,90]) keycap(keyID = 0, cutLen = 0, Stem =true, Dish = true, SecondaryDish = false,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//translate([-18, 0, 10])rotate([0,0,90])mirror([0,0,0])keycap(keyID = 2, cutLen = 0, Stem =true, Dish = false, SecondaryDish = false,Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//#translate([0,0,0])cube([14, 14, 2], center = true); // internal check
//#translate([1,0,0])cube([12, 14, 4], center = true); // internal check
//#translate([2,0,0])cube([11, 14, 4], center = true); // internal check
//#translate([0,0,5])cube([19.05, 19.05, 10], center = true); // internal check
//#translate([0,0,0])cube([17.5, 16.5, 10], center = true); // internal check
ChocCut = 0;
thumbStem = true;
thumbDish = true;
thumbVis = false;
thumbSec = false;
//-Parameters
wallthickness = 1.1; // 1.75 for mx size, 1.1
topthickness = 2.5; //2 for phat 3 for chicago
stepsize = 60; //resolution of Trajectory
step =2; //resolution of ellipes
fn = 16; //resolution of Rounded Rectangles: 60 for output
layers = 20; //resolution of vertical Sweep: 50 for output
angularSteps = 20;
//---Stem param
//injection param
draftAngle = 0; //degree note:Stem Only
Tol = 0.10; //stem tolarance
stemRot = 0;
stemRad = 5.55; // stem outer radius
stemLen = 5.55 ;
stemCrossHeight = 4;
extra_vertical = 0.6;
StemBrimDep = 0.25;
stemLayers = 50; //resolution of stem to cap top transition
//TODO: Add wall thickness transition?
keyParameters = //keyParameters[KeyID][ParameterID]
[
// BotWid, BotLen, TWDif, TLDif, keyh, WSft, LSft XSkew, YSkew, ZSkew,/*|*/ WEx, LEx, CapR0i, CapR0f, CapR1i, CapR1f, CapREx, StemEx, chop shift
//Column 0
//set R2 14x14 choc trantisiton
[12.90, 12.90, 3.0, 3.0, 2.5, 0.0, 0.0, 0.0, -0, -0,/*|*/ 2, 2, 1, 3, 1, 3, 2, 2, 0], //R2 Top surface
[12.40, 12.40, 5.0, 8.0,-0.75, 0.0, 0.0, 0.0, -0, -0,/*|*/ 1, 1, 2, 3, 2, 3, 2, 2, 0], //R2 Bottom Choc surface
[12.40, 12.40, 5.0, 8.0,-0.75, 0.0, 0.0, 0.0, -0, -0,/*|*/ 1, 1, 2, 3, 2, 3, 2, 2, 0], //R2 Bottom MX surface
//MX chop
[12.40, 10.40, 3.0, 3.0, 2.5, 0.0, 0.0, 0.0, -0, -0,/*|*/ 2, 2, 2, 3, 2, 3, 2, 2, -1], //R3 Chop Top surface
[12.40, 10.40, 5.0, 6.0,-0.75, 0.0, -1.0, 0.0, -0, -0,/*|*/ .5, 1.2, 2, 1, 2, 1, 2, 2, -1], //R3 Chop Bottom surface
[12.40, 10.40, 12.40-5.5, 10.40-5.5,-0.5, 0.0, -1.0, 0.0, -0, -0,/*|*/ 1, 1, 2, 5.5, 2, 5.5, 2, 2, -1], //R3 MX Bottom surface
//Choc Chop
[12.40, 9.40, 3.0, 3.0, 2.5, 0.0, 0.0, 0.0, -0, -0,/*|*/ 2, 2, 2, 3, 2, 3, 2, 2, -2], //R3 Chop Top surface
[12.40, 9.40, 5.0, 6.0,-0.75, 0.0, -2.0, 0.0, -0, -0,/*|*/ 2, 2, 2, 1, 2, 1, 2, 2, -2], //R3 Chop Bottom surface
[12.40, 9.40, 12.40-5.5, 10.40-5.5,-0.5, 0.0, -1.0, 0.0, -0, -0,/*|*/ 1, 1, 2, 5.5, 2, 5.5, 2, 2, -1], //R3 MX Bottom surface
[17.20, 16.00, 5.6, 5.0, 4.6, 0, .0, 0, -0, -0, 2, 2.5, .10, 3, .10, 3, 2, 2, 0], //R3 bottom
//Thumb
[17.20, 16.00, 4.25, 3.25, 5.0, -.5, 0.0, -3, -3, -0, 2, 2, .10, 2, .10, 2, 2, 2], //Thumb 1
[15.65, 26.4, 5.5, 3.25, 4.9, -.5, 0.0, -3, -2, -2, 2, 2, .3, 2, .3, 2.5, 2, 2], //Thumb 1.5
[15.65, 35.8, 4.25, 3.25, 4.9, -.25, 0.0, -2.5, -4, -2, 2, 3, .3, 2, .3, 2.5, 2, 2], //Thumb 2.0
//1.25 5
];
dishParameters = //dishParameter[keyID][ParameterID]
[
//FFwd1 FFwd2 FPit1 FPit2 DshDep DshHDif FArcIn FArcFn FArcEx BFwd1 BFwd2 BPit1 BPit2 BArcIn BArcFn BArcEx FTani FTanf BTani BTanf TanEX PhiInit PhiFin phiEX
//Column 0
[ 4, 4.5, 3, -50, 7, 1.7, 11, 17, 2, /*|*/ 4.5, 4, 2, -35, 11, 15, 2, 2, 3, 2, 3, 2, 203, 198, 2], //full
[ 4.5, 4, 5, -40,7,1.7,11,15,2,4.5,4,5,-40,11,15,2,4,5,4,5,2, 200, 210,2], //Chicago Steno R3 flat
[ 4.5, 4, 5, -40, 7, 1.7, 11, 15, 2, 4.5, 4, 5, -40, 11, 15, 2, 4, 5, 4, 5, 2, 200, 210,2], //Chicago Steno R3 flat
[3.5, 4.5, 3, -30, 7, 1.7, 11, 17, 2, /*|*/ 3., 3, 2.2, -60, 11, 15, 2, 2, 3, 2, 3, 2, 203, 194, 2], //Chop
[ 4.5,4,5,-40,7,1.7,11,15,2,4.5,4,5,-40,11,15,2,4,5,4,5,2, 200, 210,2], //
[ 4.5,4,5,-40,7,1.7,11,15,2,4.5,4,5,-40,11,15,2,4,5,4,5,2, 200, 210,2], //
[ 4, 5.5, 6, -60, 7, 1.7, 11, 17, 2, /*|*/ 2.5, 2, -6, -180, 11, 17, 2, 2, 3, 2, 3, 2, 203, 194, 2], //Chop
[ 4.5,4,5,-40,7,1.7,11,15,2,4.5,4,5,-40,11,15,2,4,5,4,5,2, 200, 210,2], //
[ 4.5,4,5,-40,7,1.7,11,15,2,4.5,4,5,-40,11,15,2,4,5,4,5,2, 200, 210,2], //
//Chicago Steno R3 flat
[ 5, 5.5, 0, -40, 7, 1.7, 16, 18, 2, 5.5, 3.5, 5, -50, 16, 18, 2, 5, 3.75, 2, 3.75, 2, 199, 210], //T1
[ 10, 4.5, 0, -40, 7, 1.7, 16, 15, 2, 10, 3.5, 5, -50, 16, 18, 2, 3, 3.75, .75, 3.75, 2, 200, 210], //1.5u
[ 14.5, 4.5, 4, -40, 7, 1.7, 16, 18, 2, 14.5, 4.5, 2, -35, 16, 23, 2, 3, 3.75, .75, 3.75, 2, 200, 210], //2.0u
];
SecondaryDishParam =
[
[ 6, 3.5, 7, -50, 3, 2, 8, 8, 2, 5, 5, 5, 15, 10, 20, 2], //Chicago Steno R2/R4
[ 6, 3.5, 7, -50, 3, 2.5, 8, 20, 3, 2, 4.2, 8, 0, 8, 8, 3], //Chicago Steno R3 flat
[ 6, 3.5, 7, -50, 3, 2.5, 8, 20, 3, 2, 4.2, 8, 0, 8, 8, 3], //Chicago Steno R3 chord
[ 6, 3.5, 7, -50, 3, 2, 8, 8, 2, 5, 5, 5, 15, 10, 20, 2], //Levee Steno R2/R4
[ 6, 3.5, 7, -50, 5, 1.0, 16, 23, 2, 6, 3.5, 7, -50, 16, 23, 2], //Levee Steno R2/R4
[ 6, 3.5, 7, -50, 5, 1.0, 16, 23, 2, 6, 3.5, 7, -50, 16, 23, 2], //Levee Steno R2/R4
[ 6, 3.5, 7, -50, 5, 1.0, 16, 23, 2, 6, 3.5, 7, -50, 16, 23, 2], //Levee Steno R2/R4
[ 6, 3.5, 7, -50, 5, 1.0, 16, 23, 2, 6, 3.5, 7, -50, 16, 23, 2], //Levee Steno R2/R4
[ 6, 3.5, 7, -50, 5, 1.0, 16, 23, 2, 6, 3.5, 7, -50, 16, 23, 2], //Levee Steno R2/R4
];
function BottomWidth(keyID) = keyParameters[keyID][0]; //
function BottomLength(keyID) = keyParameters[keyID][1]; //
function TopWidthDiff(keyID) = keyParameters[keyID][2]; //
function TopLenDiff(keyID) = keyParameters[keyID][3]; //
function KeyHeight(keyID) = keyParameters[keyID][4]; //
function TopWidShift(keyID) = keyParameters[keyID][5];
function TopLenShift(keyID) = keyParameters[keyID][6];
function XAngleSkew(keyID) = keyParameters[keyID][7];
function YAngleSkew(keyID) = keyParameters[keyID][8];
function ZAngleSkew(keyID) = keyParameters[keyID][9];
function WidExponent(keyID) = keyParameters[keyID][10];
function LenExponent(keyID) = keyParameters[keyID][11];
function CapRound0i(keyID) = keyParameters[keyID][12];
function CapRound0f(keyID) = keyParameters[keyID][13];
function CapRound1i(keyID) = keyParameters[keyID][14];
function CapRound1f(keyID) = keyParameters[keyID][15];
function ChamExponent(keyID) = keyParameters[keyID][16];
function StemExponent(keyID) = keyParameters[keyID][17];
function ChopShift(keyID) = keyParameters[keyID][18];
function FrontForward1(keyID) = dishParameters[keyID][0]; //
function FrontForward2(keyID) = dishParameters[keyID][1]; //
function FrontPitch1(keyID) = dishParameters[keyID][2]; //
function FrontPitch2(keyID) = dishParameters[keyID][3]; //
function DishDepth(keyID) = dishParameters[keyID][4]; //
function DishHeightDif(keyID) = dishParameters[keyID][5]; //
function FrontInitArc(keyID) = dishParameters[keyID][6];
function FrontFinArc(keyID) = dishParameters[keyID][7];
function FrontArcExpo(keyID) = dishParameters[keyID][8];
function BackForward1(keyID) = dishParameters[keyID][9]; //
function BackForward2(keyID) = dishParameters[keyID][10]; //
function BackPitch1(keyID) = dishParameters[keyID][11]; //
function BackPitch2(keyID) = dishParameters[keyID][12]; //
function BackInitArc(keyID) = dishParameters[keyID][13];
function BackFinArc(keyID) = dishParameters[keyID][14];
function BackArcExpo(keyID) = dishParameters[keyID][15];
function ForwardTanInit(keyID)= dishParameters[keyID][16];
function ForwardTanFin(keyID) = dishParameters[keyID][17];
function BackTanInit(keyID) = dishParameters[keyID][18];
function BackTanFin(keyID) = dishParameters[keyID][19];
function TanArcExpo(keyID) = dishParameters[keyID][20];
function TransitionAngleInit(keyID) = dishParameters[keyID][21];
function TransitionAngleFin(keyID) = dishParameters[keyID][22];
function TransitionAngleExpo(keyID) = dishParameters[keyID][23];
function SFrontForward1(keyID) = SecondaryDishParam[keyID][0]; //
function SFrontForward2(keyID) = SecondaryDishParam[keyID][1]; //
function SFrontPitch1(keyID) = SecondaryDishParam[keyID][2]; //
function SFrontPitch2(keyID) = SecondaryDishParam[keyID][3]; //
function SDishDepth(keyID) = SecondaryDishParam[keyID][4]; //
function SDishHeightDif(keyID) = SecondaryDishParam[keyID][5]; //
function SFrontInitArc(keyID) = SecondaryDishParam[keyID][6];
function SFrontFinArc(keyID) = SecondaryDishParam[keyID][7];
function SFrontArcExpo(keyID) = SecondaryDishParam[keyID][8];
function SBackForward1(keyID) = SecondaryDishParam[keyID][9]; //
function SBackForward2(keyID) = SecondaryDishParam[keyID][10]; //
function SBackPitch1(keyID) = SecondaryDishParam[keyID][11]; //
function SBackPitch2(keyID) = SecondaryDishParam[keyID][12]; //
function SBackInitArc(keyID) = SecondaryDishParam[keyID][13];
function SBackFinArc(keyID) = SecondaryDishParam[keyID][14];
function SBackArcExpo(keyID) = SecondaryDishParam[keyID][15];
function FrontTrajectory(keyID) =
[
trajectory(forward = FrontForward1(keyID), pitch = FrontPitch1(keyID)), //more param available: yaw, roll, scale
trajectory(forward = FrontForward2(keyID), pitch = FrontPitch2(keyID)) //You can add more traj if you wish
];
function BackTrajectory (keyID) =
[
trajectory(backward = BackForward1(keyID), pitch = -BackPitch1(keyID)),
trajectory(backward = BackForward2(keyID), pitch = -BackPitch2(keyID)),
];
function SFrontTrajectory(keyID) =
[
trajectory(forward = SFrontForward1(keyID), pitch = SFrontPitch1(keyID)), //more param available: yaw, roll, scale
trajectory(forward = SFrontForward2(keyID), pitch = SFrontPitch2(keyID)), //You can add more traj if you wish
];
function SBackTrajectory (keyID) =
[
trajectory(forward = SBackForward1(keyID), pitch = SBackPitch1(keyID)),
trajectory(forward = SBackForward2(keyID), pitch = SBackPitch2(keyID)),
trajectory(forward = 4, pitch = -15),
trajectory(forward = 6, pitch = -5),
];
//------- function defining Dish Shapes,
//helper function
function flip (singArry) = [for(i = [len(singArry)-1:-1:0]) singArry[i]];
function mirrorX (singArry) = [for(i = [len(singArry)-1:-1:0]) [-singArry[i][0], singArry[i][1]]];
function mirrorY (singArry) = [for(i = [len(singArry)-1:-1:0]) [singArry[i][0], -singArry[i][1]]];
//function ()
function Fade (Arry1, Arry2, t, steps, pows) =len(Arry1)==len(Arry2) ? [for(i = [0:len(Arry1)-1]) (1-pow(t/steps, pows))*Arry1[i]+pow(t/steps, pows)*Arry2[i]]: [[0,0]];
function Mix (a, b, t, steps, pows)= (1-pow(t/steps, pows))*a+pow(t/steps, pows)*b;
function smoothStart (init, fin, t, steps, power) =
(1-pow(t/steps,power))*init + pow(t/steps,power)*fin ;
function smoothStop (init, fin, t, steps, power) =
(fin-init)*(1-pow(1-t/steps,power))+init;
function ellipse(a, b, d = 0, rot1 = 0, rot2 = 360) = [for (i =[0:angularSteps]) let(t = smoothStart(rot1,rot2,i,angularSteps,1)) [a*cos(t)+a, b*sin(t)*(1+d*cos(t))]]; //Centered at a apex to avoid inverted face
function DishShape (a,b,c,d) =
concat(
// [[c+a,b]],
ellipse(a, b, d = 0,rot1 = 90, rot2 = 270)
// [[c+a,-b]]
);
function DishShape2 (a,b, phi = 200, theta, r) =
concat(
// [[c+a,b]],
mirrorY([[a,b*sin(phi)-r*sin(theta)*2]]), //bounday vertex to clear ends
mirrorY([for (t = [step:step*2:theta])let( sig = atan(a*cos(phi)/-b*sin(phi)))
[ r*cos(-atan(-a*cos(phi)/b*sin(phi))-t)
+a*cos(phi)
-r*cos(sig)
+a,
r*sin(-atan(-a*cos(phi)/b*sin(phi))-t)
+b*sin(phi)
+r*sin(sig)]
]),
(mirrorY(ellipse(a, b, d = 0,rot1 = 180, rot2 = phi))),
ellipse(a, b, d = 0,rot1 = 180, rot2 = phi),
[for (t = [step:step*2:theta])let( sig = atan(a*cos(phi)/-b*sin(phi)))
[ r*cos(-atan(-a*cos(phi)/b*sin(phi))-t)
+a*cos(phi)
-r*cos(sig)
+a,
r*sin(-atan(-a*cos(phi)/b*sin(phi))-t)
+b*sin(phi)
+r*sin(sig)]
],
[[a,b*sin(phi)-r*sin(theta)*2]] //bounday vertex to clear ends
);
function oval_path(theta, phi, a, b, c, deform = 0) = [
a*cos(theta)*cos(phi), //x
c*sin(theta)*(1+deform*cos(theta)) , //
b*sin(phi),
];
path_trans2 = [for (t=[0:step:180]) translation(oval_path(t,0,10,15,2,0))*rotation([0,90,0])];
//--------------Function definng Cap
function CapTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)+ChopShift(keyID)), //Y shift
(t/layers*KeyHeight(keyID)) //Z shift
];
function InnerTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*(KeyHeight(keyID)-topthickness)) //Z shift
];
function CapRotation(t, keyID) =
[
((1-t)/layers*XAngleSkew(keyID)), //X shift
((1-t)/layers*YAngleSkew(keyID)), //Y shift
((1-t)/layers*ZAngleSkew(keyID)) //Z shift
];
function CapTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)) + (1-pow(t/layers, WidExponent(keyID)))*BottomWidth(keyID) ,
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)) + (1-pow(t/layers, LenExponent(keyID)))*BottomLength(keyID)
];
function CapRoundness(t, keyID) =
[
pow(t/layers, ChamExponent(keyID))*(CapRound0f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound0i(keyID),
pow(t/layers, ChamExponent(keyID))*(CapRound1f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound1i(keyID)
];
function CapRadius(t, keyID) = pow(t/layers, ChamExponent(keyID))*ChamfFinRad(keyID) + (1-pow(t/layers, ChamExponent(keyID)))*ChamfInitRad(keyID);
function InnerTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, WidExponent(keyID)))*(BottomWidth(keyID) -wallthickness*2),
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, LenExponent(keyID)))*(BottomLength(keyID)-wallthickness*2)
];
function StemTranslation(t, keyID) =
[
((1-t)/stemLayers*TopWidShift(keyID)), //X shift
((1-t)/stemLayers*TopLenShift(keyID)), //Y shift
stemCrossHeight+.1 + (t/stemLayers*(KeyHeight(keyID)- topthickness - stemCrossHeight-.1)) //Z shift
];
function StemRotation(t, keyID) =
[
((1-t)/stemLayers*XAngleSkew(keyID)), //X shift
((1-t)/stemLayers*YAngleSkew(keyID)), //Y shift
((1-t)/stemLayers*ZAngleSkew(keyID)) //Z shift
];
function StemTransform(t, keyID) =
[
// pow(t/stemLayers, StemExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemWid - 2*slop),
// pow(t/stemLayers, StemExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemLen - 2*slop)
stemWid,stemLen
];
function StemRadius(t, keyID) = pow(t/stemLayers,3)*3 + (1-pow(t/stemLayers, 3))*1;
//Stem Exponent
//DishShape2 vars
function DishTransition (t, keyID) = pow(t/stepsize,TransitionAngleExpo(keyID) )*TransitionAngleFin(keyID) + (1-pow(t/stepsize, TanArcExpo(keyID) ))*TransitionAngleInit(keyID);
function FTanRadius (t, keyID) = pow(t/stepsize,TanArcExpo(keyID) )*ForwardTanInit(keyID) + (1-pow(t/stepsize, TanArcExpo(keyID) ))*ForwardTanFin(keyID);
function BTanRadius (t, keyID) = pow(t/stepsize,TanArcExpo(keyID) )*BackTanInit(keyID) + (1-pow(t/stepsize, TanArcExpo(keyID) ))*BackTanFin(keyID);
function TanTransition (t, keyID) = pow(t/stepsize,TanArcExpo(keyID) )*TransitionAngleInit(keyID) + (1-pow(t/stepsize, TanArcExpo(keyID) ))*TransitionAngleFin(keyID);
///----- KEY Builder Module
module keycap(keyID = 0, cutLen = 0, visualizeDish = false, crossSection = false, Dish = true, SecondaryDish = false, Stem = false, homeDot = false, Stab = 0, Legends = false) {
//Set Parameters for dish shape
FrontPath = quantize_trajectories(FrontTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
BackPath = quantize_trajectories(BackTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
//Scaling initial and final dim tranformation by exponents
function FrontDishArc(t) = pow((t)/(len(FrontPath)),FrontArcExpo(keyID))*FrontFinArc(keyID) + (1-pow(t/(len(FrontPath)),FrontArcExpo(keyID)))*FrontInitArc(keyID);
function BackDishArc(t) = pow((t)/(len(FrontPath)),BackArcExpo(keyID))*BackFinArc(keyID) + (1-pow(t/(len(FrontPath)),BackArcExpo(keyID)))*BackInitArc(keyID);
FrontCurve = [ for(i=[0:len(FrontPath)-1]) transform(FrontPath[i],
DishShape2( a= DishDepth(keyID), b= FrontDishArc(i), phi = DishTransition(i,keyID) , theta= 60
, r = FTanRadius(i, keyID))) ];
BackCurve = [ for(i=[0:len(BackPath)-1]) transform(BackPath[i],
DishShape2(DishDepth(keyID), BackDishArc(i), phi = DishTransition(i,keyID), theta= 60
, r = BTanRadius(i, keyID))) ];
//Secondary Dish
SFrontPath = quantize_trajectories(SFrontTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
SBackPath = quantize_trajectories(SBackTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
function SFrontDishArc(t) = pow((t)/(len(SFrontPath)),SFrontArcExpo(keyID))*SFrontFinArc(keyID) + (1-pow(t/(len(SFrontPath)),SFrontArcExpo(keyID)))*SFrontInitArc(keyID);
function SBackDishArc(t) = pow((t)/(len(SBackPath)),SBackArcExpo(keyID))*SBackFinArc(keyID) + (1-pow(t/(len(SFrontPath)),SBackArcExpo(keyID)))*SBackInitArc(keyID);
SFrontCurve = [ for(i=[0:len(SFrontPath)-1]) transform(SFrontPath[i], DishShape(SDishDepth(keyID), SFrontDishArc(i), 1, d = 0)) ];
SBackCurve = [ for(i=[0:len(SBackPath)-1]) transform(SBackPath[i], DishShape(SDishDepth(keyID), SBackDishArc(i), 1, d = 0)) ];
//builds
difference(){
union(){
// difference(){
skin([for (i=[0:layers]) transform(translation(CapTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(CapTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]); //outer shell
//Bottom shell
if( Stem == Choc){
skin([for (i=[0:layers]) transform(translation(CapTranslation(i, keyID+1)) * rotation(CapRotation(i, keyID+1)), elliptical_rectangle(CapTransform(i, keyID+1), b = CapRoundness(i,keyID+1),fn=fn))]); //outer shell
}else {
skin([for (i=[0:layers]) transform(translation(CapTranslation(i, keyID+2)) * rotation(CapRotation(i, keyID+2)), elliptical_rectangle(CapTransform(i, keyID+2), b = CapRoundness(i,keyID+2),fn=fn))]); //outer shell
}
//Cut inner shell
// }
if(Stem == Choc){
rotate([0,0,stemRot])translate([0,0,-2.])choc_stem(draftAng = draftAngle); // generate mx cherry stem, not compatible with box
} else if (Stem +MX){
translate([0,0,-4.25])rotate(stemRot)cylinder(d =5.5, 3.75, $fn= 64);
// translate([0,0,-.001])skin([for (i=[0:stemLayers]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), rounded_rectangle_profile(StemTransform(i, keyID),fn=fn,r=1 /*StemRadius(i, keyID) */ ))]); //outer shell
}
//cut for fonts and extra pattern for light?
if(visualizeDish == true && Dish == true){
#translate([-TopWidShift(keyID),TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
#translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(BackCurve);
}
}
//Cuts
//Fonts
if(cutLen != 0){
translate([sign(cutLen)*(BottomLength(keyID)+CapRound0i(keyID)+abs(cutLen))/2,0,0])
cube([BottomWidth(keyID)+CapRound1i(keyID)+1,BottomLength(keyID)+CapRound0i(keyID),50], center = true);
}
if(Legends == true){
}
//Dish Shape
if(Dish == true){
translate([-TopWidShift(keyID),.0001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(BackCurve);
if (Stem == MX){
translate([0,0,-4.25])rotate(stemRot){
skin(StemCurve);
skin(StemCurve2);
}
}
if(SecondaryDish == true){
#translate([BottomWidth(keyID)/2,-BottomLength(keyID)/2,KeyHeight(keyID)-SDishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(SBackCurve);
mirror([1,0,0])translate([BottomWidth(keyID)/2,-BottomLength(keyID)/2,KeyHeight(keyID)-SDishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(SBackCurve);
}
}
if(crossSection == true) {
translate([0,-25,-.1])cube([15,50,15]);
}
}
//Homing dot
if(homeDot == true)translate([0,0,KeyHeight(keyID)-DishHeightDif(keyID)-.25])sphere(d = 1);
}
//------------------stems
$fn = fn;
MXWid = 4.03/2+Tol; //horizontal lenght
MXLen = 4.23/2+Tol; //vertical length
MXWidT = 1.15/2+Tol; //horizontal thickness
MXLenT = 1.25/2+Tol; //vertical thickness
function stem_internal(sc=1) = sc*[
[MXLenT, MXLen],[MXLenT, MXWidT],[MXWid, MXWidT],
[MXWid, -MXWidT],[MXLenT, -MXWidT],[MXLenT, -MXLen],
[-MXLenT, -MXLen],[-MXLenT, -MXWidT],[-MXWid, -MXWidT],
[-MXWid,MXWidT],[-MXLenT, MXWidT],[-MXLenT, MXLen]
]; //2D stem cross with tolance offset and additonal transformation via jog
//trajectory();
function StemTrajectory() =
[
trajectory(forward = 4.00) //You can add more traj if you wish
];
StemPath = quantize_trajectories(StemTrajectory(), steps = 1 , loop=false, start_position= $t*4);
StemCurve = [ for(i=[0:len(StemPath)-1]) transform(StemPath[i], stem_internal()) ];
function StemTrajectory2() =
[
trajectory(forward = .5) //You can add more traj if you wish
];
StemPath2 = quantize_trajectories(StemTrajectory2(), steps = 10, loop=false, start_position= $t*4);
StemCurve2 = [ for(i=[0:len(StemPath2)-1]) transform(StemPath2[i]*scaling([(1.1-.1*i/(len(StemPath2)-1)),(1.1-.1*i/(len(StemPath2)-1)),1]), stem_internal()) ];
module choc_stem(draftAng = 5) {
stemHeight = 3.1;
dia = .15;
wids = 1.2/2;
lens = 2.9/2;
module Stem() {
difference(){
translate([0,0,-stemHeight/2])linear_extrude(height = stemHeight)hull(){
translate([wids-dia,-3/2])circle(d=dia);
translate([-wids+dia,-3/2])circle(d=dia);
translate([wids-dia, 3/2])circle(d=dia);
translate([-wids+dia, 3/2])circle(d=dia);
}
//cuts
translate([3.9,0])cylinder(d1=7+sin(draftAng)*stemHeight, d2=7,3.5, center = true, $fn = 64);
translate([-3.9,0])cylinder(d1=7+sin(draftAng)*stemHeight,d2=7,3.5, center = true, $fn = 64);
}
}
translate([5.7/2,0,-stemHeight/2+2])Stem();
translate([-5.7/2,0,-stemHeight/2+2])Stem();
}
/// ----- helper functions
function rounded_rectangle_profile(size=[1,1],r=1,fn=32) = [
for (index = [0:fn-1])
let(a = index/fn*360)
r * [cos(a), sin(a)]
+ sign_x(index, fn) * [size[0]/2-r,0]
+ sign_y(index, fn) * [0,size[1]/2-r]
];
function elliptical_rectangle(a = [1,1], b =[1,1], fn=32) = [
for (index = [0:fn-1]) // section right
let(theta1 = -atan(a[1]/b[1])+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta1), a[1]*sin(theta1)]
+ [a[0]*cos(atan(b[0]/a[0])) , 0]
- [b[1]*cos(atan(a[1]/b[1])) , 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
- [0, b[0]*sin(atan(b[0]/a[0]))]
+ [0, a[1]*sin(atan(a[1]/b[1]))],
for(index = [0:fn-1]) // section left
let(theta2 = -atan(a[1]/b[1])+180+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta2), a[1]*sin(theta2)]
- [a[0]*cos(atan(b[0]/a[0])) , 0]
+ [b[1]*cos(atan(a[1]/b[1])) , 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + 180 + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
+ [0, b[0]*sin(atan(b[0]/a[0]))]
- [0, a[1]*sin(atan(a[1]/b[1]))]
]/2;
function sign_x(i,n) =
i < n/4 || i > n-n/4 ? 1 :
i > n/4 && i < n-n/4 ? -1 :
0;
function sign_y(i,n) =
i > 0 && i < n/2 ? 1 :
i > n/2 ? -1 :
0;

BIN
Photo/CS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

BIN
Photo/CS_Thumb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

BIN
Photo/CS_convex.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 KiB

BIN
Photo/CS_gergo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 KiB

BIN
Photo/Convex.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 647 KiB

BIN
Photo/DES_cast.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 KiB

BIN
Photo/DES_corne.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

BIN
Photo/DES_kyria.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

BIN
Photo/R1-R5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

View file

@ -4,37 +4,38 @@
* make sure OpenSCAD is up to date.
* unzip libraries.zip into your OpenSCAD libraries
* select keycap you want to render by changing KeyID value
* change KeyID to corresponding Parameter ID
* press F5 to review
* press F6 to render
* press F7 to export as STL
#Some notes on
## Experimental Profiles: Distorted Ellipsoidal Saddle (DES)
###MX
![Thumb 1.75u and C1R0 1u](https://raw.githubusercontent.com/pseudoku/PseudoMakeMeKeyCapProfiles/master/Photo/DES.jpg)
ver 1. Initial trial
ver 2. narrower top to emphasize dish similar to MT3.
ver 3. added Kyrira thumb cluster
## Distorted Ellipsoidal Saddle (DES)
High sculpt smooth transition profile
![DES](https://raw.githubusercontent.com/pseudoku/PseudoMakeMeKeyCapProfiles/master/Photo/R1-R5.png)
### Standard
![Neuron v1](https://raw.githubusercontent.com/pseudoku/PseudoMakeMeKeyCapProfiles/master/Photo/DES_cast.jpg)
##### Concave
concave 2u, 1u
### Concave
![Corne thumb and Convex Caps](https://raw.githubusercontent.com/pseudoku/PseudoMakeMeKeyCapProfiles/master/Photo/Convex.jpg)
### Choc
#### Chicago Stenographer
![DeepDishChoc](https://raw.githubusercontent.com/pseudoku/PseudoMakeMeKeyCapProfiles/master/Photo/ChicagoStenographer.jpg)
sculpted MX sized caps
#### Concave
concaved chicago
#### Levee
![RedLight](https://raw.githubusercontent.com/pseudoku/PseudoMakeMeKeyCapProfiles/master/Photo/DES_Levee.png)
resized chicago to choc cap dimension
### Thumbs
![IMK Corne v1](https://raw.githubusercontent.com/pseudoku/PseudoMakeMeKeyCapProfiles/master/Photo/DES_corne.jpg)
![Kyria](https://raw.githubusercontent.com/pseudoku/PseudoMakeMeKeyCapProfiles/master/Photo/DES_kyria.png)
## Rounded Pyramid (RP)
![Meh](https://raw.githubusercontent.com/pseudoku/PseudoMakeMeKeyCapProfiles/master/Photo/RP_profile.png)
Renders but still not under development
ver 1. all row
ver 2. Adjusted depth
ver 3. added sculpted profile
### Chicago Stenographer
Subtly sculpted choc spaced low profile
![CS](https://raw.githubusercontent.com/pseudoku/PseudoMakeMeKeyCapProfiles/master/Photo/CS.png)
#### Standard
![Look](https://raw.githubusercontent.com/pseudoku/PseudoMakeMeKeyCapProfiles/master/Photo/CS_gergo.jpg)
##Knob
Knobs for encoder, under construction...
#### Convex
![Georgi](https://raw.githubusercontent.com/pseudoku/PseudoMakeMeKeyCapProfiles/master/Photo/CS_convex.jpg)
#### Thumbs
![1.5 + 1](https://raw.githubusercontent.com/pseudoku/PseudoMakeMeKeyCapProfiles/master/Photo/CS_Thumb.png)
Additional sculpt angle and smoother transitions
### Philadelphia Minimalist
![under](https://raw.githubusercontent.com/pseudoku/PseudoMakeMeKeyCapProfiles/master/Photo/Philadelphia_Minimalist.png)
Minimal spacing
Under construction

View file

@ -1,437 +0,0 @@
use <scad-utils/morphology.scad> //for cheaper minwoski
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <scad-utils/trajectory.scad>
use <scad-utils/trajectory_path.scad>
use <sweep.scad>
use <skin.scad>
//DP (Distored Pyramidal) [Double Penetration] Profile
//TODO add shift
keycap(keyID = 9, cutLen = 0, Stem =true, Dish = true, visualizeDish = true, crossSection = false, homeDot = false, Legends = false);
////fullsetee
RowHome = [0,2.5,5,2.5,0,0];
//for(Col = [4:4]){
// for(Row = [1:3]){
// translate([19*Col, 19*Row +RowHome[Col], 0])keycap(keyID = Col*4+Row, cutLen = 0, Stem = true, Dish = true, visualizeDish = false, crossSection = true);
// }
//}
////// thumb
// translate([-15, -4, 0])rotate([0,0,30])keycap(keyID = 0, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([10, 0, 0])rotate([0,0,15])keycap(keyID = 4, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([31, 2.2, 0])rotate([0,0,0])keycap(keyID = 8, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//Parameters
wallthickness = 1.75;
topthickness = 2.5;
stepsize = 30; //resolution of Trajectory
step = 4; //resolution of ellipes
fn = 32; //resolution of Rounded Rectangles: 60 for output
layers = 30; //resolution of vertical Sweep: 50 for output
dishLayers = 30;
//---Stem param
slop = 0.3;
stemRot = 0;
stemWid = 8;
stemLen = 6;
stemCrossHeight = 1.8;
extra_vertical = 0.6;
stemLayers = 50; //resolution of stem to cap top transition
//injection param
draftAngle = 0; //degree note:Stem Only
//TODO: Add wall thickness transition?
keyParameters = //keyParameters[KeyID][ParameterID]
[
// BotWid, BotLen, TWDif, TLDif, keyh, WSft, LSft XSkew, YSkew, ZSkew, WEx, LEx, CapR0i, CapR0f, CapR1i, CapR1f, CapREx, StemEx
//Column 0
[17.16, 17.16*1.5, 6, 6, 14, 0, 0, -13, -10, -5, 2, 2, 1, 5, 1, 3, 2, 2], //R5 0
[17.16, 17.16, 6.5, 6.5, 8+4, 0, 0, 10, -10, -5, 2, 2, 1, 5, 1, 3, 2, 2], //R4
[17.16, 17.16, 6.5, 6.5, 7+4, 0, 0, -2, -10, -5, 2, 2, 1, 5, 1, 3, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 8+4, 0, 0, -10, -10, -5, 2, 2, 1, 5, 1, 3, 2, 2], //R2
//Column 1
[17.16, 17.16, 6, 6, 13, 0, 0, -13, 5, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 4
[17.16, 17.16, 6.5, 6.5, 8+3, 0, 0, 5, -3, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R4
[17.16, 17.16, 6.5, 6.5,7+2.5, 0, 0, -2, -3, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 8+3, 0, 0, -12, -3, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R2
//Column 2 middle
[17.16, 17.16, 6, 6, 13, 0, 0, -13, 10, 15, 2, 2, 1, 5, 1, 3, 2, 2], //R5 8
[17.16, 17.16, 6.5, 6.5, 4.9, 0, 0, 0, 0, 0, 2, 2, 1, 4.85, 1, 3, 2, 2], //R4
[17.16, 17.16, 6.5, 5.5, 7, 0, 0, -2, 0, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 8, 0, 0, -12, 0, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R2
//Column 3
[17.16, 17.16, 6, 6, 11+3, 0, 0, 13, -4, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 12
[17.16, 17.16, 6.5, 6.5, 8+3, 0, 0, 5, -4, 0, 2, 2, 1, 5, 1, 5, 2, 2], //R4
[17.16, 17.16, 6.5, 6.5, 7+3, 0, 0, -2, -4, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 8+3, 0, 0, -10, -4, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R2
//Column 4
[17.16, 17.16, 6, 6,11+5.5, 0, 0, 13, -10, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 16
[17.16, 17.16, 6.5, 6.5,8+5.5, 0, 0, 5, -10, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R4
[17.16, 17.16, 6.5, 6.5,7+5.5, 0, 0, -5, -10, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 8+4, 0, 0, -12, 5, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R2
//Column 5
[17.16, 17.16, 6, 6, 11+4, 0, 0, 13, -6, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R5 20
[17.16, 17.16, 6.5, 6.5, 8+4, 0, 0, 5, -6, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R4
[17.16, 17.16, 6.5, 6.5, 7+4, 0, 0, -2, -6, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R3 Home
[17.16, 17.16, 6.5, 6.5, 8+6, 0, 0, -12, 10, 0, 2, 2, 1, 5, 1, 3, 2, 2], //R2
];
function BottomWidth(keyID) = keyParameters[keyID][0]; //
function BottomLength(keyID) = keyParameters[keyID][1]; //
function TopWidthDiff(keyID) = keyParameters[keyID][2]; //
function TopLenDiff(keyID) = keyParameters[keyID][3]; //
function KeyHeight(keyID) = keyParameters[keyID][4]; //
function TopWidShift(keyID) = keyParameters[keyID][5];
function TopLenShift(keyID) = keyParameters[keyID][6];
function XAngleSkew(keyID) = keyParameters[keyID][7];
function YAngleSkew(keyID) = keyParameters[keyID][8];
function ZAngleSkew(keyID) = keyParameters[keyID][9];
function WidExponent(keyID) = keyParameters[keyID][10];
function LenExponent(keyID) = keyParameters[keyID][11];
function CapRound0i(keyID) = keyParameters[keyID][12];
function CapRound0f(keyID) = keyParameters[keyID][13];
function CapRound1i(keyID) = keyParameters[keyID][14];
function CapRound1f(keyID) = keyParameters[keyID][15];
function ChamExponent(keyID) = keyParameters[keyID][16];
function StemExponent(keyID) = keyParameters[keyID][17];
dishParameters = //dishParameter[keyID][ParameterID]
[
// EdOf fn LEx WEx DshDep Ch0i, ch1i, Ch0f, Ch1f, DishExp
//Column 0
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R2
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R3
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R4
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R5
//Column 1
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R2
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R3
[ 1, .005, 2, 2, 2, 6, 4, .3, .001, 2], //R4
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R5
//Column 2
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R2
[ 2, .005, 2, 2, 1.7, 4.85, 3, .001, .001, 2], //R3 DSA
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R4
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R5
//Column 3
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R2
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R3
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R4
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R5
//Column 4
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R2
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R3
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R4
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R5
//Column 5
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R2
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R3
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R4
[ 2, .005, 2, 2, 1.5, 6, 4, .001, .001, 2], //R5
];
function EdgeOffset(keyID) = dishParameters[keyID][0]; //
function LenFinal(keyID) = dishParameters[keyID][1]; //
function LenExpo(keyID) = dishParameters[keyID][2]; //
function WidExpo(keyID) = dishParameters[keyID][3]; //
function DishDepth(keyID) = dishParameters[keyID][4]; //
function DishCham0i(keyID) = dishParameters[keyID][5]; //
function DishCham1i(keyID) = dishParameters[keyID][6]; //
function DishCham0f(keyID) = dishParameters[keyID][7]; //
function DishCham1f(keyID) = dishParameters[keyID][8]; //
function DishExpo(keyID) = dishParameters[keyID][9];
//function FrontTrajectory(keyID) =
// [
// trajectory(forward = FrontForward1(keyID), pitch = FrontPitch1(keyID)), //more param available: yaw, roll, scale
// trajectory(forward = FrontForward2(keyID), pitch = FrontPitch2(keyID)) //You can add more traj if you wish
// ];
//
//function BackTrajectory (keyID) =
// [
// trajectory(forward = BackForward1(keyID), pitch = BackPitch1(keyID)),
// trajectory(forward = BackForward2(keyID), pitch = BackPitch2(keyID)),
// ];
//------- function defining Dish Shapes
function ellipse(a, b, d = 0, rot1 = 0, rot2 = 360) = [for (t = [rot1:step:rot2]) [a*cos(t)+a, b*sin(t)*(1+d*cos(t))]]; //Centered at a apex to avoid inverted face
function DishShape (a,b,c,d) =
concat(
// [[c+a,b]],
ellipse(a, b, d = 0,rot1 = 90, rot2 = 270)
// [[c+a,-b]]
);
function oval_path(theta, phi, a, b, c, deform = 0) = [
a*cos(theta)*cos(phi), //x
c*sin(theta)*(1+deform*cos(theta)) , //
b*sin(phi),
];
path_trans2 = [for (t=[0:step:180]) translation(oval_path(t,0,10,15,2,0))*rotation([0,90,0])];
//--------------Function definng Cap
function CapTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*KeyHeight(keyID)) //Z shift
];
function InnerTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*(KeyHeight(keyID)-topthickness)) //Z shift
];
function CapRotation(t, keyID) =
[
((1-t)/layers*XAngleSkew(keyID)), //X shift
((1-t)/layers*YAngleSkew(keyID)), //Y shift
((1-t)/layers*ZAngleSkew(keyID)) //Z shift
];
function CapTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)) + (1-pow(t/layers, WidExponent(keyID)))*BottomWidth(keyID) ,
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)) + (1-pow(t/layers, LenExponent(keyID)))*BottomLength(keyID)
];
function CapRoundness(t, keyID) =
[
pow(t/layers, ChamExponent(keyID))*(CapRound0f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound0i(keyID),
pow(t/layers, ChamExponent(keyID))*(CapRound1f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound1i(keyID)
];
function InnerTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, WidExponent(keyID)))*(BottomWidth(keyID) -wallthickness*2),
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, LenExponent(keyID)))*(BottomLength(keyID)-wallthickness*2)
];
function StemTranslation(t, keyID) =
[
((1-t)/stemLayers*TopWidShift(keyID)), //X shift
((1-t)/stemLayers*TopLenShift(keyID)), //Y shift
stemCrossHeight+.1 + (t/stemLayers*(KeyHeight(keyID)- topthickness - stemCrossHeight-.1)) //Z shift
];
function StemRotation(t, keyID) =
[
((1-t)/stemLayers*XAngleSkew(keyID)), //X shift
((1-t)/stemLayers*YAngleSkew(keyID)), //Y shift
((1-t)/stemLayers*ZAngleSkew(keyID)) //Z shift
];
function StemTransform(t, keyID) =
[
pow(t/stemLayers, StemExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)-wallthickness*2) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemWid - 2*slop),
pow(t/stemLayers, StemExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemLen - 2*slop)
];
function StemRadius(t, keyID) = pow(t/stemLayers,3)*3 + (1-pow(t/stemLayers, 3))*1;
//----- Distorted Pyramidal Dish
function DishTranslation(t, keyID) =
[
((t)/dishLayers*TopWidShift(keyID)), //X shift
((t)/dishLayers*TopLenShift(keyID)), //Y shift
KeyHeight(keyID)-(t)/dishLayers*(DishDepth(keyID)) //Z shift
];
function DishRotation(t, keyID) =
[
(-XAngleSkew(keyID)), //X shift
(-YAngleSkew(keyID)), //Y shift
(-ZAngleSkew(keyID)) //Z shift
];
function DishTransform(t, keyID) =
[
(1-pow(t/dishLayers, WidExpo(keyID)))*(BottomWidth(keyID) -TopWidthDiff(keyID)+EdgeOffset(keyID)) + (pow(t/dishLayers, WidExpo(keyID)))*(LenFinal(keyID)),
(1-pow(t/dishLayers, LenExpo(keyID)))*(BottomLength(keyID)-TopLenDiff(keyID)+EdgeOffset(keyID)) + (pow(t/dishLayers, LenExpo(keyID)))*(LenFinal(keyID))
];
function DishRoundness(t, keyID) =
[
pow(t/dishLayers, DishExpo(keyID))*(DishCham0f(keyID)) + (1-pow(t/dishLayers, DishExpo(keyID)))*DishCham0i(keyID),
pow(t/dishLayers, DishExpo(keyID))*(DishCham1f(keyID)) + (1-pow(t/dishLayers, DishExpo(keyID)))*DishCham1i(keyID)
];
///----- KEY Builder Module
module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false, Dish = true, Stem = false, homeDot = false, Stab = false) {
// //Set Parameters for dish shape
// FrontPath = quantize_trajectories(FrontTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
// BackPath = quantize_trajectories(BackTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
//
// //Scaling initial and final dim tranformation by exponents
// function FrontDishArc(t) = pow((t)/(len(FrontPath)),FrontArcExpo(keyID))*FrontFinArc(keyID) + (1-pow(t/(len(FrontPath)),FrontArcExpo(keyID)))*FrontInitArc(keyID);
// function BackDishArc(t) = pow((t)/(len(FrontPath)),BackArcExpo(keyID))*BackFinArc(keyID) + (1-pow(t/(len(FrontPath)),BackArcExpo(keyID)))*BackInitArc(keyID);
//
// FrontCurve = [ for(i=[0:len(FrontPath)-1]) transform(FrontPath[i], DishShape(DishDepth(keyID), FrontDishArc(i), 1, d = 0)) ];
// BackCurve = [ for(i=[0:len(BackPath)-1]) transform(BackPath[i], DishShape(DishDepth(keyID), BackDishArc(i), 1, d = 0)) ];
//builds
difference(){
union(){
difference(){
skin([for (i=[0:layers-1]) transform(translation(CapTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(CapTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]); //outer shell
//Cut inner shell
if(Stem == true){
translate([0,0,-.001])skin([for (i=[0:layers-1]) transform(translation(InnerTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(InnerTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]);
}
}
if(Stem == true){
rotate([0,0,stemRot])choc_stem(draftAng = draftAngle); // generate mx cherry stem, not compatible with box
translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), rounded_rectangle_profile(StemTransform(i, keyID),fn=fn,r=StemRadius(i, keyID)))]); //Transition Support for taller profile
}
//cut for fonts and extra pattern for light?
}
//Cuts
//Fonts
if(Legends == true){
// #rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([0,4,KeyHeight(keyID)-2.5])linear_extrude(height = 0.5)text( text = "Why?", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
// #rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([0,-3.5,0])linear_extrude(height = 0.5)text( text = "Me", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
}
//Dish Shape
if(Dish == true){
if(visualizeDish == false){
skin([for (i=[0:dishLayers]) transform(translation(DishTranslation(i, keyID)) * rotation(DishRotation(i, keyID)),
elliptical_rectangle(DishTransform(i, keyID), b = DishRoundness(i,keyID),fn=fn)
)]);
} else {
#skin([for (i=[0:dishLayers]) transform(translation(DishTranslation(i, keyID)) * rotation(DishRotation(i, keyID)),
elliptical_rectangle(DishTransform(i, keyID), b = DishRoundness(i,keyID),fn=fn)
)]);
}
}
if(crossSection == true) {
translate([0,-15,-.1])cube([15,30,15]);
}
}
//Homing dot
if(homeDot == true)translate([0,0,KeyHeight(keyID)-DishDepth(keyID)-.1])sphere(d = 1);
}
//------------------stems
$fn = fn;
function outer_cherry_stem(slop) = [ stemWid - slop * 2, stemLen - slop * 2];
function outer_cherry_stabilizer_stem(slop) = [4.85 - slop * 2, 6.05 - slop * 2];
function outer_box_cherry_stem(slop) = [6 - slop, 6 - slop];
// .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],
];
module inside_cherry_cross(slop) {
// inside cross
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-0.005]) {
linear_extrude(height = stemCrossHeight) {
square(cherry_cross(slop, extra_vertical)[0], center=true);
square(cherry_cross(slop, extra_vertical)[1], center=true);
}
}
// Guides to assist insertion and mitigate first layer squishing
{
for (i = cherry_cross(slop, extra_vertical)) hull() {
linear_extrude(height = 0.01, center = false) offset(delta = 0.4) square(i, center=true);
translate([0, 0, 0.5]) linear_extrude(height = 0.01, center = false) square(i, center=true);
}
}
}
module cherry_stem(depth, slop) {
difference(){
// outside shape
linear_extrude(height = depth-topthickness/2) {
offset(r=1){
square(outer_cherry_stem(slop) - [2,2], center=true);
}
}
inside_cherry_cross(slop);
}
}
module choc_stem(draftAng = 2) {
stemHeinght = 3.4;
module Stem() {
difference(){
hull(){
translate([0,0,-stemHeinght/2])cube([1.25-sin(draftAng)*stemHeinght,3-sin(draftAng)*stemHeinght,.001], center= true);
translate([0,0,stemHeinght/2])cube([1.25,3,.001], center= true);
}
//cuts
translate([3.9,0])cylinder(d1=7+sin(draftAng)*stemHeinght, d2=7,3.5, center = true);
translate([-3.9,0])cylinder(d1=7+sin(draftAng)*stemHeinght,d2=7,3.5, center = true);
}
}
translate([5.7/2,0,-3.4/2+2])Stem();
translate([-5.7/2,0,-3.4/2+2])Stem();
}
/// ----- helper functions
function rounded_rectangle_profile(size=[1,1],r=1,fn=32) = [
for (index = [0:fn-1])
let(a = index/fn*360)
r * [cos(a), sin(a)]
+ sign_x(index, fn) * [size[0]/2-r,0]
+ sign_y(index, fn) * [0,size[1]/2-r]
];
function elliptical_rectangle(a = [1,1], b =[1,1], fn=32) = [
for (index = [0:fn-1]) // section right
let(theta1 = -atan(a[1]/b[1])+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta1), a[1]*sin(theta1)]
+ [a[0]*cos(atan(b[0]/a[0])), 0]
- [b[1]*cos(atan(a[1]/b[1])), 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
- [0, b[0]*sin(atan(b[0]/a[0]))]
+ [0, a[1]*sin(atan(a[1]/b[1]))],
for(index = [0:fn-1]) // section left
let(theta3 = -atan(a[1]/b[1])+180+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta3), a[1]*sin(theta3)]
- [a[0]*cos(atan(b[0]/a[0])), 0]
+ [b[1]*cos(atan(a[1]/b[1])), 0],
for(index = [0:fn-1]) // section Top
let(theta4 = atan(b[0]/a[0]) + 180 + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta4), b[0]*sin(theta4)]
+ [0, b[0]*sin(atan(b[0]/a[0]))]
- [0, a[1]*sin(atan(a[1]/b[1]))]
]/2;
function sign_x(i,n) =
i < n/4 || i > n-n/4 ? 1 :
i > n/4 && i < n-n/4 ? -1 :
0;
function sign_y(i,n) =
i > 0 && i < n/2 ? 1 :
i > n/2 ? -1 :
0;

View file

@ -1,548 +0,0 @@
//use <scad-utils/morphology.scad> //for cheaper minwoski
use <scad-utils/transformations.scad>
use <scad-utils/lists.scad>
use <scad-utils/shapes.scad>
use <scad-utils/trajectory.scad>
use <scad-utils/trajectory_path.scad>
use <sweep.scad>
use <skin.scad>
use <z-butt.scad>
/*DES (Distorted Elliptical Saddle) Sculpted Profile for 6x3 and corne thumb
Version 2: Eliptical Rectangle
version 3: fine tune shapes
TODOs:
1. cylinderical stem and transform to top surface
2. modify inner cut to have two thickness parameters
3. fragile things? cuts from knobs
*/
//#square([18.16, 18.16], center = true);
//#difference(){
// translate([0,0,(KeyHeight(capID)+5)/2+.08])cube([30, 30, KeyHeight(capID)+5],center = true );
// translate([11,11,0])cylinder(d=4,20, center = true);
// translate(-[11,11,0])cylinder(d=4,20, center = true);
// translate([-11,11,0])cylinder(d=4,20, center = true);
//}
//#mirror([0,0,0])translate([0,0,1.95])keycap(keyID = capID, cutLen = 0, Stem =false, Dish = true, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//bottom cast param
capID = 3;
difference(){
mx_stem_cavity(name = "custom", xu=1, yu=1, sz = 11)translate([0,0,-.1])mirror([0,0,0])
keycap(keyID = capID, cutLen = 0, Stem =true, Dish = false, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
translate([0,-30,-25]) cube([60,60,50]); // cut check
}
//#keycap(keyID = capID, cutLen = 0, Stem =false, Dish = false, Stab = 0 , visualizeDish = false, crossSection = false, homeDot = false, Legends = false);
//Parameters
wallthickness = 2;
topthickness = 3; //
stepsize = 30; //resolution of Trajectory
step = 6; //resolution of ellipes
fn = 16; //resolution of Rounded Rectangles: 60 for output
layers = 50; //resolution of vertical Sweep: 50 for output
dotRadius = 1.25; //home dot size
//---Stem param
slop = 0.3;
stemRot = 0;
stemWid = 7.2;
stemLen = 5.5;
stemCrossHeight = 5.0;
extra_vertical = 0.6;
StemBrimDep = 0.75;
stemLayers = 20; //resolution of stem to cap top transition
proHeight = 3.5;
dishLayers = 30;
Dcyl = 5.6;
draftAngle = 0; //degree note:Stem Only
stemsupportLimit = 8.5;
keyParameters = //keyParameters[KeyID][ParameterID]
[
// BotWid, BotLen, TWDif, TLDif, keyh, WSft, LSft XSkew, YSkew, ZSkew, WEx, LEx, CapR0i, CapR0f, CapR1i, CapR1f, CapREx, StemEx
[17.16, 17.16, 8.0, 5.5, 8.5+proHeight, 0, 0, -5, 0, -0, 2, 2, 1, 3.999, 1, 5, 2, 2], //R5
[17.96, 17.96, 8.0, 8.0, 7.8+proHeight, 0, 0, 10, 0, -0, 2, 2, .1, 3.999, .1, 3.399, 2, 2], //R4
[17.96, 17.96, 8.0, 8.0, 7.8+proHeight, 0, .5, -10, 0, -0, 2, 2, .1, 3.399, .1, 3.399, 2, 2], //R3
[17.96, 17.96, 8.0, 8.0,10.8+proHeight, 0, 0, -16, 0, -0, 2, 2, .1, 3.399, .1, 3.399, 2, 2], //R2
[17.96, 17.96, 8.0, 8.0, 8.0+proHeight, 0, .5, -10, 0, -0, 2, 2, .1, 3.399, .1, 3.399, 2, 2], //R3 home
];
dishParameters = //dishParameter[keyID][ParameterID]
[
//FFwd1 FFwd2 FPit1 FPit2 DshDep DshHDif FArcIn FArcFn FArcEx BFwd1 BFwd2 BPit1 BPit2 BArcIn BArcFn BArcEx
//higt corne thumb
[ 8, 4.5, 7, -39, 4, 1.8, 9.5, 15, 2, 10, 4, 8, -30, 9.5, 20, 2], //R5
[ 5, 4.3, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 13, -30, 10.5, 18, 2], //R5
[ 5, 4.3, 5, -48, 4, 1.9, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //R5
[ 8, 5.0, 7, -39, 4, 1.9, 9.5, 15, 2, 10, 4, 8, -30, 9.5, 20, 2], //R5
[ 5, 4.8, 5, -48, 5, 2.2, 10.5, 10, 2, 6, 4, 13, -30, 10.5, 18, 2], //R5
[ 5, 4.8, 5, -48, 4, 2.0, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //R5
// low pro 3 row system
[ 6, 3, 18, -50, 5, 1.8, 8.8, 15, 2, 5, 4.4, 5, -55, 8.8, 15, 2], //R4
[ 6, 3, 18, -50, 5, 1.8, 8.5, 15, 2, 5, 3.5, 8, -55, 8.5, 15, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R2
[ 5.5, 2.8, 23, -50, 5, 1.8, 8.5, 15, 2, 5, 3.3, 13, -55, 8.5, 15, 2], //R3 deep
//kyria
[ 13, 4.5, 7, -39, 4, 1.8, 9.5, 15, 2, 13, 4, 8, -30, 9.5, 20, 2], //T1R1 2u
[ 5, 4.4, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 2, -30, 10.5, 18, 2], //T0R1 1u
[ 5, 4.3, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 2, -30, 10.5, 18, 2], //T0R2 1u
[ 13, 4.5, 7, -39, 4, 1.8, 9.5, 15, 2, 13, 4, 8, -30, 9.5, 20, 2], //T1R1 2u
[ 5, 4.4, 5, -48, 4, 1.9, 11, 12, 2, 5.5, 3.5, 8, -50, 11, 28, 2], //T1R1 1u
[ 5, 4.3, 5, -48, 5, 2, 10.5, 10, 2, 6, 4, 2, -30, 10.5, 18, 2], //T1R2 1u
[ 5, 4.4, 5, -48, 4, 1.9, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //T2R1
[ 5, 4.4, 5, -48, 4, 1.9, 11, 12, 2, 6, 4, 13, -35, 11, 28, 2], //T3R1
//heavy
[ 6, 3, -5, -50, 5, 1.8, 8.8, 15, 2, 6, 3.5, 13, -50, 8.8, 16, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 8.8, 15, 2, 5, 4.4, 5, -55, 8.8, 15, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 8.8, 15, 2, 5, 3.5, 8, -55, 8.8, 15, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 8.8, 15, 2, 5, 4, 12, -55, 8.8, 16, 2], //R2
[ 5, 3.5, 8, -50, 5, 1.9, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R1
[ 5.5, 2.8, 23, -50, 5, 1.8, 8.5, 15, 2, 5, 3.3, 13, -55, 8.5, 15, 2], //R3 deep
// 1.25
[ 6, 3, -5, -50, 5, 1.8, 12.4, 18, 2, 6, 3.5, 13, -50, 12.4, 19, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 12.4, 20, 2, 5, 4.4, 5, -55, 12.4, 19, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 12.4, 18, 2, 5, 3.7, 8, -55, 12.4, 19, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 12.4, 18, 2, 5, 4, 12, -55, 12.4, 19, 2], //R2
[ 5, 3.5, 8, -50, 5, 1.9, 12.5, 18, 2, 6, 4, 13, 30, 12.5, 19, 2], //R1
//1.5
[ 6, 3, -5, -50, 5, 1.8, 15.5, 22, 2, 6, 3.5, 13, -50, 15.5, 22, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 15.5, 27.2, 2, 5, 4.4, 5, -55, 15.5, 22, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 15.5, 22, 2, 5, 3.7, 8, -55, 15.5, 22, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 15.7, 22, 2, 5, 4, 12, -55, 15.7, 23, 2], //R2
[ 5, 3.5, 8, -50, 5, 1.9, 15.7, 22, 2, 6, 4, 13, 30, 15.7, 23.5, 2], //R1
//1.75
[ 6, 3, -5, -50, 5, 1.8, 18.7, 25, 2, 6, 3.5, 13, -50, 18.7, 25, 2], //R5
[ 6, 3, 17, -50, 5, 1.8, 18.7, 32, 2, 5, 4.4, 5, -55, 18.7, 25, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 18.7, 27, 2, 5, 3.8, 8, -55, 18.7, 25, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 18.7, 25, 2, 5, 4, 12, -55, 18.7, 28, 2], //R2
[ 5, 3.7, 8, -50, 5, 1.9, 18.8, 25, 2, 6, 4, 12, 30, 18.8, 28, 2], //R1
//2
[ 6, 3, -5, -50, 5, 1.8, 21.9, 30, 2, 6, 3.5, 13, -50, 21.9, 31, 2], //R5
[ 6, 3, 15, -50, 5, 1.8, 21.9, 34, 2, 5, 4.4, 5, -55, 21.9, 31, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 21.9, 32.5, 2, 5, 3.7, 8, -55, 21.9, 31, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 21.9, 30, 2, 5, 4, 11.5, -55, 21.9, 33, 2], //R2
[ 5, 3.7, 8, -50, 5, 1.9, 22.1, 30, 2, 6, 4, 12, 30, 22.1, 33.5, 2], //R1
//mild
[ 6, 3, -5, -35, 5, 1.8, 8.8, 15, 2, 6, 3.5, 13, -50, 8.8, 16, 2], //R5
[ 6, 3, 15, -55, 5, 1.8, 8.8, 15, 2, 5, 4.4, 5, -55, 8.8, 15, 2], //R4
[ 5, 3.5, 8, -55, 5, 1.8, 8.8, 15, 2, 5, 3.8, 8, -55, 8.8, 15, 2], //R3
[ 5, 4.4, 5, -55, 5, 1.8, 8.8, 15, 2, 6, 3, 15, -55, 8.8, 15, 2], //R2
[ 5, 3.5, 8, -50, 5, 1.8, 8.8, 15, 2, 6, 4, 13, 30, 8.8, 16, 2], //R1
[ 5, 3.3, 15, -55, 5, 1.8, 8.5, 15, 2, 5, 3.3, 15, -55, 8.5, 15, 2], //R3 deep
// 1.25
[ 6, 3, -5, -50, 5, 1.8, 12.4, 18, 2, 6, 3.5, 13, -50, 12.4, 19, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 12.4, 20, 2, 5, 4.6, 5, -55, 12.4, 19, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 12.4, 18, 2, 5, 3.9, 8, -55, 12.4, 19, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 12.4, 18, 2, 5, 4, 12, -55, 12.4, 19, 2], //R2
[ 5, 3.8, 8, -50, 5, 1.9, 12.5, 18, 2, 6, 4, 13, 30, 12.5, 19, 2], //R1
//1.5
[ 6, 3, -5, -50, 5, 1.8, 15.5, 22, 2, 6, 3.5, 13, -50, 15.5, 22, 2], //R5
[ 6, 3, 18, -50, 5, 1.8, 15.5, 27.2, 2, 5, 4.4, 5, -55, 15.5, 22, 2], //R4
[ 6, 3, 18, -55, 5, 1.8, 15.5, 22, 2, 5, 3.9, 8, -55, 15.5, 22, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 15.7, 22, 2, 5, 4, 12, -55, 15.7, 23, 2], //R2
[ 5, 3.9, 8, -50, 5, 1.9, 15.7, 22, 2, 6, 4, 13, 30, 15.7, 23.5, 2], //R1
//1.75
[ 6, 3.2, -5, -50, 5, 1.8, 18.7, 25, 2, 6, 3.5, 13, -50, 18.7, 25, 2], //R5
[ 6, 3, 17, -50, 5, 1.8, 18.7, 32, 2, 5, 4.4, 5, -55, 18.7, 25, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 18.7, 27, 2, 5, 3.9, 8, -55, 18.7, 25, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 18.7, 25, 2, 5, 4, 12, -55, 18.7, 28, 2], //R2
[ 5, 3.9, 8, -50, 5, 1.9, 18.8, 25, 2, 6, 4, 12, 30, 18.8, 28, 2], //R1
//2
[ 6, 3.1, -5, -50, 5, 1.8, 21.9, 30, 2, 6, 3.5, 13, -50, 21.9, 31, 2], //R5
[ 6, 3, 15, -50, 5, 1.8, 21.9, 34, 2, 5, 4.4, 5, -55, 21.9, 31, 2], //R4
[ 6, 3, 17, -55, 5, 1.8, 21.9, 32.5, 2, 5, 3.9, 8, -55, 21.9, 31, 2], //R3
[ 6, 3, 10, -50, 5, 1.8, 21.9, 30, 2, 5, 4, 11.5, -55, 21.9, 33, 2], //R2
[ 5, 3.9, 8, -50, 5, 1.9, 22.1, 30, 2, 6, 4, 12, 30, 22.1, 33.5, 2], //R1
];
function FrontForward1(keyID) = dishParameters[keyID][0]; //
function FrontForward2(keyID) = dishParameters[keyID][1]; //
function FrontPitch1(keyID) = dishParameters[keyID][2]; //
function FrontPitch2(keyID) = dishParameters[keyID][3]; //
function DishDepth(keyID) = dishParameters[keyID][4]; //
function DishHeightDif(keyID) = dishParameters[keyID][5]; //
function FrontInitArc(keyID) = dishParameters[keyID][6];
function FrontFinArc(keyID) = dishParameters[keyID][7];
function FrontArcExpo(keyID) = dishParameters[keyID][8];
function BackForward1(keyID) = dishParameters[keyID][9]; //
function BackForward2(keyID) = dishParameters[keyID][10]; //
function BackPitch1(keyID) = dishParameters[keyID][11]; //
function BackPitch2(keyID) = dishParameters[keyID][12]; //
function BackInitArc(keyID) = dishParameters[keyID][13];
function BackFinArc(keyID) = dishParameters[keyID][14];
function BackArcExpo(keyID) = dishParameters[keyID][15];
function BottomWidth(keyID) = keyParameters[keyID][0]; //
function BottomLength(keyID) = keyParameters[keyID][1]; //
function TopWidthDiff(keyID) = keyParameters[keyID][2]; //
function TopLenDiff(keyID) = keyParameters[keyID][3]; //
function KeyHeight(keyID) = keyParameters[keyID][4]; //
function TopWidShift(keyID) = keyParameters[keyID][5];
function TopLenShift(keyID) = keyParameters[keyID][6];
function XAngleSkew(keyID) = keyParameters[keyID][7];
function YAngleSkew(keyID) = keyParameters[keyID][8];
function ZAngleSkew(keyID) = keyParameters[keyID][9];
function WidExponent(keyID) = keyParameters[keyID][10];
function LenExponent(keyID) = keyParameters[keyID][11];
function CapRound0i(keyID) = keyParameters[keyID][12];
function CapRound0f(keyID) = keyParameters[keyID][13];
function CapRound1i(keyID) = keyParameters[keyID][14];
function CapRound1f(keyID) = keyParameters[keyID][15];
function ChamExponent(keyID) = keyParameters[keyID][16];
function StemExponent(keyID) = keyParameters[keyID][17];
function FrontTrajectory(keyID) =
[
trajectory(forward = FrontForward1(keyID), pitch = FrontPitch1(keyID)), //more param available: yaw, roll, scale
trajectory(forward = FrontForward2(keyID), pitch = FrontPitch2(keyID)) //You can add more traj if you wish
];
function BackTrajectory (keyID) =
[
trajectory(forward = BackForward1(keyID), pitch = BackPitch1(keyID)),
trajectory(forward = BackForward2(keyID), pitch = BackPitch2(keyID)),
];
//------- function defining Dish Shapes
function ellipse(a, b, d = 0, rot1 = 0, rot2 = 360) = [for (t = [rot1:step:rot2]) [a*cos(t)+a, b*sin(t)*(1+d*cos(t))]]; //Centered at a apex to avoid inverted face
function DishShape (a,b,c,d) =
concat(
// [[c+a,b]],
ellipse(a, b, d = 0,rot1 = 90, rot2 = 270)
// [[c+a,-b]]
);
function oval_path(theta, phi, a, b, c, deform = 0) = [
a*cos(theta)*cos(phi), //x
c*sin(theta)*(1+deform*cos(theta)) , //
b*sin(phi),
];
path_trans2 = [for (t=[0:step:180]) translation(oval_path(t,0,10,15,2,0))*rotation([0,90,0])];
//--------------Function definng Cap
function CapTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*KeyHeight(keyID)) //Z shift
];
function InnerTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*(KeyHeight(keyID)-topthickness)) //Z shift
];
function CapRotation(t, keyID) =
[
((1-t)/layers*XAngleSkew(keyID)), //X shift
((1-t)/layers*YAngleSkew(keyID)), //Y shift
((1-t)/layers*ZAngleSkew(keyID)) //Z shift
];
function CapTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)) + (1-pow(t/layers, WidExponent(keyID)))*BottomWidth(keyID) ,
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)) + (1-pow(t/layers, LenExponent(keyID)))*BottomLength(keyID)
];
function CapRoundness(t, keyID) =
[
pow(t/layers, ChamExponent(keyID))*(CapRound0f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound0i(keyID),
pow(t/layers, ChamExponent(keyID))*(CapRound1f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound1i(keyID)
];
function CapRadius(t, keyID) = pow(t/layers, ChamExponent(keyID))*ChamfFinRad(keyID) + (1-pow(t/layers, ChamExponent(keyID)))*ChamfInitRad(keyID);
function InnerTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, WidExponent(keyID)))*(BottomWidth(keyID) -wallthickness*2+1.25),
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, LenExponent(keyID)))*(BottomLength(keyID)-wallthickness*2+1.25)
];
function StemTranslation(t, keyID) =
[
((1-t)/stemLayers*TopWidShift(keyID)), //X shift
((1-t)/stemLayers*TopLenShift(keyID)), //Y shift
stemCrossHeight+.1+StemBrimDep + (t/stemLayers*(KeyHeight(keyID)- topthickness - stemCrossHeight+.1 -StemBrimDep)) //Z shift
];
function StemRotation(t, keyID) =
[
((1-t)/stemLayers*XAngleSkew(keyID)), //X shift
((1-t)/stemLayers*YAngleSkew(keyID)), //Y shift
((1-t)/stemLayers*ZAngleSkew(keyID)) //Z shift
];
function StemTransform(t, keyID) =
[
pow(t/stemLayers, WidExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/stemLayers, WidExponent(keyID)))*(Dcyl+sin(draftAngle)*(StemBrimDep)),
pow(t/stemLayers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/stemLayers, LenExponent(keyID)))*(Dcyl+sin(draftAngle)*(StemBrimDep))
];
function StemRoundness(t, keyID) =
[
pow(t/stemLayers, ChamExponent(keyID))*(CapRound0f(keyID)) + (1-pow(t/stemLayers, ChamExponent(keyID)))*Dcyl+sin(draftAngle)*(stemCrossHeight+.1+StemBrimDep),
pow(t/stemLayers, ChamExponent(keyID))*(CapRound1f(keyID)) + (1-pow(t/stemLayers, ChamExponent(keyID)))*Dcyl+sin(draftAngle)*(stemCrossHeight+.1+StemBrimDep)
];
function periodic(a) = sign(a);
function elliptical_rectangle_position(a = [1,1], b =[1,1], fn=32, phase = 0) = [
//x
(phase > -atan(a[1]/b[1]) && phase <= atan(a[1]/b[1])) ? //IV->I quadtrant right
(b[1]*cos(phase)+ a[0]*cos(atan(b[0]/a[0])) - b[1]*cos(atan(a[1]/b[1])))/2 :
(phase > atan(a[1]/b[1]) && phase <= 3*atan(a[1]/b[1])) ? // I->II top
(a[0]*cos(atan(b[0]/a[0])-atan(a[1]/b[1])+phase))/2:
(phase > 3*atan(a[1]/b[1]) && phase <= 5*atan(a[1]/b[1])-atan(b[0]/a[0])) ? // II->III left
(b[1]*cos(phase-2*atan(a[1]/b[1])+2*atan(b[0]/a[0]))-a[0]*cos(atan(b[0]/a[0]))+b[1]*cos(atan(a[1]/b[1])))/2:
(phase > 5*atan(a[1]/b[1])-atan(b[0]/a[0]) && phase <= 7*atan(a[1]/b[1])) ? //III->IV
(a[0]*cos(phase-3*atan(a[1]/b[1])+3*atan(b[0]/a[0])))/2:0,
//y
(phase > -atan(a[1]/b[1]) && phase <= atan(a[1]/b[1])) ? //IV->I quadtrant right
(a[1]*sin(phase))/2 :
(phase > atan(a[1]/b[1]) && phase <= atan(a[1]/b[1])*3) ? // I->II top
(b[0]*sin(atan(b[0]/a[0])-atan(a[1]/b[1])+phase)-b[0]*sin(atan(b[0]/a[0]))+a[1]*sin(atan(a[1]/b[1])))/2:
(phase > atan(a[1]/b[1])*3 && phase <= 5*atan(a[1]/b[1])-atan(b[0]/a[0])) ? // II->III left
(a[1]*sin(phase-2*atan(a[1]/b[1])+2*atan(b[0]/a[0])))/2:
(phase > 5*atan(a[1]/b[1])-atan(b[0]/a[0]) && phase <= 7*atan(a[1]/b[1])) ? //III->IV
(b[0]*sin(phase-3*atan(a[1]/b[1])+3*atan(b[0]/a[0]))+b[0]*sin(atan(b[0]/a[0]))-a[1]*sin(atan(a[1]/b[1])))/2:0,
//z
0
];
function rotationMat(x,theta) =
[
x[0],// + x[0]*cos(theta[1]) + x[2]*sin(theta[1]) + x[0]*cos(theta[2]) - x[1]*sin(theta[2]), //x
x[1],// + x[1]*cos(theta[0]) - x[2]*sin(theta[0]) + + x[0]*sin(theta[2]) + x[1]*cos(theta[2]), //y
x[1]*sin(theta[0]) + x[2]*cos(theta[0]) +-x[0]*sin(theta[1]) + x[2]*cos(theta[1])+ x[2], //z
];
function KurlPathTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, WidExponent(keyID)))*(BottomWidth(keyID) -wallthickness*2+1.25),
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, LenExponent(keyID)))*(BottomLength(keyID)-wallthickness*2+1.25)
];
function KurlTranslation(t, w, phi, keyID) =
[//top surface translation
((1-t)/layers*TopWidShift(keyID)),
((1-t)/layers*TopLenShift(keyID)),
(t/layers*(KeyHeight(keyID)-topthickness)) //Z shift
] +
rotationMat( //rotation offset
elliptical_rectangle_position(
a = KurlPathTransform(t, keyID),
b = CapRoundness(t, keyID),
fn=fn,
phase = phi+w*t
),
KurlRotation(t, keyID)
);
function KurlRotation(t, keyID) = //rotate shape
[
((1-t)/layers*XAngleSkew(keyID)), //X shift
((1-t)/layers*YAngleSkew(keyID)), //Y shift
((1-t)/layers*ZAngleSkew(keyID)) //Z shift
];
///----- KEY Builder Module
module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false, Dish = true, Stem = false, Kurl = true, crossSection = true,Legends = false, homeDot = false, Stab = 0) {
//Set Parameters for dish shape
FrontPath = quantize_trajectories(FrontTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
BackPath = quantize_trajectories(BackTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
//Scaling initial and final dim tranformation by exponents
function FrontDishArc(t) = pow((t)/(len(FrontPath)),FrontArcExpo(keyID))*FrontFinArc(keyID) + (1-pow(t/(len(FrontPath)),FrontArcExpo(keyID)))*FrontInitArc(keyID);
function BackDishArc(t) = pow((t)/(len(FrontPath)),BackArcExpo(keyID))*BackFinArc(keyID) + (1-pow(t/(len(FrontPath)),BackArcExpo(keyID)))*BackInitArc(keyID);
FrontCurve = [ for(i=[0:len(FrontPath)-1]) transform(FrontPath[i], DishShape(DishDepth(keyID), FrontDishArc(i), 1, d = 0)) ];
BackCurve = [ for(i=[0:len(BackPath)-1]) transform(BackPath[i], DishShape(DishDepth(keyID), BackDishArc(i), 1, d = 0)) ];
//builds
if(Stem == false){
difference(){
skin([for (i=[0:layers-1]) transform(translation(CapTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(CapTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]); //outer shell
//cuts
if(Dish == true){
if(visualizeDish == false){
translate([-TopWidShift(keyID),.00001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
} else {
#translate([-TopWidShift(keyID),.00001-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)]) rotate([0,-YAngleSkew(keyID),0])rotate([0,-90+XAngleSkew(keyID),90-ZAngleSkew(keyID)])skin(FrontCurve);
#translate([-TopWidShift(keyID),-TopLenShift(keyID),KeyHeight(keyID)-DishHeightDif(keyID)])rotate([0,-YAngleSkew(keyID),0])rotate([0,-90-XAngleSkew(keyID),270-ZAngleSkew(keyID)])skin(BackCurve);
}
}
if(crossSection == true) {
translate([0,-15,-.1])cube([15,30,15]);
}
}
//Homing dot
if(homeDot == true)translate([0,0,KeyHeight(keyID)-DishHeightDif(keyID)-.25])sphere(d = dotRadius);
}
else {
difference(){
union(){
translate([0,0,-.001])skin([for (i=[0:layers-1]) transform(translation(InnerTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(InnerTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]);
// hull(){// cherry top housing
// translate([0,0,-.0])cube([14.5, 14, .1],center = true);
// translate([0,0,5.])cube([11,11, .1],center = true);
// }
}
// #translate([0,0,StemBrimDep])cherry_stem(KeyHeight(keyID)-StemBrimDep, slop); // generate mx cherry stem
if(KeyHeight(keyID) > stemsupportLimit) //only generate stem to top surface support when there is enough room
translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), elliptical_rectangle(StemTransform(i, keyID), b = StemRoundness(i,keyID),fn=fn))]);
// if(Kurl == true){//t, w, phi, keyID
for(n = [-1:10]){
// #skin([for (i=[0:layers-1]) transform(translation(KurlTranslation(i,0/layers,70*n,keyID)) * rotation(CapRotation(i, keyID)),circle(.5/*+.1*sin(5*360/layers*i)*/))]);
// skin([for (i=[0:layers-1]) transform(translation(KurlTranslation(i,-45/layers,500-50*n,keyID)) * rotation(CapRotation(i, keyID)),circle(.5/*+.1*sin(5*360/layers*i)*/))]);
}
// elliptical_rectangle_position(InnerTransform(i, keyID), b = CapRoundness(i,keyID), fn=fn, phase = i*5);
// }
}
}
}
//------------------stems
$fn = fn;
function outer_cherry_stem(slop) = [ stemWid - slop * 2, stemLen - slop * 2];
function outer_cherry_stabilizer_stem(slop) = [4.85 - slop * 2, 6.05 - slop * 2];
function outer_box_cherry_stem(slop) = [6 - slop, 6 - slop];
// .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],
];
module inside_cherry_cross(slop) {
// inside cross
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-0.005]) {
linear_extrude(height = stemCrossHeight) {
square(cherry_cross(slop, extra_vertical)[0], center=true);
square(cherry_cross(slop, extra_vertical)[1], center=true);
}
}
// Guides to assist insertion and mitigate first layer squishing
{
for (i = cherry_cross(slop, extra_vertical)) hull() {
linear_extrude(height = 0.01, center = false) offset(delta = 0.15) square(i, center=true);
translate([0, 0, 0.15]) linear_extrude(height = 0.01, center = false) square(i, center=true);
}
}
}
module cherry_stem(depth, slop) {
D1=.15;
D2=.05;
H1=3.5;
CrossDist = 1.75;
difference(){
// outside shape
// linear_extrude(height = depth) {
// offset(r=1){
// square(outer_cherry_stem(slop) - [2,2], center=true);
// }
// }
cylinder(d1 = Dcyl, d2= Dcyl+sin(draftAngle)*depth, depth, $fn = fn*4);
rotate([0,0,stemRot])inside_cherry_cross(slop);
// hull(){
// translate([CrossDist,CrossDist-.1,0])cylinder(d1=D1, d2=D2, H1);
// translate([-CrossDist,-CrossDist+.1,0])cylinder(d1=D1, d2=D2, H1);
// }
// hull(){
// translate([-CrossDist,CrossDist-.1])cylinder(d1=D1, d2=D2, H1);
// translate([CrossDist,-CrossDist+.1])cylinder(d1=D1, d2=D2, H1);
// }
}
}
module choc_stem() {
translate([5.7/2,0,-3.4/2+2])difference(){
cube([1.25,3, 3.4], center= true);
translate([3.9,0,0])cylinder(d=7,3.4,center = true);
translate([-3.9,0,0])cylinder(d=7,3.4,center = true);
}
translate([-5.7/2,0,-3.4/2+2])difference(){
cube([1.25,3, 3.4], center= true);
translate([3.9,0,0])cylinder(d=7,3.4,center = true);
translate([-3.9,0,0])cylinder(d=7,3.4,center = true);
}
}
/// ----- helper functions
function rounded_rectangle_profile(size=[1,1],r=1,fn=32) = [
for (index = [0:fn-1])
let(a = index/fn*360)
r * [cos(a), sin(a)]
+ sign_x(index, fn) * [size[0]/2-r,0]
+ sign_y(index, fn) * [0,size[1]/2-r]
];
function elliptical_rectangle(a = [1,1], b =[1,1], fn=32) = [
for (index = [0:fn-1]) // section right
let(theta1 = -atan(a[1]/b[1])+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta1), a[1]*sin(theta1)]
+ [a[0]*cos(atan(b[0]/a[0])) , 0]
- [b[1]*cos(atan(a[1]/b[1])) , 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
- [0, b[0]*sin(atan(b[0]/a[0]))]
+ [0, a[1]*sin(atan(a[1]/b[1]))],
for(index = [0:fn-1]) // section left
let(theta2 = -atan(a[1]/b[1])+180+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta2), a[1]*sin(theta2)]
- [a[0]*cos(atan(b[0]/a[0])) , 0]
+ [b[1]*cos(atan(a[1]/b[1])) , 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + 180 + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
+ [0, b[0]*sin(atan(b[0]/a[0]))]
- [0, a[1]*sin(atan(a[1]/b[1]))]
]/2;
function sign_x(i,n) =
i < n/4 || i > n-n/4 ? 1 :
i > n/4 && i < n-n/4 ? -1 :
0;
function sign_y(i,n) =
i > 0 && i < n/2 ? 1 :
i > n/2 ? -1 :
0;

View file

@ -1,419 +0,0 @@
use <scad-utils/morphology.scad> //for cheaper minwoski
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <scad-utils/trajectory.scad>
use <scad-utils/trajectory_path.scad>
use <sweep.scad>
use <skin.scad>
//DP (Distored Pyramidal) [Double Penetration] Profile for neuron sets
//TODO add shift
//#square([22.5, 19.05], center = true);
translate([0, 0, 0])keycap(keyID = 4, cutLen = 0, Stem =true, Dish = true, visualizeDish = true, crossSection = false, homeDot = false, Legends = false);
////fullsetee
//RowHome = [0,0,5,2.5,0,0];
//rotate([0,0,0])
//for(Col = [0:0]){
// for(Row = [1:3]){
// translate([19*Col, 19*Row +RowHome[Col], 0]){
// keycap(keyID = Col*4+Row, cutLen = 0, Stem = true, Dish = true, visualizeDish = true, crossSection = true);
// #translate([0, 0, StemBrimDep])cylinder(d=3,7);
// }
// }
//}
////// thumb
// translate([-15, -4, 0])rotate([0,0,30])keycap(keyID = 0, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([10, 0, 0])rotate([0,0,15])keycap(keyID = 4, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
// translate([31, 2.2, 0])rotate([0,0,0])keycap(keyID = 8, cutLen = 0, Stem =false, Dish = true, visualizeDish = false, crossSection = false);
//Parameters
wallthickness = 1.25;
topthickness = 2.5;
stepsize = 50; //resolution of Trajectory
step = 6; //resolution of ellipes
fn = 32; //resolution of Rounded Rectangles: 60 for output
layers = 50; //resolution of vertical Sweep: 50 for output
//---Stem param
slop = 0.4;
stemRot = 0;
stemWid = 7.2;
stemLen = 5.5;
stemCrossHeight = 7;
extra_vertical = 0.6;
StemBrimDep = 0.75;
stemLayers = 20; //resolution of stem to cap top transition
proHeight = 3.5;
dishLayers = 30;
keyParameters = //keyParameters[KeyID][ParameterID]
[
// BotWid, BotLen, TWDif, TLDif, keyh, WSft, LSft XSkew, YSkew, ZSkew, WEx, LEx, CapR0i, CapR0f, CapR1i, CapR1f, CapREx, StemEx
//3 heavy sculpt rows setup
[17.16, 17.16, 8.0, 8.0, 8.5+proHeight, 0, 0, -5, 0, -0, 2, 2, 1, 3.999, 1, 5, 2, 2], //R5
[17.96, 17.96, 8.0, 8.0, 7.8+proHeight, 0, 0, 10, 0, -0, 2, 2, .1, 3.999, .1, 3.399, 2, 2], //R4
[17.96, 17.96, 8.0, 8.0, 7.8+proHeight, 0, .5, -10, 0, -0, 2, 2, .1, 3.399, .1, 3.399, 2, 2], //R3
[17.96, 17.96, 8.0, 8.0,10.8+proHeight, 0, 0, -16, 0, -0, 2, 2, .1, 3.399, .1, 3.399, 2, 2], //R2
[17.96, 17.96, 8.0, 8.0, 8.0+proHeight, 0, .5, -10, 0, -0, 2, 2, .1, 3.399, .1, 3.399, 2, 2], //R3 home
//mods neuron
[22.26, 17.96, 8.0, 8.0, 7.8+proHeight, 0, .5, -10, 0, -0, 2, 2, .1, 3.399, .1, 3.399, 2, 2], //R3 1.25
[31.06, 17.96, 8.0, 8.0, 7.8+proHeight, 0, .5, -10, 0, -0, 2, 2, .1, 3.399, .1, 3.399, 2, 2], //R3 1.75
[22.26, 17.96, 8.4, 8.4, 7.8+proHeight, 0, 0, 10, 0, -0, 2, 2, .1, 3.399, .1, 3.399, 2, 2], //R4 1.25
[32.06, 17.96, 8.4, 8.4, 7.8+proHeight, 0, 0, 10, 0, -0, 2, 2, .1, 3.399, .1, 3.399, 2, 2], //R4 1.75
//mods van
[32.06, 17.96, 8.4, 8.4,10.8+proHeight, 0, 0, -16, 0, -0, 2, 2, .1, 3.399, .1, 3.399, 2, 2], //R2 1.75
[22.26, 17.96, 8.0, 8.0, 7.8+proHeight, 0, .5, -10, 0, -0, 2, 2, .1, 3.399, .1, 3.399, 2, 2], //R3 1.25
[26.66, 17.96, 8.0, 8.0, 7.8+proHeight, 0, .5, -10, 0, -0, 2, 2, .1, 3.399, .1, 3.399, 2, 2], //R3 1.5
[32.06, 17.96, 8.0, 8.0, 7.8+proHeight, 0, 0, 10, 0, -0, 2, 2, .1, 3.999, .1, 3.399, 2, 2], //R4 1.75
];
function BottomWidth(keyID) = keyParameters[keyID][0]; //
function BottomLength(keyID) = keyParameters[keyID][1]; //
function TopWidthDiff(keyID) = keyParameters[keyID][2]; //
function TopLenDiff(keyID) = keyParameters[keyID][3]; //
function KeyHeight(keyID) = keyParameters[keyID][4]; //
function TopWidShift(keyID) = keyParameters[keyID][5];
function TopLenShift(keyID) = keyParameters[keyID][6];
function XAngleSkew(keyID) = keyParameters[keyID][7];
function YAngleSkew(keyID) = keyParameters[keyID][8];
function ZAngleSkew(keyID) = keyParameters[keyID][9];
function WidExponent(keyID) = keyParameters[keyID][10];
function LenExponent(keyID) = keyParameters[keyID][11];
function CapRound0i(keyID) = keyParameters[keyID][12];
function CapRound0f(keyID) = keyParameters[keyID][13];
function CapRound1i(keyID) = keyParameters[keyID][14];
function CapRound1f(keyID) = keyParameters[keyID][15];
function ChamExponent(keyID) = keyParameters[keyID][16];
function StemExponent(keyID) = keyParameters[keyID][17];
dishParameters = //dishParameter[keyID][ParameterID]
[
// EdOf fn LEx WEx DshDep Ch0i, ch1i, Ch0f, Ch1f, DishExp
//3rows
[1.00, .005, 2, 2, 2.2, 3.399,3.399, .001, .001, 2.0], //R5
[1.00, .005, 2, 2, 2.2, 3.399,3.399, .001, .001, 2.0], //R4
[1.00, .005, 2, 2, 2.2, 3.399,3.399, .001, .001, 2.0], //R3
[1.00, .005, 2, 2, 2.2, 3.399,3.399, .001, .001, 2.0], //R2
[1.00, .005, 2, 2, 2.5, 3.399,3.399, .001, .001, 2.5], //R3 homet
//Mods
[1.00, .005, 1.5, 1.5, 2.5, 3.399,3.399, .001, .001, 2.5], //R3
[1.00, .005, 1.5, 1.5, 2.5, 3.399,3.399, .001, .001, 2.5], //R3
[1.00, .005, 1.5, 1.5, 2.5, 3.399,3.399, .001, .001, 2.5], //R2
[1.00, .005, 1.5, 1.5, 2.5, 3.399,3.399, .001, .001, 2.5], //R2
// Van
[1.00, .005, 2, 2, 2.5, 3.399,3.399, .001, .001, 2.5], //R2
[1.00, .005, 2, 2, 2.5, 3.399,3.399, .001, .001, 2.5], //R3
[1.00, .005, 2, 2, 2.5, 3.399,3.399, .001, .001, 2.5], //R3
[1.00, .005, 2, 2, 2.5, 3.399,3.399, .001, .001, 2.5], //R4
];
function EdgeOffset(keyID) = dishParameters[keyID][0]; //
function LenFinal(keyID) = dishParameters[keyID][1]; //
function LenExpo(keyID) = dishParameters[keyID][2]; //
function WidExpo(keyID) = dishParameters[keyID][3]; //
function DishDepth(keyID) = dishParameters[keyID][4]; //
function DishCham0i(keyID) = dishParameters[keyID][5]; //
function DishCham1i(keyID) = dishParameters[keyID][6]; //
function DishCham0f(keyID) = dishParameters[keyID][7]; //
function DishCham1f(keyID) = dishParameters[keyID][8]; //
function DishExpo(keyID) = dishParameters[keyID][9];
//function FrontTrajectory(keyID) =
// [
// trajectory(forward = FrontForward1(keyID), pitch = FrontPitch1(keyID)), //more param available: yaw, roll, scale
// trajectory(forward = FrontForward2(keyID), pitch = FrontPitch2(keyID)) //You can add more traj if you wish
// ];
//
//function BackTrajectory (keyID) =
// [
// trajectory(forward = BackForward1(keyID), pitch = BackPitch1(keyID)),
// trajectory(forward = BackForward2(keyID), pitch = BackPitch2(keyID)),
// ];
//------- function defining Dish Shapes
function ellipse(a, b, d = 0, rot1 = 0, rot2 = 360) = [for (t = [rot1:step:rot2]) [a*cos(t)+a, b*sin(t)*(1+d*cos(t))]]; //Centered at a apex to avoid inverted face
function DishShape (a,b,c,d) =
concat(
// [[c+a,b]],
ellipse(a, b, d = 0,rot1 = 90, rot2 = 270)
// [[c+a,-b]]
);
function oval_path(theta, phi, a, b, c, deform = 0) = [
a*cos(theta)*cos(phi), //x
c*sin(theta)*(1+deform*cos(theta)) , //
b*sin(phi),
];
path_trans2 = [for (t=[0:step:180]) translation(oval_path(t,0,10,15,2,0))*rotation([0,90,0])];
//--------------Function definng Cap
function CapTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*KeyHeight(keyID)) //Z shift
];
function InnerTranslation(t, keyID) =
[
((1-t)/layers*TopWidShift(keyID)), //X shift
((1-t)/layers*TopLenShift(keyID)), //Y shift
(t/layers*(KeyHeight(keyID)-topthickness)) //Z shift
];
function CapRotation(t, keyID) =
[
((1-t)/layers*XAngleSkew(keyID)), //X shift
((1-t)/layers*YAngleSkew(keyID)), //Y shift
((1-t)/layers*ZAngleSkew(keyID)) //Z shift
];
function CapTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)) + (1-pow(t/layers, WidExponent(keyID)))*BottomWidth(keyID) ,
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)) + (1-pow(t/layers, LenExponent(keyID)))*BottomLength(keyID)
];
function CapRoundness(t, keyID) =
[
pow(t/layers, ChamExponent(keyID))*(CapRound0f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound0i(keyID),
pow(t/layers, ChamExponent(keyID))*(CapRound1f(keyID)) + (1-pow(t/layers, ChamExponent(keyID)))*CapRound1i(keyID)
];
function InnerTransform(t, keyID) =
[
pow(t/layers, WidExponent(keyID))*(BottomWidth(keyID) -TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, WidExponent(keyID)))*(BottomWidth(keyID) -wallthickness*2),
pow(t/layers, LenExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness*2) + (1-pow(t/layers, LenExponent(keyID)))*(BottomLength(keyID)-wallthickness*2)
];
function StemTranslation(t, keyID) =
[
((1-t)/stemLayers*TopWidShift(keyID)), //X shift
((1-t)/stemLayers*TopLenShift(keyID)), //Y shift
stemCrossHeight+.1+StemBrimDep + (t/stemLayers*(KeyHeight(keyID)- topthickness - stemCrossHeight-.1 -StemBrimDep)) //Z shift
];
function StemRotation(t, keyID) =
[
((1-t)/stemLayers*XAngleSkew(keyID)), //X shift
((1-t)/stemLayers*YAngleSkew(keyID)), //Y shift
((1-t)/stemLayers*ZAngleSkew(keyID)) //Z shift
];
function StemTransform(t, keyID) =
[
pow(t/stemLayers, StemExponent(keyID))*(BottomWidth(keyID) -TopWidthDiff(keyID)-wallthickness) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemWid - 2*slop),
pow(t/stemLayers, StemExponent(keyID))*(BottomLength(keyID)-TopLenDiff(keyID)-wallthickness) + (1-pow(t/stemLayers, StemExponent(keyID)))*(stemLen - 2*slop)
];
function StemRadius(t, keyID) = pow(t/stemLayers,3)*3 + (1-pow(t/stemLayers, 3))*1;
//----- Distorted Pyramidal Dish
function DishTranslation(t, keyID) =
[
((t)/dishLayers*TopWidShift(keyID)), //X shift
(-TopLenShift(keyID)), //Y shift
KeyHeight(keyID)-(t)/dishLayers*(DishDepth(keyID)) //Z shift
];
function DishRotation(t, keyID) =
[
(-XAngleSkew(keyID)), //X shift
(-YAngleSkew(keyID)), //Y shift
(-ZAngleSkew(keyID)) //Z shift
];
function DishTransform(t, keyID) =
[
(1-pow(t/dishLayers, WidExpo(keyID)))*(BottomWidth(keyID) -TopWidthDiff(keyID)+EdgeOffset(keyID)) + (pow(t/dishLayers, WidExpo(keyID)))*(LenFinal(keyID)),
(1-pow(t/dishLayers, LenExpo(keyID)))*(BottomLength(keyID)-TopLenDiff(keyID)+EdgeOffset(keyID)) + (pow(t/dishLayers, LenExpo(keyID)))*(LenFinal(keyID))
];
function DishRoundness(t, keyID) =
[
pow(t/dishLayers, DishExpo(keyID))*(DishCham0f(keyID)) + (1-pow(t/dishLayers, DishExpo(keyID)))*DishCham0i(keyID),
pow(t/dishLayers, DishExpo(keyID))*(DishCham1f(keyID)) + (1-pow(t/dishLayers, DishExpo(keyID)))*DishCham1i(keyID)
];
///----- KEY Builder Module
module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false, Dish = true, Stem = false, homeDot = false, Stab = false, Stab = 0) {
// //Set Parameters for dish shape
// FrontPath = quantize_trajectories(FrontTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
// BackPath = quantize_trajectories(BackTrajectory(keyID), steps = stepsize, loop=false, start_position= $t*4);
//
// //Scaling initial and final dim tranformation by exponents
// function FrontDishArc(t) = pow((t)/(len(FrontPath)),FrontArcExpo(keyID))*FrontFinArc(keyID) + (1-pow(t/(len(FrontPath)),FrontArcExpo(keyID)))*FrontInitArc(keyID);
// function BackDishArc(t) = pow((t)/(len(FrontPath)),BackArcExpo(keyID))*BackFinArc(keyID) + (1-pow(t/(len(FrontPath)),BackArcExpo(keyID)))*BackInitArc(keyID);
//
// FrontCurve = [ for(i=[0:len(FrontPath)-1]) transform(FrontPath[i], DishShape(DishDepth(keyID), FrontDishArc(i), 1, d = 0)) ];
// BackCurve = [ for(i=[0:len(BackPath)-1]) transform(BackPath[i], DishShape(DishDepth(keyID), BackDishArc(i), 1, d = 0)) ];
//builds
difference(){
union(){
difference(){
skin([for (i=[0:layers-1]) transform(translation(CapTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(CapTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]); //outer shell
//Cut inner shell
if(Stem == true){
translate([0,0,-.001])skin([for (i=[0:layers-1]) transform(translation(InnerTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(InnerTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]);
}
}
if(Stem == true){
translate([0,0,StemBrimDep])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID)-StemBrimDep-1, slop); //
if (Stab != 0){
translate([Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
translate([-Stab/2,0,0])rotate([0,0,stemRot])cherry_stem(KeyHeight(keyID), slop);
//TODO add binding support?
}
translate([0,0,-.001])skin([for (i=[0:stemLayers-1]) transform(translation(StemTranslation(i,keyID))*rotation(StemRotation(i, keyID)), rounded_rectangle_profile(StemTransform(i, keyID),fn=fn,r=StemRadius(i, keyID)))]); //Transition Support for taller profile
}
//cut for fonts and extra pattern for light?
}
//Cuts
//Fonts
if(Legends == true){
// #rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([0,4,KeyHeight(keyID)-2.5])linear_extrude(height = 0.5)text( text = "Why?", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
// #rotate([-XAngleSkew(keyID),YAngleSkew(keyID),ZAngleSkew(keyID)])translate([0,-3.5,0])linear_extrude(height = 0.5)text( text = "Me", font = "Constantia:style=Bold", size = 3, valign = "center", halign = "center" );
}
//Dish Shape
if(Dish == true){
if(visualizeDish == false){
skin([for (i=[0:dishLayers]) transform(translation(DishTranslation(i, keyID)) * rotation(DishRotation(i, keyID)),
elliptical_rectangle(DishTransform(i, keyID), b = DishRoundness(i,keyID),fn=fn)
)]);
} else {
#skin([for (i=[0:dishLayers]) transform(translation(DishTranslation(i, keyID)) * rotation(DishRotation(i, keyID)),
elliptical_rectangle(DishTransform(i, keyID), b = DishRoundness(i,keyID),fn=fn)
)]);
}
}
if(crossSection == true) {
translate([0,-15,-.1])cube([15,30,15]);
}
}
//Homing dot
if(homeDot == true)translate([0,0,KeyHeight(keyID)-DishDepth(keyID)-.1])sphere(d = 1);
}
//------------------stems
$fn = fn;
function outer_cherry_stem(slop) = [ stemWid - slop * 2, stemLen - slop * 2];
function outer_cherry_stabilizer_stem(slop) = [4.85 - slop * 2, 6.05 - slop * 2];
function outer_box_cherry_stem(slop) = [6 - slop, 6 - slop];
// .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],
];
module inside_cherry_cross(slop) {
// inside cross
// translation purely for aesthetic purposes, to get rid of that awful lattice
translate([0,0,-0.005]) {
linear_extrude(height = 4) {
square(cherry_cross(slop, extra_vertical)[0], center=true);
square(cherry_cross(slop, extra_vertical)[1], center=true);
}
}
// Guides to assist insertion and mitigate first layer squishing
{
for (i = cherry_cross(slop, extra_vertical)) hull() {
linear_extrude(height = 0.01, center = false) offset(delta = 0.4) square(i, center=true);
translate([0, 0, 0.5]) linear_extrude(height = 0.01, center = false) square(i, center=true);
}
}
}
module cherry_stem(depth, slop) {
D1=.15;
D2=.05;
H1=3.5;
CrossDist = 1.75;
difference(){
// outside shape
linear_extrude(height = depth) {
offset(r=1){
square(outer_cherry_stem(slop) - [2,2], center=true);
}
}
#inside_cherry_cross(slop);
hull(){
translate([CrossDist,CrossDist-.1,0])cylinder(d1=D1, d2=D2, H1);
translate([-CrossDist,-CrossDist+.1,0])cylinder(d1=D1, d2=D2, H1);
}
hull(){
translate([-CrossDist,CrossDist-.1])cylinder(d1=D1, d2=D2, H1);
translate([CrossDist,-CrossDist+.1])cylinder(d1=D1, d2=D2, H1);
}
}
}
/// ----- helper functions
function rounded_rectangle_profile(size=[1,1],r=1,fn=32) = [
for (index = [0:fn-1])
let(a = index/fn*360)
r * [cos(a), sin(a)]
+ sign_x(index, fn) * [size[0]/2-r,0]
+ sign_y(index, fn) * [0,size[1]/2-r]
];
function elliptical_rectangle(a = [1,1], b =[1,1], fn=32) = [
for (index = [0:fn-1]) // section right
let(theta1 = -atan(a[1]/b[1])+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta1), a[1]*sin(theta1)]
+ [a[0]*cos(atan(b[0]/a[0])), 0]
- [b[1]*cos(atan(a[1]/b[1])), 0],
for(index = [0:fn-1]) // section Top
let(theta2 = atan(b[0]/a[0]) + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta2), b[0]*sin(theta2)]
- [0, b[0]*sin(atan(b[0]/a[0]))]
+ [0, a[1]*sin(atan(a[1]/b[1]))],
for(index = [0:fn-1]) // section left
let(theta3 = -atan(a[1]/b[1])+180+ 2*atan(a[1]/b[1])*index/fn)
[b[1]*cos(theta3), a[1]*sin(theta3)]
- [a[0]*cos(atan(b[0]/a[0])), 0]
+ [b[1]*cos(atan(a[1]/b[1])), 0],
for(index = [0:fn-1]) // section Top
let(theta4 = atan(b[0]/a[0]) + 180 + (180 -2*atan(b[0]/a[0]))*index/fn)
[a[0]*cos(theta4), b[0]*sin(theta4)]
+ [0, b[0]*sin(atan(b[0]/a[0]))]
- [0, a[1]*sin(atan(a[1]/b[1]))]
]/2;
function sign_x(i,n) =
i < n/4 || i > n-n/4 ? 1 :
i > n/4 && i < n-n/4 ? -1 :
0;
function sign_y(i,n) =
i > 0 && i < n/2 ? 1 :
i > n/2 ? -1 :
0;

View file

@ -1,143 +0,0 @@
use <z-butt.scad>
lp_master_base(xu = 1.5, yu = 1);
//mark_height = 4.9;
mark_height = 1.55;
//translate([0,0,20])lp_stem_cavity(xu = 2, yu = 1);
//difference(){
//
// lp_stem_cavity(xu = 2, yu = 1);
//// translate([0,4,5.5])mirror([1,0,0])text( text = "pqp", font ="Wingdings3:style=Regular", size = 2, valign = "center", halign = "center" );
// translate([1,0,0,]){
// translate([3.75,-3.75,mark_height ])hull(){
// rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
// translate([0,0,.5])rotate([0,0,60])cylinder(r = .5, .1, $fn = 3);
// }
// translate([0.75,-3.75,mark_height ])hull(){
// rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
// translate([0,0,.5])rotate([0,0,0])cylinder(r = .5, .1, $fn = 3);
// }
// }
// translate([1,0,0,])translate([2.25,-4.5,mark_height ])rotate([0,0,180])hull(){
// rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
// translate([0,0,.5])rotate([0,0,-30])cylinder(r = .5, .1, $fn = 3);
// }
//
// translate([1,0,0,])translate([3.75,-2.,mark_height ])rotate([0,0,180])hull(){
// rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
// translate([0,0,.5])rotate([0,0,30])cylinder(r = .5, .1, $fn = 3);
// }
// translate([-5,4,mark_height-.1]) {
// difference() {
// minkowski(){
// {
// union(){
// cylinder(r=.75, .25, $fn = 32);
// translate([0,-.05,0])cube([4.5,.1,.25]);
// }
// }
// sphere(.15, $fn = 32);
// }
// cylinder(r=.75, , $fn = 32,center = true);
// }
// sphere(.65, $fn = 32);
// translate([2.25,0,0])sphere(.65, $fn = 32);
// translate([4.5,0,0])sphere(.65, $fn = 32);
//
// }
//}
// translate([0,0,-10])cube([20,20,20]);
//container(xu = 1, yu = 2.25, yn = 2);
// simplex sig
//1.5u
//difference(){
//
// lp_stem_cavity(xu = 1.5, yu = 1);
//// translate([0,4,5.5])mirror([1,0,0])text( text = "pqp", font ="Wingdings3:style=Regular", size = 2, valign = "center", halign = "center" );
// translate([1,0,0,]){
// translate([5.5,-3.75,mark_height ])hull(){
// rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
// translate([0,0,.5])rotate([0,0,60])cylinder(r = .5, .1, $fn = 3);
// }
// translate([8.5,-3.75,mark_height ])hull(){
// rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
// translate([0,0,.5])rotate([0,0,0])cylinder(r = .5, .1, $fn = 3);
// }
// }
// translate([1,0,0,])translate([7.0,-4.5,mark_height ])rotate([0,0,180])hull(){
// rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
// translate([0,0,.5])rotate([0,0,-30])cylinder(r = .5, .1, $fn = 3);
// }
//
// translate([1,0,0,])translate([8.5,-2.1,mark_height ])rotate([0,0,180])hull(){
// rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
// translate([0,0,.5])rotate([0,0,30])cylinder(r = .5, .1, $fn = 3);
// }
//
// translate([-10,4.5,mark_height-.1]) {
// difference() {
// minkowski(){
// {
// union(){
// cylinder(r=.75, .25, $fn = 32);
// translate([0,-.05,0])cube([4.5,.1,.25]);
// }
// }
// sphere(.15, $fn = 32);
// }
// cylinder(r=.75, , $fn = 32,center = true);
// }
// sphere(.65, $fn = 32);
// translate([2.25,0,0])sphere(.65, $fn = 32);
// translate([4.5,0,0])sphere(.65, $fn = 32);
//
// }
//}
//
// 2u sig
//difference(){
//
// lp_stem_cavity(xu = 2, yu = 1);
//// translate([0,4,5.5])mirror([1,0,0])text( text = "pqp", font ="Wingdings3:style=Regular", size = 2, valign = "center", halign = "center" );
// translate([1,0,0,]){
// translate([13.6,-3.75,mark_height ])hull(){
// rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
// translate([0,0,.5])rotate([0,0,60])cylinder(r = .5, .1, $fn = 3);
// }
// translate([10.4,-3.75,mark_height ])hull(){
// rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
// translate([0,0,.5])rotate([0,0,0])cylinder(r = .5, .1, $fn = 3);
// }
// }
// translate([1,0,0,])translate([12.,-4.5,mark_height ])rotate([0,0,180])hull(){
// rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
// translate([0,0,.5])rotate([0,0,-30])cylinder(r = .5, .1, $fn = 3);
// }
//
// translate([1,0,0,])translate([13.6,-2.,mark_height ])rotate([0,0,180])hull(){
// rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
// translate([0,0,.5])rotate([0,0,30])cylinder(r = .5, .1, $fn = 3);
// }
//
// translate([-15,4.5,mark_height-.1]) {
// difference() {
// minkowski(){
// {
// union(){
// cylinder(r=.75, .25, $fn = 32);
// translate([0,-.05,0])cube([4.5,.1,.25]);
// }
// }
// sphere(.15, $fn = 32);
// }
// cylinder(r=.75, , $fn = 32,center = true);
// }
// sphere(.65, $fn = 32);
// translate([2.25,0,0])sphere(.65, $fn = 32);
// translate([4.5,0,0])sphere(.65, $fn = 32);
//
// }
//}

View file

@ -1,103 +0,0 @@
use <z-butt.scad>
//lp_master_base(xu = 1, yu = 1);
shiftx = 0;//5.1;
rot = 0;
translate([-10,4,0])cube([20,10,10]);
//translate([0,0,20])lp_stem_cavity(xu = 2, yu = 1);
//difference(){
//
// mx_stem_cavity(xu = 1.5, yu = 1);
//// translate([0,4,5.5])mirror([1,0,0])text( text = "pqp", font ="Wingdings3:style=Regular", size = 2, valign = "center", halign = "center" );
// translate([3.75+shiftx,-3.75,4.9])hull(){
// rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
// translate([0,0,.5])rotate([0,0,60])cylinder(r = .5, .1, $fn = 3);
// }
// translate([0.75+shiftx,-3.75,4.9])hull(){
// rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
// translate([0,0,.5])rotate([0,0,0])cylinder(r = .5, .1, $fn = 3);
// }
//
//}
// translate([2.25+shiftx,-4.5,4.9])rotate([0,180,180])hull(){
// rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
// translate([0,0,.5])rotate([0,0,-30])cylinder(r = .5, .1, $fn = 3);
// }
//
// translate([3.75+shiftx,-2.,4.9])rotate([0,180,180])hull(){
// rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
// translate([0,0,.5])rotate([0,0,30])cylinder(r = .5, .1, $fn = 3);
// }
//// translate([0,0,-10])cube([20,20,20]);
////container(xu = 1, yu = 2.25, yn = 2);
// // simplex sig
// translate([-4-shiftx,4,5]) {
// difference() {
// minkowski(){
// {
// union(){
// cylinder(r=.75, .25, $fn = 32);
// translate([0,-.05,0])cube([4.5,.1,.25]);
// }
// }
// sphere(.15, $fn = 32);
// }
// cylinder(r=.75, , $fn = 32,center = true);
// }
// sphere(.65, $fn = 32);
// translate([2.25,0,0])sphere(.65, $fn = 32);
// translate([4.5,0,0])sphere(.65, $fn = 32);
//
// }
//
difference(){
mx_stem_cavity(xu = 1, yu = 1);
// translate([0,4,5.5])mirror([1,0,0])text( text = "pqp", font ="Wingdings3:style=Regular", size = 2, valign = "center", halign = "center" );
#rotate([0,0,rot]){
translate([3.5+shiftx,-3.65,5.45])hull(){
rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
translate([0,0,.5])rotate([0,0,60])cylinder(r = .5, .1, $fn = 3);
}
translate([0.5+shiftx,-3.65,5.45])hull(){
rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
translate([0,0,.5])rotate([0,0,0])cylinder(r = .5, .1, $fn = 3);
}
}
// translate([0,0,-25])cube([20,20,50]);//check
}
rotate([0,0,rot]){
translate([2.+shiftx,-4.40,5.55])rotate([0,180,180])hull(){
rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
translate([0,0,.5])rotate([0,0,-30])cylinder(r = .5, .1, $fn = 3);
}
// translate([2.25+shiftx,-2.85,5.0])sphere(.20, $fn = 32);
translate([3.5+shiftx,-2.0,5.55])rotate([0,180,180])hull(){
rotate([0,0,30])cylinder(r = 1.5, .1, $fn = 3);
translate([0,0,.5])rotate([0,0,30])cylinder(r = .5, .1, $fn = 3);
}
}
// translate([0,0,-10])cube([20,20,20]);
//container(xu = 1, yu = 2.25, yn = 2);
// simplex sig
rotate([0,0,rot])translate([-3.75-shiftx,4,5.5]) {
difference() {
minkowski(){
{
union(){
cylinder(r=.75, .25, $fn = 32);
translate([0,-.05,0])cube([4.5,.1,.25]);
}
}
sphere(.15, $fn = 32);
}
cylinder(r=.75, , $fn = 32,center = true);
}
sphere(.65, $fn = 32);
translate([2.25,0,0])sphere(.65, $fn = 32);
translate([4.5,0,0])sphere(.65, $fn = 32);
}