summaryrefslogtreecommitdiff
path: root/v1.0/mendel.inc
blob: bd5324eb11baf716a799a0b3151e21be7ea8c436 (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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*
 *  Miscellaneous standard objects used in Mendel 
 *  by Vik Olliver 29-03-2010. Uses components of the
 *  OpenSCAD Shapes Library (www.openscad.at)
 *  Copyright (C) 2009  Catarina Mota <clifford@clifford.at>
 *
 * 5-Apr-2010 vik@diamondage.co.nz
 * Different clearances are being implemented for vertical and
 * horizontal holes, as rudimentary extruders cannot relaibly
 * control extrusions around corners.
 *
 * 5-Apr-2010 vik@diamondage.co.nz
 * Added vertex separation and adapted for Y motor bracket.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
*/



module box(w,h,d) {
	scale ([w,h,d]) cube(1, true);
}

module hexagon(height, depth) {
	boxWidth=height/1.75;
		union(){
			box(boxWidth, height, depth);
			rotate([0,0,60]) box(boxWidth, height, depth);
			rotate([0,0,-60]) box(boxWidth, height, depth);
		}
}

module teardrop(radius,height,truncated)
{
	truncateMM = 1;
	union()
	{
		if(truncated == true)
		{
		intersection()
		{
		translate([0,0,height/2]) scale([1,1,height]) rotate([0,0,180]) cube([radius*2.5,radius*2,1],center=true);
		scale([1,1,height]) rotate([0,0,3*45]) cube([radius,radius,1]);
		}
		}
		if(truncated == false)
		{
		scale([1,1,height]) rotate([0,0,3*45]) cube([radius,radius,1]);
		}
		#cylinder(r=radius, h = height);
	}
}

module hole_horiz(rad,l) {
	cylinder(l,rad,rad,center=true);
	translate ([rad*0.67,0,0]) rotate ([0,0,45])
		cube([rad,rad,l],center=true);
}

module m8_hole_horiz(l) {
	cylinder(l,m8_clearance_rad,m8_clearance_rad,center=true);
	translate ([m8_clearance_rad*0.67,0,0]) rotate ([0,0,45])
		cube([m8_clearance_rad,m8_clearance_rad,l],center=true);
}

module m8_hole_vert(l) {
	cylinder(l,m8_clearance_rad,m8_clearance_rad,center=true);
}

// For nut cavities, "height" is the max distance between two points on the hex.
module m4_nut_cavity(l) {
	hexagon(height=7.5,depth=l);
}

module m8_nut_cavity(l) {
	hexagon(height=14,depth=l);
}

module m3_slot(l) {
	cube([7.149,l,3.4],center=true);
}

module m4_hole_horiz(l) {
	cylinder(l,m4_clearance_rad_h,m4_clearance_rad_h,center=true);
	translate ([m4_clearance_rad_h*0.6,0,0]) rotate ([0,0,45])
		cube([m4_clearance_rad_h,m4_clearance_rad_h,l],center=true);
}

module m4_hole_vert(l) {
	cylinder(l,m4_clearance_rad_v,m4_clearance_rad_v,center=true);
}

module m4_hole_vert_with_hex(l) {
	union () {
		m4_hole_vert(l);
		translate ([0,0,-l/4]) rotate ([0,0,30]) scale ([1.1,1.1,1]) m4_nut_cavity(l/2);
	}
}

module m4_hole_horiz_with_hex(l) {
	union () {
		m4_hole_horiz(l);
		translate ([0,0,-l/4]) rotate ([0,0,0]) m4_nut_cavity(l/2);
	}
}

module m8_hole_vert_with_hex(l) {
	union () {
		m8_hole_vert(l);
		translate ([0,0,-l/4]) rotate ([0,0,30]) m8_nut_cavity(l/2);
	}
}


// Hole for a NEMA17 with one sloped side so that the wires can dangle
// out of it...
module nema_17() {
	union () {
		translate ([0,0,nema17_side/2]) box(nema17_side,nema17_side,nema17_side);
		cylinder (h=nema17_side*1.5,r=24/2,center=true);
		// Flip-out bit needed when building with X vertical
		translate ([nema17_side/2,0,0])  rotate ([0,-45,0]) translate ([nema17_side/2,0,nema17_side/2]) 
			box(nema17_side,nema17_side,nema17_side);
		// 8mm * M3 clearance slots, 4 of.
		rotate ([0,0,45]) translate([20,0,0]) box(8,m3_clearance_rad*2, 60);
		rotate ([0,0,-45]) translate([20,0,0]) box(8,m3_clearance_rad*2, 60);
		rotate ([0,0,135]) translate([20,0,0]) box(8,m3_clearance_rad*2, 60);
		rotate ([0,0,-135]) translate([20,0,0]) box(8,m3_clearance_rad*2, 60);
	}
}

// Set of 3 holes at each end of an X carriage by which the two halves are joined and balanced.
module x_carriage_common_holes() {
	union() {
		translate ([(x_car_length-x_car_top_knob_width)/2,0,0]) m4_hole_vert(60);
		translate ([(x_car_length-x_car_top_knob_width)/2,16.5,0]) m4_hole_vert(60);
		translate ([(x_car_length-x_car_top_knob_width)/2,-15,0])  m4_hole_vert(60);
		translate ([(x_car_length-x_car_top_knob_width)/-2,0,0]) m4_hole_vert(60);
		translate ([(x_car_length-x_car_top_knob_width)/-2,16.5,0]) m4_hole_vert(60);
		translate ([(x_car_length-x_car_top_knob_width)/-2,-15,0])  m4_hole_vert(60);
	}
}

// No .4 3/4 inch countersunk woodscrew (includes a lot of headspace)
// Countersunk by default
// If head=1 use pan-head screws (head has a flat bottom)
screw_max_rad=2;
module small_woodscrew(head) {
	rotate ([0,0,30]) {
		if (head == 1) {
			translate([0,0,6]) cylinder(h=8, r1=3.0, r2=3.0);
		}
		else {
			translate([0,0,6]) cylinder(h=8, r1=screw_max_rad, r2=4.0);
		}
		translate ([0,0,-7.5]) cylinder(h=3,r1=0.2,r2=screw_max_rad-0.2,center=true);
		cylinder(h=12,r1=screw_max_rad-0.2,r2=screw_max_rad,center=true);
	}
}