-
Notifications
You must be signed in to change notification settings - Fork 0
/
fillet.scad
52 lines (47 loc) · 954 Bytes
/
fillet.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
// Fillet function
// https://github.com/clothbot/ClothBotCreations/tree/master/utilities
module fillet(r=1.0,steps=3,include=true, skip=false) {
if (skip) children();
else {
if(include) for (k=[0:$children-1]) {
children(k);
}
for (i=[0:$children-2] ) {
for(j=[i+1:$children-1] ) {
fillet_two(r=r,steps=steps) {
children(i);
children(j);
intersection() {
children(i);
children(j);
}
}
}
}
}
}
module fillet_two(r=1.0,steps=3) {
for(step=[1:steps]) {
hull() {
render() intersection() {
children(0);
offset_3d(r=r*step/steps) children(2);
}
render() intersection() {
children(1);
offset_3d(r=r*(steps-step+1)/steps) children(2);
}
}
}
}
module offset_3d(r=1.0) {
for(k=[0:$children-1]) minkowski() {
children(k);
sphere(r=r,$fn=8);
}
}
fillet(r=2,steps=5) {
cylinder(r=5,h=10);
cube([10,10,2]);
rotate([30,30,30]) cylinder(r=1.0,h=50,center=true);
}