rubyscad 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -21
  3. data/Gemfile +4 -4
  4. data/LICENSE.txt +21 -21
  5. data/README.md +322 -322
  6. data/Rakefile +1 -1
  7. data/examples/BasicCube.rb +50 -50
  8. data/examples/ChamferCube.rb +96 -96
  9. data/examples/FilletCube.rb +317 -317
  10. data/examples/example001.rb +33 -33
  11. data/examples/example001.scad +11 -11
  12. data/examples/example002.rb +23 -23
  13. data/examples/example002.scad +18 -18
  14. data/examples/example003.rb +19 -19
  15. data/examples/example003.scad +15 -15
  16. data/examples/example004.rb +11 -11
  17. data/examples/example004.scad +6 -6
  18. data/examples/example005.rb +22 -22
  19. data/examples/example005.scad +31 -31
  20. data/examples/example006.rb +46 -46
  21. data/examples/example006.scad +221 -221
  22. data/examples/example007.dxf +2410 -2410
  23. data/examples/example007.rb +53 -53
  24. data/examples/example007.scad +30 -30
  25. data/examples/example008.dxf +3238 -3238
  26. data/examples/example008.rb +34 -34
  27. data/examples/example008.scad +26 -26
  28. data/examples/example009.dxf +3894 -3894
  29. data/examples/example009.rb +33 -33
  30. data/examples/example009.scad +15 -15
  31. data/examples/example010.dat +51 -51
  32. data/examples/example010.rb +12 -12
  33. data/examples/example010.scad +7 -7
  34. data/examples/example011.rb +22 -22
  35. data/examples/example011.scad +3 -3
  36. data/examples/example012.rb +16 -16
  37. data/examples/example012.scad +8 -8
  38. data/examples/example013.dxf +2276 -2276
  39. data/examples/example013.rb +16 -16
  40. data/examples/example013.scad +12 -12
  41. data/examples/example014.rb +14 -14
  42. data/examples/example014.scad +12 -12
  43. data/examples/example015.rb +33 -33
  44. data/examples/example015.scad +22 -22
  45. data/examples/example016.rb +43 -43
  46. data/examples/example016.scad +49 -49
  47. data/examples/example017.rb +170 -170
  48. data/examples/example017.scad +124 -124
  49. data/examples/example018.rb +29 -29
  50. data/examples/example018.scad +74 -74
  51. data/examples/example019.rb +22 -22
  52. data/examples/example019.scad +84 -84
  53. data/examples/example020.rb +92 -92
  54. data/examples/example020.scad +62 -62
  55. data/examples/example021.rb +42 -42
  56. data/examples/example021.scad +159 -159
  57. data/examples/example022.rb +44 -44
  58. data/examples/example022.scad +103 -103
  59. data/lib/rubyscad.rb +2 -2
  60. data/lib/rubyscad/RubyScad.rb +369 -361
  61. data/lib/rubyscad/version.rb +3 -3
  62. data/rubyscad.gemspec +20 -20
  63. metadata +7 -9
