Fix the models to sit flush on the XY plane.

The skin() function will twist the layers, so that the first layer is
above/below the XY plane a little from left to right. This means you
can't print them easily like this and can be fixed by producing more of
the outer shell and snipping it off at the XY plane exactly.
This commit is contained in:
Ulrich Spörlein 2022-03-20 11:02:54 +01:00
parent e32c51a9de
commit 8228775bf8
2 changed files with 8 additions and 4 deletions

View file

@ -319,12 +319,14 @@ module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false,
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
skin([for (i=[-1: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))]);
translate([0,0,-.001])skin([for (i=[-1:layers-1]) transform(translation(InnerTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(InnerTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]);
}
// Cut off the extra bottom due to starting at layer -1
translate ([-50,-50,-10]) cube ([100,100,10], center=false);
}
if(Stem == true){
translate([0,0,StemBrimDep])rotate(stemRot)difference(){

View file

@ -288,12 +288,14 @@ module keycap(keyID = 0, cutLen = 0, visualizeDish = false, rossSection = false,
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
skin([for (i=[-1: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))]);
translate([0,0,-.001])skin([for (i=[-1:layers-1]) transform(translation(InnerTranslation(i, keyID)) * rotation(CapRotation(i, keyID)), elliptical_rectangle(InnerTransform(i, keyID), b = CapRoundness(i,keyID),fn=fn))]);
}
// Cut off the extra bottom due to starting at layer -1
translate ([-50,-50,-10]) cube ([100,100,10], center=false);
}
if(Stem == true){
translate([0,0,StemBrimDep])rotate(stemRot)difference(){