schaltauge.scad 5.55 KB
include <libs/polyround.scad>
include <libs/uploads_6f_12_f1_10_d2_ISOThread.scad>

TOLLERANCE = 0.15;
T = TOLLERANCE;
THREAD_TOLLERANCE = 0.3 ;
TT = THREAD_TOLLERANCE;
fn=20;

// FRAME PARAMETERS
FRAME_INNER_RADIUS_NEAR_HUB = 10;
FRAME_OUTER_RADIUS_NEAR_HANGER = 10;

// PLATE PARAMETERS
FIX_PLATE_SPAN_X = 56.7;
FIX_PLATE_SPAN_Y = 27;
FIX_PLATE_HEIGHT = 4.8;
FIX_PLATE_EDGE = 1.5;

// HUB GROOVE
HUB_DIAMETER = 8.5;
HUB_OFFSET_X = 14.5 + HUB_DIAMETER / 2;
HUB_OFFSET_Y = 9.3 + HUB_DIAMETER / 2;
HUB_DIAMETER_SPACER = 16;
HUB_DIAMETER_SPACER_HEIGHT = 3;
HUB_DIAMETER_FRAME_SPACER = 20;
HUB_DIAMETER_FRAME_SPACER_HEIGHT = 1.8;

// HANGER PARAMETERS
HANGER_HEIGHT = 8; 
HANGER_THREAD_OFFSET = 14.5;
HANGER_THREAD_DIAMETER = 10; // todo
HANGER_SAFETY_WIDTH = 6; // it looks so flimsy 
HANGER_WIDTH = HUB_OFFSET_X - HUB_DIAMETER / 2; 
HANGER_SPAN = HANGER_THREAD_OFFSET + HANGER_WIDTH / 2; 

// FIXING PIN HOLE
FIX_PIN_DIAMETER = 10.3;
FIX_PIN_HEAD_DIAMETER = 12.5;
FIX_PIN_HEAD_RECESS_HEIGHT = 1.5; // HEIGHT OF THE RECESS THAT GRABS THE PIN !!, PINHEAD DISTANCE TO FRAME !! 

// semi computed
// SET OFFSET OR BORDER
// OFFSET
/* FIX_OFFSET = 8; // center of fixation pin */

// BORDER
FIX_BORDER = 2.5; // border of plate to fixation pin distance 
FIX_OFFSET = FIX_PIN_DIAMETER / 2 + FIX_BORDER; // computed center of fixation pin 

// output
difference() {
  hanger_wedge_plate();
  fixing_pin();
  hub_grove();
  tensioner_thread();
}

// tensioner thread hole
module tensioner_thread() {
  difference() {
    translate([HANGER_WIDTH / 2, FIX_PLATE_SPAN_Y + HANGER_THREAD_OFFSET ,-1]){
      cylinder(h = 20, d = HANGER_THREAD_DIAMETER + TT, center = false, $fn = fn);

    }
    translate([HANGER_WIDTH / 2, FIX_PLATE_SPAN_Y + HANGER_THREAD_OFFSET ,-1])
      thread_in_pitch(HANGER_THREAD_DIAMETER + TT,HANGER_HEIGHT+3, 1);
  }
}

// fixing pin hole
module fixing_pin() {
  ankathete = FIX_OFFSET / tan(22.5);
  translate([FIX_PLATE_SPAN_X,0,0]){
    translate([ -ankathete, FIX_OFFSET, -1 ]){
      cylinder(h = 20, d = FIX_PIN_DIAMETER + TT, center = false, $fn = fn);
      cylinder(h = FIX_PLATE_HEIGHT - FIX_PIN_HEAD_RECESS_HEIGHT + 1, d = FIX_PIN_HEAD_DIAMETER + TT, center = false, $fn = fn);

    }
  }
}

