test

C code posted
created at 22 Aug 07:09

Edit | Back
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
/*
  Test Cube Script for CloudSCAD

  Tony Buser <tbuser@gmail.com>
*/

// Size of cube on X axis
width = 10;

// Size of cube on Y axis
length = 10;

// How tall the cube is on Z axis
height = 10;

// Diameter of the hole in the center
hole_diameter = 4; // 3, 4, 8

// Which way should the hole go?
hole_orientation = "vertical"; // vertical, horizontal

module test_cube() {

  // test
  foo = "bar";

  difference() {
    cube([width, length, height], center = true);

    if (hole_orientation == "horizontal") {
      rotate([0,90,0]) {
        cylinder(width+2, hole_diameter/2, hole_diameter/2, center = true);
      }
    } else {
      cylinder(height+2, hole_diameter/2, hole_diameter/2, center = true);
    }
  }
}

translate([0, 0, height/2]) {
  test_cube();
}
787 Bytes in 2 ms with coderay