summaryrefslogtreecommitdiff
path: root/x-carriage.scad
blob: 3c2ee2f93a22371f4688cc05eb8d3a7553a74cd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
slide_tolerance = .3;
play_tolerance=.4;
fit_tolerance = .25;

bearings_l = 30;	// LM8UU: 25
bearings_d = 12;	// LM8UU: 15
bearings_m = 2.5;	// thickness of the bearing end holder
bearings_s = 2.5;	// the minimum shell between bearings and carriage front

rods_apart = 45;
rod_d = 8;

mounting_holes_from_top = [	// the offsets of mounting holes on the back
 [0, 20], [-4.5,10], [4.5,10]
];
mounting_holes_apart = mounting_holes_from_top[2][0]-mounting_holes_from_top[1][0];

belt_tooth=0.70;
belt_thickness=0.75;
belts_thickness = belt_thickness*2+belt_tooth+0.5;
belt_width = 6 + slide_tolerance;
belts_apart = 12;
belt_pitch = 2;
beltholder_chamfer = 1;

tiehole_id = bearings_d+3;
tiehole_od = bearings_d+10;
tiehole_w = 4;

screw_d = 3;
screwhead_d = 5.5;
screwhead_h = 3;

module belt(pitch=belt_pitch,width=belt_width,thickness=belt_thickness,tooth=belt_tooth,l=100,tolerance=0) {
 translate([-l/2,-width/2,-thickness])
 intersection() {
  union() {
   cube(size=[l,width,thickness+tolerance]);
   for(x=[0:pitch:l/2]) for(s=[-1,1])
    translate([l/2+s*x,0,thickness])
    rotate([-90,0,0])
    cylinder(r=tooth+tolerance,h=width,$fn=6);
  }
  translate([0,-1,0])
  cube(size=[l,width+2,thickness+tooth+1]);
 }
}

module xcarriage() {
 cw = bearings_l+2*bearings_m;	// carriage width
 % for(mz=[0,1]) mirror([0,0,mz]) translate([0,0,-belts_apart/2]) belt(l=cw+2);
 difference() {
  translate([-cw/2,-belt_width/2,-(rods_apart+bearings_d+bearings_m)/2])
  cube(size=[cw,bearings_d/2+bearings_s+belt_width/2,rods_apart+bearings_d+bearings_m]);

  for(sz=[-1,1]) translate([0,0,sz*rods_apart/2]) {
   rotate([0,90,0])
   cylinder(d=bearings_d,h=bearings_l,center=true,$fn=60);
   translate([0,-bearings_d/2,0])
   cube(size=[bearings_l,bearings_d,bearings_d],center=true);
   rotate([0,90,0]) cylinder(d=bearings_d-bearings_m,h=cw+2,center=true,$fn=60);
   translate([-cw/2-1,-belt_width,-(bearings_d-bearings_m)/2])
   cube(size=[cw+2,belt_width,bearings_d-bearings_m]);
   for(sx=[-1,1]) translate([sx*bearings_l/4,0,0]) {
    rotate([0,90,0]) difference() {
     cylinder(d=tiehole_od,h=tiehole_w,center=true,$fn=60);
     cylinder(d=tiehole_id,h=tiehole_w+2,center=true,$fn=60);
    }
    translate([0,-tiehole_od/2,0])
    cube(size=[tiehole_w,tiehole_od,tiehole_od],center=true);
   } // translate for(sx)
  } // for(sz)

  difference() {
   gap=belts_apart/6;
   translate([0,-.5,-gap/2])
   cube(size=[cw+2,belt_width+2,belts_apart+2*belt_thickness+gap],center=true);
   for(mx=[0,1]) mirror([mx,0,0]) {
    ofc = mounting_holes_apart/2+screwhead_d/2+belt_thickness+belt_tooth+play_tolerance; // offset from center
    r=1;
    x0 = ofc+r; x1=cw/2-r;
    z0 = r; z1 = belts_apart/2-belt_thickness;
    difference() {
     hull() for(x=[x0,x1]) for(z=[z0,z1])
      translate([x,0,z])
      rotate([90,0,0]) cylinder(r=r,h=belt_width+2,center=true,$fn=30);
     translate([cw/2,0,belts_apart/2]) mirror([0,0,1]) belt(width=belt_width+2,l=cw/2+2,tolerance=fit_tolerance);
    }
    bgap = belt_thickness+belt_tooth+fit_tolerance;
    r1 = (belts_apart/3-bgap)/2;
    hull() for(x=[mounting_holes_apart/2,x1])
     translate([x,0,-r1-bgap])
     rotate([90,0,0]) cylinder(r=r1,h=belt_width+2,center=true,$fn=30);
   }
  } // difference

  translate([0,0,30/*heatsink height*//2])
  for(mhft = mounting_holes_from_top) translate([mhft[0],0,-mhft[1]]) {
   rotate([90,0,0]) cylinder(d=screw_d+2*play_tolerance,h=bearings_d+2*bearings_s+2,center=true,$fn=30);
   translate([0,belt_width/2+screwhead_h+play_tolerance,0])
   rotate([90,0,0]) cylinder(d=screwhead_d+2*play_tolerance,h=screwhead_h+play_tolerance+1,$fn=30);
  }
  ccs = (belt_thickness+2*beltholder_chamfer)/sqrt(2);
  translate([0,-belt_width/2,belts_apart/2+belt_thickness/2-fit_tolerance/2])
  rotate([45,0,0]) cube(size=[cw+2,ccs,ccs],center=true);

 } // difference
}

print=false;
if(print) rotate([-90,0,0]) xcarriage();
else xcarriage();