// hub groove
module hub_grove() {
  union() {
    hull() {
      translate([ HUB_OFFSET_X, HUB_OFFSET_Y, 0 ]){
        cylinder(h = 20, d = HUB_DIAMETER + T, center = true, $fn = fn);
      }
      translate([ HUB_OFFSET_X, FIX_PLATE_SPAN_Y + T, 0 ]){
        cylinder(h = 20, d = HUB_DIAMETER + T, center = true, $fn = fn);
      }
    }
    translate([ HUB_OFFSET_X, HUB_OFFSET_Y, FIX_PLATE_HEIGHT - HUB_DIAMETER_FRAME_SPACER_HEIGHT]){
      cylinder(h = HUB_DIAMETER_FRAME_SPACER_HEIGHT + 1, d = HUB_DIAMETER_FRAME_SPACER + TT, center = false, $fn = fn);
    }
    translate([ HUB_OFFSET_X, HUB_OFFSET_Y, -1]){
      cylinder(h = 10, d = HUB_DIAMETER_SPACER + TT, center = false, $fn = fn);
    }
    translate([ HUB_OFFSET_X, HUB_OFFSET_Y, FIX_PLATE_HEIGHT - ( HUB_DIAMETER_FRAME_SPACER_HEIGHT + HUB_DIAMETER_SPACER_HEIGHT + 10) ]){
      cylinder(h = 10, d = 20 + TT, center = false, $fn = fn);
    }
  }
}

// hanger wedge plate
module hanger_wedge_plate() {

  union() { // combine fixation plate with hangerblock
    // fix plate

    fix_plate_shape = [ [FIX_PLATE_EDGE + T,FIX_PLATE_EDGE + T,FRAME_INNER_RADIUS_NEAR_HUB]
                      , [FIX_PLATE_SPAN_X - ( FIX_PLATE_EDGE / tan(22.5) + T / tan(22.5) ),FIX_PLATE_EDGE + T,FIX_OFFSET-FIX_PLATE_EDGE]
                      , [FIX_PLATE_EDGE + T,FIX_PLATE_SPAN_X - ( FIX_PLATE_EDGE / tan(22.5) + T / tan(22.5) ),0]
      ];

    difference() { // cut shape where the bike frame ends
      minkowski() {// combine fixation plate with edged corner
        linear_extrude( height = FIX_PLATE_HEIGHT - FIX_PLATE_EDGE)
          polygon(
            polyRound(
              fix_plate_shape, fn
              ));

        linear_extrude(height = FIX_PLATE_EDGE, scale=0)
          circle(r = FIX_PLATE_EDGE);
      }
      translate([ 0
                  , FIX_PLATE_SPAN_Y + T
                  , -1
                  ])cube(50,50,100);
    }
    /* FRAME_OUTER_CURVE_NEAR_HANGER  */
    // hangerblock

    hanger_shape = [ [ T, FIX_PLATE_SPAN_Y - FRAME_OUTER_RADIUS_NEAR_HANGER + T, 0]
                     , [ FRAME_OUTER_RADIUS_NEAR_HANGER - cos(45) * FRAME_OUTER_RADIUS_NEAR_HANGER + T
                       , FIX_PLATE_SPAN_Y - FRAME_OUTER_RADIUS_NEAR_HANGER + sin(45)*FRAME_OUTER_RADIUS_NEAR_HANGER + T
                       , 0
                       ]
                     , [FRAME_OUTER_RADIUS_NEAR_HANGER + T,FIX_PLATE_SPAN_Y + T,0]
                     , [HANGER_WIDTH - T ,FIX_PLATE_SPAN_Y + T,0]
                     , [HANGER_WIDTH - T,FIX_PLATE_SPAN_Y + HANGER_SPAN - T, HANGER_WIDTH/2 - T]
                     , [T,FIX_PLATE_SPAN_Y + HANGER_SPAN - T, HANGER_WIDTH / 2 - T]
      ];
      difference() {
        // hanger
        linear_extrude( height = HANGER_HEIGHT)
          polygon(
            polyRound(
              hanger_shape, fn
              ));
        // cut out dropout frame corner
        translate([FRAME_OUTER_RADIUS_NEAR_HANGER - T * 3 /*better safe than sorry*/ , FIX_PLATE_SPAN_Y - FRAME_OUTER_RADIUS_NEAR_HANGER,0])
        cylinder(h = HANGER_HEIGHT + 1, d = HANGER_THREAD_DIAMETER*2 +T, center = false, $fn = fn*2);
      }
      // safety diameter probabaly unnecessary
      if (HANGER_THREAD_DIAMETER + HANGER_SAFETY_WIDTH > HANGER_WIDTH) {
        translate([HANGER_WIDTH / 2, FIX_PLATE_SPAN_Y + HANGER_THREAD_OFFSET , 0])
          cylinder(h = HANGER_HEIGHT, d = HANGER_THREAD_DIAMETER + HANGER_SAFETY_WIDTH, center = false, $fn = fn);
      }
  }
}