summaryrefslogtreecommitdiff
path: root/Treppe.scad
blob: 6278b9265be46612c713e11b8fd051d7694ce01b (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
Innenradius = 5;
Radius = 70;
Wanddicke = 5;
Hoehe = 230;
Stufenanzahl = 14;
Stufendicke = 5;
Startwinkel = 15;
Gesamtwinkel = 325;
Stufenwinkel = Gesamtwinkel / Stufenanzahl;
Untertritt = 5;

linear_extrude(height = Hoehe){
polygon(
  points = [
    [-Radius, -Radius],
    [-Radius, Radius],
    [Radius * sin(22.5), Radius],
    [Radius, Radius * sin(22.5)],
    [Radius, -Radius],
    [Radius + Wanddicke, -Radius],
    [Radius + Wanddicke, (Radius + Wanddicke) * sin(22.5)],
    [(Radius + Wanddicke) * sin(22.5), Radius + Wanddicke],
    [-Radius - Wanddicke, Radius + Wanddicke],
    [-Radius - Wanddicke, -Radius]
  ]
);
}
cylinder(h = Hoehe, r = Innenradius);

for(Stufennummer = [1:Stufenanzahl])
    translate([0,0,Stufennummer*Hoehe/Stufenanzahl - Stufendicke])
    linear_extrude(height = Stufendicke){
      difference(){
        intersection(){
          rotate([0, 0, Stufennummer*Gesamtwinkel/Stufenanzahl + Startwinkel])
            polygon(points = [
              [0,0],
              [2*Radius, -2*Radius * tan(Stufenwinkel)],
              [2*Radius, Untertritt],
              [0,Untertritt]
            ]);
          polygon(points = [
            [-Radius, -Radius],
            [-Radius, Radius],
            [Radius * sin(22.5), Radius],
            [Radius, Radius * sin(22.5)],
            [Radius, -Radius]
          ]);
        };
        circle(r=Innenradius);
      }
    }