File: example006.scad

package info (click to toggle)
openscad 2015.03-2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 30,804 kB
  • ctags: 5,692
  • sloc: cpp: 39,386; sh: 3,856; ansic: 3,674; python: 1,393; yacc: 496; lex: 272; lisp: 159; makefile: 67; xml: 60
file content (59 lines) | stat: -rw-r--r-- 1,775 bytes parent folder | download | duplicates (2)
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

module example006()
{
  module edgeprofile()
  {
    render(convexity = 2) difference() {
      cube([20, 20, 150], center = true);
      translate([-10, -10, 0])
        cylinder(h = 80, r = 10, center = true);
      translate([-10, -10, +40])
        sphere(r = 10);
      translate([-10, -10, -40])
        sphere(r = 10);
    }
  }

  difference() {
    cube(100, center = true);
    for (rot = [ [0, 0, 0], [1, 0, 0], [0, 1, 0] ]) {
      rotate(90, rot)
        for (p = [[+1, +1, 0], [-1, +1, 90], [-1, -1, 180], [+1, -1, 270]]) {
          translate([ p[0]*50, p[1]*50, 0 ])
            rotate(p[2], [0, 0, 1])
              edgeprofile();
        }
    }
    for (i = [
      [ 0, 0, [ [0, 0] ] ],
      [ 90, 0, [ [-20, -20], [+20, +20] ] ],
      [ 180, 0, [ [-20, -25], [-20, 0], [-20, +25], [+20, -25], [+20, 0], [+20, +25] ] ],
      [ 270, 0, [ [0, 0], [-25, -25], [+25, -25], [-25, +25], [+25, +25] ] ],
      [ 0, 90, [ [-25, -25], [0, 0], [+25, +25] ] ],
      [ 0, -90, [ [-25, -25], [+25, -25], [-25, +25], [+25, +25] ] ]
    ]) {
    rotate(i[0], [0, 0, 1])
      rotate(i[1], [1, 0, 0])
        translate([0, -50, 0])
          for (j = i[2]) {
            translate([j[0], 0, j[1]]) sphere(10);
          }
    }
  }
}

echo(version=version());

example006();

// Written by Clifford Wolf <clifford@clifford.at> and Marius
// Kintel <marius@kintel.net>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to the
// public domain worldwide. This software is distributed without any
// warranty.
//
// You should have received a copy of the CC0 Public Domain
// Dedication along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.