@@ -1,124 +1,124 @@
1
- //created with rubyscad 1.0
2
-
3
- translate(v = [0, 0, 92.000])
4
- linear_extrude(height = 6.000, convexity = 4)
5
- difference() {
6
- circle(r = 47.000);
7
- rotate(a = 0)
8
- translate(v = [0, 36.000])
9
- square(size = [6.000, 10.000], center = true);
10
- circle(r = 25.000);
11
- rotate(a = 120)
12
- translate(v = [0, 36.000])
13
- square(size = [6.000, 10.000], center = true);
14
- circle(r = 25.000);
15
- rotate(a = 240)
16
- translate(v = [0, 36.000])
17
- square(size = [6.000, 10.000], center = true);
18
- circle(r = 25.000);
19
- }
20
- linear_extrude(height = 6.000, convexity = 4)
21
- difference() {
22
- circle(r = 102.000);
23
- rotate(a = 0)
24
- translate(v = [0, 88.500])
25
- square(size = [6.000, 15.000], center = true);
26
- circle(r = 75.000);
27
- rotate(a = 120)
28
- translate(v = [0, 88.500])
29
- square(size = [6.000, 15.000], center = true);
30
- circle(r = 75.000);
31
- rotate(a = 240)
32
- translate(v = [0, 88.500])
33
- square(size = [6.000, 15.000], center = true);
34
- circle(r = 75.000);
35
- }
36
- color(c = [0.700, 0.700, 1], color = [0, 0, 0, 1]) {
37
- rotate(a = 0)
38
- translate(v = [0, 102.000, 9.000])
39
- rotate(a = [90, 0, -90])
40
- linear_extrude(height = 6.000, convexity = 10, center = true)
41
- union() {
42
- difference() {
43
- polygon(points = [[0, 6.000], [6.000, 6.000], [6.000, 0], [21.000, 0], [21.000, 6.000], [27.000, 6.000], [27.000, 0], [77.000, 0], [83.000, 12.000], [77.000, 18.000], [77.000, 74.000], [71.000, 74.000], [71.000, 80.000], [61.000, 80.000], [61.000, 74.000], [55.000, 74.000], [55.000, 80.000], [49.000, 74.000], [49.000, 18.000], [43.000, 12.000], [6.000, 12.000]]);
44
- translate(v = [43.000, 18.000])
45
- circle(r = 6.000);
46
- translate(v = [83.000, 18.000])
47
- circle(r = 6.000);
48
- }
49
- translate(v = [77.000, 0])
50
- square(size = [9.000, 12.000]);
51
- translate(v = [86.000, 6.000])
52
- circle(r = 6.000);
53
- translate(v = [6.000, 6.000])
54
- intersection() {
55
- circle(r = 6.000);
56
- translate(v = [-12.000, 0])
57
- square(size = 12.000);
58
- }
59
- translate(v = [55.000, 74.000])
60
- intersection() {
61
- circle(r = 6.000);
62
- translate(v = [-12.000, 0])
63
- square(size = 12.000);
64
- }
65
- }
66
- rotate(a = 120)
67
- translate(v = [0, 102.000, 9.000])
68
- rotate(a = [90, 0, -90])
69
- linear_extrude(height = 6.000, convexity = 10, center = true)
70
- union() {
71
- difference() {
72
- polygon(points = [[0, 6.000], [6.000, 6.000], [6.000, 0], [21.000, 0], [21.000, 6.000], [27.000, 6.000], [27.000, 0], [77.000, 0], [83.000, 12.000], [77.000, 18.000], [77.000, 74.000], [71.000, 74.000], [71.000, 80.000], [61.000, 80.000], [61.000, 74.000], [55.000, 74.000], [55.000, 80.000], [49.000, 74.000], [49.000, 18.000], [43.000, 12.000], [6.000, 12.000]]);
73
- translate(v = [43.000, 18.000])
74
- circle(r = 6.000);
75
- translate(v = [83.000, 18.000])
76
- circle(r = 6.000);
77
- }
78
- translate(v = [77.000, 0])
79
- square(size = [9.000, 12.000]);
80
- translate(v = [86.000, 6.000])
81
- circle(r = 6.000);
82
- translate(v = [6.000, 6.000])
83
- intersection() {
84
- circle(r = 6.000);
85
- translate(v = [-12.000, 0])
86
- square(size = 12.000);
87
- }
88
- translate(v = [55.000, 74.000])
89
- intersection() {
90
- circle(r = 6.000);
91
- translate(v = [-12.000, 0])
92
- square(size = 12.000);
93
- }
94
- }
95
- rotate(a = 240)
96
- translate(v = [0, 102.000, 9.000])
97
- rotate(a = [90, 0, -90])
98
- linear_extrude(height = 6.000, convexity = 10, center = true)
99
- union() {
100
- difference() {
101
- polygon(points = [[0, 6.000], [6.000, 6.000], [6.000, 0], [21.000, 0], [21.000, 6.000], [27.000, 6.000], [27.000, 0], [77.000, 0], [83.000, 12.000], [77.000, 18.000], [77.000, 74.000], [71.000, 74.000], [71.000, 80.000], [61.000, 80.000], [61.000, 74.000], [55.000, 74.000], [55.000, 80.000], [49.000, 74.000], [49.000, 18.000], [43.000, 12.000], [6.000, 12.000]]);
102
- translate(v = [43.000, 18.000])
103
- circle(r = 6.000);
104
- translate(v = [83.000, 18.000])
105
- circle(r = 6.000);
106
- }
107
- translate(v = [77.000, 0])
108
- square(size = [9.000, 12.000]);
109
- translate(v = [86.000, 6.000])
110
- circle(r = 6.000);
111
- translate(v = [6.000, 6.000])
112
- intersection() {
113
- circle(r = 6.000);
114
- translate(v = [-12.000, 0])
115
- square(size = 12.000);
116
- }
117
- translate(v = [55.000, 74.000])
118
- intersection() {
119
- circle(r = 6.000);
120
- translate(v = [-12.000, 0])
121
- square(size = 12.000);
122
- }
123
- }
124
- }
1
+ //created with rubyscad 1.0
2
+
3
+ translate(v = [0, 0, 92.000])
4
+ linear_extrude(height = 6.000, convexity = 4)
5
+ difference() {
6
+ circle(r = 47.000);
7
+ rotate(a = 0)
8
+ translate(v = [0, 36.000])
9
+ square(size = [6.000, 10.000], center = true);
10
+ circle(r = 25.000);
11
+ rotate(a = 120)
12
+ translate(v = [0, 36.000])
13
+ square(size = [6.000, 10.000], center = true);
14
+ circle(r = 25.000);
15
+ rotate(a = 240)
16
+ translate(v = [0, 36.000])
17
+ square(size = [6.000, 10.000], center = true);
18
+ circle(r = 25.000);
19
+ }
20
+ linear_extrude(height = 6.000, convexity = 4)
21
+ difference() {
22
+ circle(r = 102.000);
23
+ rotate(a = 0)
24
+ translate(v = [0, 88.500])
25
+ square(size = [6.000, 15.000], center = true);
26
+ circle(r = 75.000);
27
+ rotate(a = 120)
28
+ translate(v = [0, 88.500])
29
+ square(size = [6.000, 15.000], center = true);
30
+ circle(r = 75.000);
31
+ rotate(a = 240)
32
+ translate(v = [0, 88.500])
33
+ square(size = [6.000, 15.000], center = true);
34
+ circle(r = 75.000);
35
+ }
36
+ color(c = [0.700, 0.700, 1], color = [0, 0, 0, 1]) {
37
+ rotate(a = 0)
38
+ translate(v = [0, 102.000, 9.000])
39
+ rotate(a = [90, 0, -90])
40
+ linear_extrude(height = 6.000, convexity = 10, center = true)
41
+ union() {
42
+ difference() {
43
+ polygon(points = [[0, 6.000], [6.000, 6.000], [6.000, 0], [21.000, 0], [21.000, 6.000], [27.000, 6.000], [27.000, 0], [77.000, 0], [83.000, 12.000], [77.000, 18.000], [77.000, 74.000], [71.000, 74.000], [71.000, 80.000], [61.000, 80.000], [61.000, 74.000], [55.000, 74.000], [55.000, 80.000], [49.000, 74.000], [49.000, 18.000], [43.000, 12.000], [6.000, 12.000]]);
44
+ translate(v = [43.000, 18.000])
45
+ circle(r = 6.000);
46
+ translate(v = [83.000, 18.000])
47
+ circle(r = 6.000);
48
+ }
49
+ translate(v = [77.000, 0])
50
+ square(size = [9.000, 12.000]);
51
+ translate(v = [86.000, 6.000])
52
+ circle(r = 6.000);
53
+ translate(v = [6.000, 6.000])
54
+ intersection() {
55
+ circle(r = 6.000);
56
+ translate(v = [-12.000, 0])
57
+ square(size = 12.000);
58
+ }
59
+ translate(v = [55.000, 74.000])
60
+ intersection() {
61
+ circle(r = 6.000);
62
+ translate(v = [-12.000, 0])
63
+ square(size = 12.000);
64
+ }
65
+ }
66
+ rotate(a = 120)
67
+ translate(v = [0, 102.000, 9.000])
68
+ rotate(a = [90, 0, -90])
69
+ linear_extrude(height = 6.000, convexity = 10, center = true)
70
+ union() {
71
+ difference() {
72
+ polygon(points = [[0, 6.000], [6.000, 6.000], [6.000, 0], [21.000, 0], [21.000, 6.000], [27.000, 6.000], [27.000, 0], [77.000, 0], [83.000, 12.000], [77.000, 18.000], [77.000, 74.000], [71.000, 74.000], [71.000, 80.000], [61.000, 80.000], [61.000, 74.000], [55.000, 74.000], [55.000, 80.000], [49.000, 74.000], [49.000, 18.000], [43.000, 12.000], [6.000, 12.000]]);
73
+ translate(v = [43.000, 18.000])
74
+ circle(r = 6.000);
75
+ translate(v = [83.000, 18.000])
76
+ circle(r = 6.000);
77
+ }
78
+ translate(v = [77.000, 0])
79
+ square(size = [9.000, 12.000]);
80
+ translate(v = [86.000, 6.000])
81
+ circle(r = 6.000);
82
+ translate(v = [6.000, 6.000])
83
+ intersection() {
84
+ circle(r = 6.000);
85
+ translate(v = [-12.000, 0])
86
+ square(size = 12.000);
87
+ }
88
+ translate(v = [55.000, 74.000])
89
+ intersection() {
90
+ circle(r = 6.000);
91
+ translate(v = [-12.000, 0])
92
+ square(size = 12.000);
93
+ }
94
+ }
95
+ rotate(a = 240)
96
+ translate(v = [0, 102.000, 9.000])
97
+ rotate(a = [90, 0, -90])
98
+ linear_extrude(height = 6.000, convexity = 10, center = true)
99
+ union() {
100
+ difference() {
101
+ polygon(points = [[0, 6.000], [6.000, 6.000], [6.000, 0], [21.000, 0], [21.000, 6.000], [27.000, 6.000], [27.000, 0], [77.000, 0], [83.000, 12.000], [77.000, 18.000], [77.000, 74.000], [71.000, 74.000], [71.000, 80.000], [61.000, 80.000], [61.000, 74.000], [55.000, 74.000], [55.000, 80.000], [49.000, 74.000], [49.000, 18.000], [43.000, 12.000], [6.000, 12.000]]);
102
+ translate(v = [43.000, 18.000])
103
+ circle(r = 6.000);
104
+ translate(v = [83.000, 18.000])
105
+ circle(r = 6.000);
106
+ }
107
+ translate(v = [77.000, 0])
108
+ square(size = [9.000, 12.000]);
109
+ translate(v = [86.000, 6.000])
110
+ circle(r = 6.000);
111
+ translate(v = [6.000, 6.000])
112
+ intersection() {
113
+ circle(r = 6.000);
114
+ translate(v = [-12.000, 0])
115
+ square(size = 12.000);
116
+ }
117
+ translate(v = [55.000, 74.000])
118
+ intersection() {
119
+ circle(r = 6.000);
120
+ translate(v = [-12.000, 0])
121
+ square(size = 12.000);
122
+ }
123
+ }
124
+ }
@@ -1,29 +1,29 @@
1
- require "rubyscad"
2
-
3
- module Example018
4
- extend RubyScad
5
-
6
- def self.step(len, mod, *objects)
7
- (0..objects.length-1).each do |i|
8
- translate(x: len*(i - (objects.length-1)/2))
9
- objects[(i+mod) % objects.length].call
10
- end
11
- end
12
-
13
- (1..4).each do |i|
14
- translate(y: -250+i*100) {
15
- step(100, i,
16
- proc {sphere(r: 30)},
17
- proc {cube(size: 60, center: true)},
18
- proc { cylinder(r: 30, h: 50, center: true)},
19
- proc {
20
- union() {
21
- cube(size: 45, center: true);
22
- rotate(a: [45, 0, 0]); cube(size: 50, center: true);
23
- rotate(a: [0, 45, 0]); cube(size: 50, center: true);
24
- rotate(a: [0, 0, 45]); cube(size: 50, center: true);
25
- }
26
- })
27
- }
28
- end
29
- end
1
+ require "rubyscad"
2
+
3
+ module Example018
4
+ extend RubyScad
5
+
6
+ def self.step(len, mod, *objects)
7
+ (0..objects.length-1).each do |i|
8
+ translate(x: len*(i - (objects.length-1)/2))
9
+ objects[(i+mod) % objects.length].call
10
+ end
11
+ end
12
+
13
+ (1..4).each do |i|
14
+ translate(y: -250+i*100) {
15
+ step(100, i,
16
+ proc {sphere(r: 30)},
17
+ proc {cube(size: 60, center: true)},
18
+ proc { cylinder(r: 30, h: 50, center: true)},
19
+ proc {
20
+ union() {
21
+ cube(size: 45, center: true);
22
+ rotate(a: [45, 0, 0]); cube(size: 50, center: true);
23
+ rotate(a: [0, 45, 0]); cube(size: 50, center: true);
24
+ rotate(a: [0, 0, 45]); cube(size: 50, center: true);
25
+ }
26
+ })
27
+ }
28
+ end
29
+ end
@@ -1,74 +1,74 @@
1
- //created with rubyscad 1.0
2
-
3
- translate(v = [0, -150]) {
4
- translate(v = [-100, 0])
5
- cube(size = 60, center = true);
6
- translate(v = [0, 0])
7
- cylinder(r = 30, h = 50, center = true);
8
- translate(v = [100, 0])
9
- union() {
10
- cube(size = 45, center = true);
11
- rotate(a = [45, 0, 0])
12
- cube(size = 50, center = true);
13
- rotate(a = [0, 45, 0])
14
- cube(size = 50, center = true);
15
- rotate(a = [0, 0, 45])
16
- cube(size = 50, center = true);
17
- }
18
- translate(v = [200, 0])
19
- sphere(r = 30);
20
- }
21
- translate(v = [0, -50]) {
22
- translate(v = [-100, 0])
23
- cylinder(r = 30, h = 50, center = true);
24
- translate(v = [0, 0])
25
- union() {
26
- cube(size = 45, center = true);
27
- rotate(a = [45, 0, 0])
28
- cube(size = 50, center = true);
29
- rotate(a = [0, 45, 0])
30
- cube(size = 50, center = true);
31
- rotate(a = [0, 0, 45])
32
- cube(size = 50, center = true);
33
- }
34
- translate(v = [100, 0])
35
- sphere(r = 30);
36
- translate(v = [200, 0])
37
- cube(size = 60, center = true);
38
- }
39
- translate(v = [0, 50]) {
40
- translate(v = [-100, 0])
41
- union() {
42
- cube(size = 45, center = true);
43
- rotate(a = [45, 0, 0])
44
- cube(size = 50, center = true);
45
- rotate(a = [0, 45, 0])
46
- cube(size = 50, center = true);
47
- rotate(a = [0, 0, 45])
48
- cube(size = 50, center = true);
49
- }
50
- translate(v = [0, 0])
51
- sphere(r = 30);
52
- translate(v = [100, 0])
53
- cube(size = 60, center = true);
54
- translate(v = [200, 0])
55
- cylinder(r = 30, h = 50, center = true);
56
- }
57
- translate(v = [0, 150]) {
58
- translate(v = [-100, 0])
59
- sphere(r = 30);
60
- translate(v = [0, 0])
61
- cube(size = 60, center = true);
62
- translate(v = [100, 0])
63
- cylinder(r = 30, h = 50, center = true);
64
- translate(v = [200, 0])
65
- union() {
66
- cube(size = 45, center = true);
67
- rotate(a = [45, 0, 0])
68
- cube(size = 50, center = true);
69
- rotate(a = [0, 45, 0])
70
- cube(size = 50, center = true);
71
- rotate(a = [0, 0, 45])
72
- cube(size = 50, center = true);
73
- }
74
- }
1
+ //created with rubyscad 1.0
2
+
3
+ translate(v = [0, -150]) {
4
+ translate(v = [-100, 0])
5
+ cube(size = 60, center = true);
6
+ translate(v = [0, 0])
7
+ cylinder(r = 30, h = 50, center = true);
8
+ translate(v = [100, 0])
9
+ union() {
10
+ cube(size = 45, center = true);
11
+ rotate(a = [45, 0, 0])
12
+ cube(size = 50, center = true);
13
+ rotate(a = [0, 45, 0])
14
+ cube(size = 50, center = true);
15
+ rotate(a = [0, 0, 45])
16
+ cube(size = 50, center = true);
17
+ }
18
+ translate(v = [200, 0])
19
+ sphere(r = 30);
20
+ }
21
+ translate(v = [0, -50]) {
22
+ translate(v = [-100, 0])
23
+ cylinder(r = 30, h = 50, center = true);
24
+ translate(v = [0, 0])
25
+ union() {
26
+ cube(size = 45, center = true);
27
+ rotate(a = [45, 0, 0])
28
+ cube(size = 50, center = true);
29
+ rotate(a = [0, 45, 0])
30
+ cube(size = 50, center = true);
31
+ rotate(a = [0, 0, 45])
32
+ cube(size = 50, center = true);
33
+ }
34
+ translate(v = [100, 0])
35
+ sphere(r = 30);
36
+ translate(v = [200, 0])
37
+ cube(size = 60, center = true);
38
+ }
39
+ translate(v = [0, 50]) {
40
+ translate(v = [-100, 0])
41
+ union() {
42
+ cube(size = 45, center = true);
43
+ rotate(a = [45, 0, 0])
44
+ cube(size = 50, center = true);
45
+ rotate(a = [0, 45, 0])
46
+ cube(size = 50, center = true);
47
+ rotate(a = [0, 0, 45])
48
+ cube(size = 50, center = true);
49
+ }
50
+ translate(v = [0, 0])
51
+ sphere(r = 30);
52
+ translate(v = [100, 0])
53
+ cube(size = 60, center = true);
54
+ translate(v = [200, 0])
55
+ cylinder(r = 30, h = 50, center = true);
56
+ }
57
+ translate(v = [0, 150]) {
58
+ translate(v = [-100, 0])
59
+ sphere(r = 30);
60
+ translate(v = [0, 0])
61
+ cube(size = 60, center = true);
62
+ translate(v = [100, 0])
63
+ cylinder(r = 30, h = 50, center = true);
64
+ translate(v = [200, 0])
65
+ union() {
66
+ cube(size = 45, center = true);
67
+ rotate(a = [45, 0, 0])
68
+ cube(size = 50, center = true);
69
+ rotate(a = [0, 45, 0])
70
+ cube(size = 50, center = true);
71
+ rotate(a = [0, 0, 45])
72
+ cube(size = 50, center = true);
73
+ }
74
+ }