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,42 +1,42 @@
1
- require "rubyscad"
2
-
3
- module Example021
4
- extend RubyScad
5
-
6
- fa 30
7
-
8
- def self.thing()
9
-
10
- difference() {
11
- sphere(r: 25)
12
- cylinder(h: 62.5, r1: 12.5, r2: 6.25, center: true)
13
- rotate(x: 90)
14
- cylinder(h: 62.5, r1: 12.5, r2: 6.25, center: true)
15
- rotate(y: 90)
16
- cylinder(h: 62.5, r1: 12.5, r2: 6.25, center: true)
17
- }
18
- end
19
-
20
- def self.demo_proj()
21
- linear_extrude(center: true, height: 0.5)
22
- projection(cut: false)
23
- thing()
24
- background; thing()
25
- end
26
-
27
- def self.demo_cut()
28
- (-20..+20).step(5) do |i|
29
- rotate(a: -30, v:[ 1, 1, 0 ]); translate(z: -i)
30
- linear_extrude(center: true, height: 0.5); projection(cut: true)
31
- translate(z: i); rotate(a: 30, v: [ 1, 1, 0 ]); thing()
32
- end
33
- background; thing()
34
- end
35
-
36
- translate(x: -30) {
37
- demo_proj()
38
- }
39
- translate(x: 30) {
40
- demo_cut()
41
- }
42
- end
1
+ require "rubyscad"
2
+
3
+ module Example021
4
+ extend RubyScad
5
+
6
+ fa 30
7
+
8
+ def self.thing()
9
+
10
+ difference() {
11
+ sphere(r: 25)
12
+ cylinder(h: 62.5, r1: 12.5, r2: 6.25, center: true)
13
+ rotate(x: 90)
14
+ cylinder(h: 62.5, r1: 12.5, r2: 6.25, center: true)
15
+ rotate(y: 90)
16
+ cylinder(h: 62.5, r1: 12.5, r2: 6.25, center: true)
17
+ }
18
+ end
19
+
20
+ def self.demo_proj()
21
+ linear_extrude(center: true, height: 0.5)
22
+ projection(cut: false)
23
+ thing()
24
+ background; thing()
25
+ end
26
+
27
+ def self.demo_cut()
28
+ (-20..+20).step(5) do |i|
29
+ rotate(a: -30, v:[ 1, 1, 0 ]); translate(z: -i)
30
+ linear_extrude(center: true, height: 0.5); projection(cut: true)
31
+ translate(z: i); rotate(a: 30, v: [ 1, 1, 0 ]); thing()
32
+ end
33
+ background; thing()
34
+ end
35
+
36
+ translate(x: -30) {
37
+ demo_proj()
38
+ }
39
+ translate(x: 30) {
40
+ demo_cut()
41
+ }
42
+ end
@@ -1,159 +1,159 @@
1
- //created with rubyscad 1.0
2
-
3
- $fa = 30;
4
- translate(v = [-30, 0]) {
5
- linear_extrude(center = true, height = 0.500)
6
- projection(cut = false)
7
- difference() {
8
- sphere(r = 25);
9
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
10
- rotate(a = [90, 0])
11
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
12
- rotate(a = [0, 90])
13
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
14
- }
15
- %difference() {
16
- sphere(r = 25);
17
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
18
- rotate(a = [90, 0])
19
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
20
- rotate(a = [0, 90])
21
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
22
- }
23
- }
24
- translate(v = [30, 0]) {
25
- rotate(a = -30, v = [1, 1, 0])
26
- translate(v = [0, 0, 20])
27
- linear_extrude(center = true, height = 0.500)
28
- projection(cut = true)
29
- translate(v = [0, 0, -20])
30
- rotate(a = 30, v = [1, 1, 0])
31
- difference() {
32
- sphere(r = 25);
33
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
34
- rotate(a = [90, 0])
35
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
36
- rotate(a = [0, 90])
37
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
38
- }
39
- rotate(a = -30, v = [1, 1, 0])
40
- translate(v = [0, 0, 15])
41
- linear_extrude(center = true, height = 0.500)
42
- projection(cut = true)
43
- translate(v = [0, 0, -15])
44
- rotate(a = 30, v = [1, 1, 0])
45
- difference() {
46
- sphere(r = 25);
47
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
48
- rotate(a = [90, 0])
49
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
50
- rotate(a = [0, 90])
51
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
52
- }
53
- rotate(a = -30, v = [1, 1, 0])
54
- translate(v = [0, 0, 10])
55
- linear_extrude(center = true, height = 0.500)
56
- projection(cut = true)
57
- translate(v = [0, 0, -10])
58
- rotate(a = 30, v = [1, 1, 0])
59
- difference() {
60
- sphere(r = 25);
61
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
62
- rotate(a = [90, 0])
63
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
64
- rotate(a = [0, 90])
65
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
66
- }
67
- rotate(a = -30, v = [1, 1, 0])
68
- translate(v = [0, 0, 5])
69
- linear_extrude(center = true, height = 0.500)
70
- projection(cut = true)
71
- translate(v = [0, 0, -5])
72
- rotate(a = 30, v = [1, 1, 0])
73
- difference() {
74
- sphere(r = 25);
75
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
76
- rotate(a = [90, 0])
77
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
78
- rotate(a = [0, 90])
79
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
80
- }
81
- rotate(a = -30, v = [1, 1, 0])
82
- translate(v = [0, 0, 0])
83
- linear_extrude(center = true, height = 0.500)
84
- projection(cut = true)
85
- translate(v = [0, 0, 0])
86
- rotate(a = 30, v = [1, 1, 0])
87
- difference() {
88
- sphere(r = 25);
89
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
90
- rotate(a = [90, 0])
91
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
92
- rotate(a = [0, 90])
93
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
94
- }
95
- rotate(a = -30, v = [1, 1, 0])
96
- translate(v = [0, 0, -5])
97
- linear_extrude(center = true, height = 0.500)
98
- projection(cut = true)
99
- translate(v = [0, 0, 5])
100
- rotate(a = 30, v = [1, 1, 0])
101
- difference() {
102
- sphere(r = 25);
103
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
104
- rotate(a = [90, 0])
105
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
106
- rotate(a = [0, 90])
107
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
108
- }
109
- rotate(a = -30, v = [1, 1, 0])
110
- translate(v = [0, 0, -10])
111
- linear_extrude(center = true, height = 0.500)
112
- projection(cut = true)
113
- translate(v = [0, 0, 10])
114
- rotate(a = 30, v = [1, 1, 0])
115
- difference() {
116
- sphere(r = 25);
117
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
118
- rotate(a = [90, 0])
119
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
120
- rotate(a = [0, 90])
121
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
122
- }
123
- rotate(a = -30, v = [1, 1, 0])
124
- translate(v = [0, 0, -15])
125
- linear_extrude(center = true, height = 0.500)
126
- projection(cut = true)
127
- translate(v = [0, 0, 15])
128
- rotate(a = 30, v = [1, 1, 0])
129
- difference() {
130
- sphere(r = 25);
131
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
132
- rotate(a = [90, 0])
133
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
134
- rotate(a = [0, 90])
135
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
136
- }
137
- rotate(a = -30, v = [1, 1, 0])
138
- translate(v = [0, 0, -20])
139
- linear_extrude(center = true, height = 0.500)
140
- projection(cut = true)
141
- translate(v = [0, 0, 20])
142
- rotate(a = 30, v = [1, 1, 0])
143
- difference() {
144
- sphere(r = 25);
145
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
146
- rotate(a = [90, 0])
147
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
148
- rotate(a = [0, 90])
149
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
150
- }
151
- %difference() {
152
- sphere(r = 25);
153
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
154
- rotate(a = [90, 0])
155
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
156
- rotate(a = [0, 90])
157
- cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
158
- }
159
- }
1
+ //created with rubyscad 1.0
2
+
3
+ $fa = 30;
4
+ translate(v = [-30, 0]) {
5
+ linear_extrude(center = true, height = 0.500)
6
+ projection(cut = false)
7
+ difference() {
8
+ sphere(r = 25);
9
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
10
+ rotate(a = [90, 0])
11
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
12
+ rotate(a = [0, 90])
13
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
14
+ }
15
+ %difference() {
16
+ sphere(r = 25);
17
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
18
+ rotate(a = [90, 0])
19
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
20
+ rotate(a = [0, 90])
21
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
22
+ }
23
+ }
24
+ translate(v = [30, 0]) {
25
+ rotate(a = -30, v = [1, 1, 0])
26
+ translate(v = [0, 0, 20])
27
+ linear_extrude(center = true, height = 0.500)
28
+ projection(cut = true)
29
+ translate(v = [0, 0, -20])
30
+ rotate(a = 30, v = [1, 1, 0])
31
+ difference() {
32
+ sphere(r = 25);
33
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
34
+ rotate(a = [90, 0])
35
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
36
+ rotate(a = [0, 90])
37
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
38
+ }
39
+ rotate(a = -30, v = [1, 1, 0])
40
+ translate(v = [0, 0, 15])
41
+ linear_extrude(center = true, height = 0.500)
42
+ projection(cut = true)
43
+ translate(v = [0, 0, -15])
44
+ rotate(a = 30, v = [1, 1, 0])
45
+ difference() {
46
+ sphere(r = 25);
47
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
48
+ rotate(a = [90, 0])
49
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
50
+ rotate(a = [0, 90])
51
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
52
+ }
53
+ rotate(a = -30, v = [1, 1, 0])
54
+ translate(v = [0, 0, 10])
55
+ linear_extrude(center = true, height = 0.500)
56
+ projection(cut = true)
57
+ translate(v = [0, 0, -10])
58
+ rotate(a = 30, v = [1, 1, 0])
59
+ difference() {
60
+ sphere(r = 25);
61
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
62
+ rotate(a = [90, 0])
63
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
64
+ rotate(a = [0, 90])
65
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
66
+ }
67
+ rotate(a = -30, v = [1, 1, 0])
68
+ translate(v = [0, 0, 5])
69
+ linear_extrude(center = true, height = 0.500)
70
+ projection(cut = true)
71
+ translate(v = [0, 0, -5])
72
+ rotate(a = 30, v = [1, 1, 0])
73
+ difference() {
74
+ sphere(r = 25);
75
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
76
+ rotate(a = [90, 0])
77
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
78
+ rotate(a = [0, 90])
79
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
80
+ }
81
+ rotate(a = -30, v = [1, 1, 0])
82
+ translate(v = [0, 0, 0])
83
+ linear_extrude(center = true, height = 0.500)
84
+ projection(cut = true)
85
+ translate(v = [0, 0, 0])
86
+ rotate(a = 30, v = [1, 1, 0])
87
+ difference() {
88
+ sphere(r = 25);
89
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
90
+ rotate(a = [90, 0])
91
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
92
+ rotate(a = [0, 90])
93
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
94
+ }
95
+ rotate(a = -30, v = [1, 1, 0])
96
+ translate(v = [0, 0, -5])
97
+ linear_extrude(center = true, height = 0.500)
98
+ projection(cut = true)
99
+ translate(v = [0, 0, 5])
100
+ rotate(a = 30, v = [1, 1, 0])
101
+ difference() {
102
+ sphere(r = 25);
103
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
104
+ rotate(a = [90, 0])
105
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
106
+ rotate(a = [0, 90])
107
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
108
+ }
109
+ rotate(a = -30, v = [1, 1, 0])
110
+ translate(v = [0, 0, -10])
111
+ linear_extrude(center = true, height = 0.500)
112
+ projection(cut = true)
113
+ translate(v = [0, 0, 10])
114
+ rotate(a = 30, v = [1, 1, 0])
115
+ difference() {
116
+ sphere(r = 25);
117
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
118
+ rotate(a = [90, 0])
119
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
120
+ rotate(a = [0, 90])
121
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
122
+ }
123
+ rotate(a = -30, v = [1, 1, 0])
124
+ translate(v = [0, 0, -15])
125
+ linear_extrude(center = true, height = 0.500)
126
+ projection(cut = true)
127
+ translate(v = [0, 0, 15])
128
+ rotate(a = 30, v = [1, 1, 0])
129
+ difference() {
130
+ sphere(r = 25);
131
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
132
+ rotate(a = [90, 0])
133
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
134
+ rotate(a = [0, 90])
135
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
136
+ }
137
+ rotate(a = -30, v = [1, 1, 0])
138
+ translate(v = [0, 0, -20])
139
+ linear_extrude(center = true, height = 0.500)
140
+ projection(cut = true)
141
+ translate(v = [0, 0, 20])
142
+ rotate(a = 30, v = [1, 1, 0])
143
+ difference() {
144
+ sphere(r = 25);
145
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
146
+ rotate(a = [90, 0])
147
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
148
+ rotate(a = [0, 90])
149
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
150
+ }
151
+ %difference() {
152
+ sphere(r = 25);
153
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
154
+ rotate(a = [90, 0])
155
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
156
+ rotate(a = [0, 90])
157
+ cylinder(h = 62.500, r1 = 12.500, r2 = 6.250, center = true);
158
+ }
159
+ }
@@ -1,44 +1,44 @@
1
- require "rubyscad"
2
- require 'matrix'
3
-
4
- module Example022
5
- extend RubyScad
6
-
7
- def self.roundedBox(size, radius, sidesonly)
8
- rot = [ [0,0,0], [90,0,90], [90,90,0] ]
9
- if (sidesonly)
10
- cube(size: (size - Vector[2*radius,0,0]), center: true)
11
- cube(size: (size - Vector[0,2*radius,0]), center: true)
12
- [radius-size[0]/2, -radius+size[0]/2].each do |x|
13
- [radius-size[1]/2, -radius+size[1]/2].each do |y|
14
- translate(x: x, y: y); cylinder(r: radius, h: size[2], center: true)
15
- end
16
- end
17
- else
18
- cube(size: [size[0], size[1]-radius*2, size[2]-radius*2], center: true)
19
- cube(size: [size[0]-radius*2, size[1], size[2]-radius*2], center: true)
20
- cube(size: [size[0]-radius*2, size[1]-radius*2, size[2]], center: true)
21
-
22
- (0..2).each do |axis|
23
- [radius-size[axis]/2, -radius+size[axis]/2].each do |x|
24
- [radius-size[(axis+1)%3]/2, -radius+size[(axis+1)%3]/2].each do |y|
25
- rotate(a: rot[axis])
26
- translate(v: [x,y,0])
27
- cylinder(h: size[(axis+2)%3]-2*radius, r: radius, center: true)
28
- end
29
- end
30
- [radius-size[0]/2, -radius+size[0]/2].each do |x|
31
- [radius-size[1]/2, -radius+size[1]/2].each do |y|
32
- [radius-size[2]/2, -radius+size[2]/2].each do |z|
33
- translate(v: [x,y,z]); sphere(r: radius)
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end
40
-
41
- translate(v: [-15,0,0]) { roundedBox(Vector[20.0,30.0,40.0], 5.0, true) }
42
- translate(v:[15,0,0]) { roundedBox(Vector[20.0,30.0,40.0], 5, false) }
43
- end
44
-
1
+ require "rubyscad"
2
+ require 'matrix'
3
+
4
+ module Example022
5
+ extend RubyScad
6
+
7
+ def self.roundedBox(size, radius, sidesonly)
8
+ rot = [ [0,0,0], [90,0,90], [90,90,0] ]
9
+ if (sidesonly)
10
+ cube(size: (size - Vector[2*radius,0,0]), center: true)
11
+ cube(size: (size - Vector[0,2*radius,0]), center: true)
12
+ [radius-size[0]/2, -radius+size[0]/2].each do |x|
13
+ [radius-size[1]/2, -radius+size[1]/2].each do |y|
14
+ translate(x: x, y: y); cylinder(r: radius, h: size[2], center: true)
15
+ end
16
+ end
17
+ else
18
+ cube(size: [size[0], size[1]-radius*2, size[2]-radius*2], center: true)
19
+ cube(size: [size[0]-radius*2, size[1], size[2]-radius*2], center: true)
20
+ cube(size: [size[0]-radius*2, size[1]-radius*2, size[2]], center: true)
21
+
22
+ (0..2).each do |axis|
23
+ [radius-size[axis]/2, -radius+size[axis]/2].each do |x|
24
+ [radius-size[(axis+1)%3]/2, -radius+size[(axis+1)%3]/2].each do |y|
25
+ rotate(a: rot[axis])
26
+ translate(v: [x,y,0])
27
+ cylinder(h: size[(axis+2)%3]-2*radius, r: radius, center: true)
28
+ end
29
+ end
30
+ [radius-size[0]/2, -radius+size[0]/2].each do |x|
31
+ [radius-size[1]/2, -radius+size[1]/2].each do |y|
32
+ [radius-size[2]/2, -radius+size[2]/2].each do |z|
33
+ translate(v: [x,y,z]); sphere(r: radius)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ translate(v: [-15,0,0]) { roundedBox(Vector[20.0,30.0,40.0], 5.0, true) }
42
+ translate(v:[15,0,0]) { roundedBox(Vector[20.0,30.0,40.0], 5, false) }
43
+ end
44
+