fix: lots of tolerance issues

This commit is contained in:
s3lph 2025-03-31 00:03:48 +02:00
parent 279e941082
commit e17a01bc0d
Signed by: s3lph
GPG key ID: 0AA29A52FB33CFB5
5 changed files with 14 additions and 16 deletions

View file

@ -19,7 +19,7 @@ module case(n=5, diameter=50, tolerance=0.2, $fn=60) {
rotate([0,0,120*j]) { rotate([0,0,120*j]) {
for (i = [0:n]) { for (i = [0:n]) {
translate([0,diameter/4,10*i+3]) { translate([0,diameter/4,10*i+3]) {
cube([5, diameter/2, 3], center=true); cube([4+2*tolerance, diameter/2, 2+2*tolerance], center=true);
} }
} }
} }

View file

@ -11,7 +11,7 @@ module key_dial(alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ", key="C", width=7, dia=50,
} }
// inner ring // inner ring
rotate([0,90,0]) { rotate([0,90,0]) {
cylinder($fn=$fn, h=width+2, d=dia-thick*2, center=true); cylinder($fn=$fn, h=width+2, d=dia-thick*2+2*tolerance, center=true);
} }
// key // key
rotate([45+((0.5+key_index)/len(alphabet)) * 360,0,0]) { rotate([45+((0.5+key_index)/len(alphabet)) * 360,0,0]) {

View file

@ -13,7 +13,7 @@ module lock(alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ", password="CHAOS", diameter=50
for (i = [0:n-1]) { for (i = [0:n-1]) {
rotate([-key_indices[i]/len(alphabet)*360,0,0]) { rotate([-key_indices[i]/len(alphabet)*360,0,0]) {
translate([i*10,0,0]) { translate([i*10,0,0]) {
key_dial(alphabet, key=password[i], dia=diameter); key_dial(alphabet, key=password[i], dia=diameter, font_size=7);
} }
} }
} }
@ -22,13 +22,13 @@ module lock(alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ", password="CHAOS", diameter=50
translate([-5+10*i,0,0]) { translate([-5+10*i,0,0]) {
rotate([0,0,180]) { rotate([0,0,180]) {
rotate([0,90,0]) { rotate([0,90,0]) {
ring(dia=diameter-2, clicker=i>0); ring(dia=diameter-2, clicker=i>0, alphabet_length=len(alphabet));
} }
} }
} }
} }
rotate([45,0,0]) { rotate([45,0,0]) {
case(n, diameter=diameter); case(n, diameter=diameter);
plug(n, diameter=diameter); plug(n, diameter=diameter);

View file

@ -17,7 +17,7 @@ module plug(n=5, diameter=50, tolerance=0.2, $fn=60) {
rotate([0,90,0]) { rotate([0,90,0]) {
// inner cylinder // inner cylinder
difference() { difference() {
cylinder(h=10*n+5, d=diameter-18); cylinder(h=10*n+5, d=diameter-17-2*tolerance);
translate([0,0,-1]) { translate([0,0,-1]) {
cylinder(h=10*n+7, d=diameter-20); cylinder(h=10*n+7, d=diameter-20);
} }

View file

@ -1,6 +1,6 @@
module ring(alphabet_length=26, dia=48, width=3, thick=2, spoke_depth=4.5, spoke_width=7, key_depth=3, key_length=4, tolerance = 0.2, indicator=false, clicker=false, $fn=60) { module ring(alphabet_length=26, dia=48, width=3, thick=2, spoke_depth=4.5, spoke_width=9, key_depth=3, key_length=4, tolerance = 0.2, indicator=false, clicker=false, $fn=60) {
difference() { // halfing difference() { // halfing
union() { union() {
@ -23,7 +23,7 @@ module ring(alphabet_length=26, dia=48, width=3, thick=2, spoke_depth=4.5, spoke
} }
} }
} }
cylinder(d=dia-2*spoke_depth+2*tolerance, h=width+1, center=true); cylinder(d=dia-2*spoke_depth+tolerance, h=width+1, center=true);
} }
// keys // keys
for (i = [0:2]) { for (i = [0:2]) {
@ -35,10 +35,11 @@ module ring(alphabet_length=26, dia=48, width=3, thick=2, spoke_depth=4.5, spoke
} }
// indicator // indicator
translate([-dia/2,0,0]) { translate([-dia/2,0,0]) {
cube([1.5, width, width-4*tolerance], center=true); cube([2, width, width-4*tolerance], center=true);
} }
// clicker // clicker
if (clicker) { if (clicker) {
echo(floor(alphabet_length/3)*360/alphabet_length-45);
rotate([0,0,floor(alphabet_length/3)*360/alphabet_length-45]) { rotate([0,0,floor(alphabet_length/3)*360/alphabet_length-45]) {
translate([-dia/2+3,0,0]) { translate([-dia/2+3,0,0]) {
cube([3, 4, width-4*tolerance], center=true); cube([3, 4, width-4*tolerance], center=true);
@ -54,14 +55,11 @@ module ring(alphabet_length=26, dia=48, width=3, thick=2, spoke_depth=4.5, spoke
} }
} }
// Ring cut // Ring cut
translate([-dia/2+thick-0.5, -0.25, -width/2]) { translate([-dia/2-0.2, -0.25, -width/2]) {
cube([spoke_depth+key_depth,0.5, width]); cube([spoke_depth+key_depth+thick,0.25, width]);
} }
translate([-dia/2, width/2, -width/2]) { translate([-dia/2-0.2, 0, -width/2]) {
cube([thick,0.5, width]); #cube([0.25, width/2, width]);
}
translate([-dia/2+thick-0.5, 0, -width/2]) {
cube([0.5, width/2, width]);
} }
} }
} }