-
Notifications
You must be signed in to change notification settings - Fork 1
/
sudilib.scad
58 lines (47 loc) · 1.38 KB
/
sudilib.scad
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
// sudilib.scad
// routines shared between scripts that generate 3D models and 2D DXF
/////////////////////////////////////////////
// generate a circular hole pattern
module holepattern (circle_dia, hole_dia, count, depth){
eps = 0.5; // amount hole protrudes outside surface
eps2 = 2 * eps;
for(hp=[0:360/count:360]){
translate([0,-eps,0])
rotate([90,hp,0])
translate([circle_dia/2,0,0])
cylinder(h = depth+eps2, r = hole_dia/2, center = true);
}
}
///////////////////////////////////////////
// rotate something about the origin
// then translate it to a point
module about (rot, pnt) {
translate(pnt)
rotate(rot)
children();
}
///////////////////////////////////////////////
// make a box rotated at a point
module sheet (dim, rot, cent) {
about(rot, cent)
cube(size = dim, center = true);
}
////////////////////////////////////////////////
// make a disk/cylinder rotated at a point
module disk (height, radius, rot, cnt) {
about(rot, cnt)
rotate([90,0,0])
cylinder(h = height, r = radius, center = true);
}
////////////////////////////////////////////////
// make a disk with a hole rotated at a point
module washer(height,outside,inside, rot, cnt) {
about(rot, cnt)
rotate([90,0,0])
//translate([0,height,0]) {
difference(){
cylinder(h = height, r = outside, center = true);
cylinder(h = height, r = inside, center = true);
}
//}
}