-
Notifications
You must be signed in to change notification settings - Fork 2
/
arc.scad
65 lines (57 loc) · 1.96 KB
/
arc.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
58
59
60
61
62
63
64
65
/*
* Excerpt from...
*
* Parametric Encoder Wheel
*
* by Alex Franke (codecreations), March 2012
* http://www.theFrankes.com
*
* Licenced under Creative Commons Attribution - Non-Commercial - Share Alike 3.0
*/
// rclott 2015-01:
// modified to extrude square or circular cross sections
module arc_circular( cross, radius, degrees ) {
// This dies a horible death if it's not rendered here
// -- sucks up all memory and spins out of control
render()
difference() {
// Outer ring
rotate_extrude($fn = 50)
translate([radius, 0.5*cross, 0])
circle(d=cross);
// Cut half off
translate([0,-(radius+1),-.5])
cube ([radius+1,(radius+1)*2,cross+1]);
// Cover the other half as necessary
rotate([0,0,180-degrees])
translate([0,-(radius+1),-.5])
cube ([radius+1,(radius+1)*2,cross+1]);
}
}
module arc_square( cross, radius, degrees ) {
// This dies a horible death if it's not rendered here
// -- sucks up all memory and spins out of control
render()
difference() {
// Outer ring
rotate_extrude($fn = 100)
translate([radius - 0.5*cross, 0, 0])
square([cross,cross]);
// Cut half off
translate([0,-(radius+1),-.5])
cube ([radius+1,(radius+1)*2,cross+1]);
// Cover the other half as necessary
rotate([0,0,180-degrees])
translate([0,-(radius+1),-.5])
cube ([radius+1,(radius+1)*2,cross+1]);
}
}
// TODO
// here's another way to make a square cross section circle,
// the advantage is it can make an ellipse as well as circles
module arc_square2() {
difference() {
scale([1,0.5,1]) linear_extrude( height=dia ) circle(d=6,$fn=50);
scale([1,0.5,1]) translate([0,0,-0.5*dia]) linear_extrude( height=2*dia ) circle(d=6-dia,$fn=50);
}
}