rubyscad 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/.gitignore +21 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/Rakefile +1 -0
  5. data/examples/BasicCube.rb +50 -0
  6. data/examples/ChamferCube.rb +96 -0
  7. data/examples/FilletCube.rb +317 -0
  8. data/examples/example001.rb +33 -0
  9. data/examples/example001.scad +11 -0
  10. data/examples/example002.rb +23 -0
  11. data/examples/example002.scad +18 -0
  12. data/examples/example003.rb +19 -0
  13. data/examples/example003.scad +15 -0
  14. data/examples/example004.rb +11 -0
  15. data/examples/example004.scad +6 -0
  16. data/examples/example005.rb +22 -0
  17. data/examples/example005.scad +31 -0
  18. data/examples/example006.rb +46 -0
  19. data/examples/example006.scad +221 -0
  20. data/examples/example007.dxf +2410 -0
  21. data/examples/example007.rb +53 -0
  22. data/examples/example007.scad +30 -0
  23. data/examples/example008.dxf +3238 -0
  24. data/examples/example008.rb +34 -0
  25. data/examples/example008.scad +26 -0
  26. data/examples/example009.dxf +3894 -0
  27. data/examples/example009.rb +33 -0
  28. data/examples/example009.scad +15 -0
  29. data/examples/example010.dat +51 -0
  30. data/examples/example010.rb +12 -0
  31. data/examples/example010.scad +7 -0
  32. data/examples/example011.rb +22 -0
  33. data/examples/example011.scad +3 -0
  34. data/examples/example012.rb +16 -0
  35. data/examples/example012.scad +8 -0
  36. data/examples/example012.stl +450 -0
  37. data/examples/example013.dxf +2276 -0
  38. data/examples/example013.rb +16 -0
  39. data/examples/example013.scad +12 -0
  40. data/examples/example014.rb +14 -0
  41. data/examples/example014.scad +12 -0
  42. data/examples/example015.rb +33 -0
  43. data/examples/example015.scad +22 -0
  44. data/examples/example016.rb +43 -0
  45. data/examples/example016.scad +49 -0
  46. data/examples/example016.stl +0 -0
  47. data/examples/example017.rb +170 -0
  48. data/examples/example017.scad +124 -0
  49. data/examples/example018.rb +29 -0
  50. data/examples/example018.scad +74 -0
  51. data/examples/example019.rb +22 -0
  52. data/examples/example019.scad +84 -0
  53. data/examples/example020.rb +92 -0
  54. data/examples/example020.scad +62 -0
  55. data/examples/example021.rb +42 -0
  56. data/examples/example021.scad +159 -0
  57. data/examples/example022.rb +44 -0
  58. data/examples/example022.scad +103 -0
  59. data/lib/{RubyScad.rb → rubyscad/RubyScad.rb} +0 -0
  60. data/lib/rubyscad/version.rb +1 -1
  61. data/lib/rubyscad.rb +1 -1
  62. data/rubyscad.gemspec +20 -0
  63. metadata +66 -7
@@ -0,0 +1,31 @@
1
+ //created with rubyscad 1.0
2
+
3
+ translate(v = [0.000, 0.000, -120]) {
4
+ difference() {
5
+ cylinder(h = 50, r = 100);
6
+ translate(v = [0.000, 0.000, 10])
7
+ cylinder(h = 50, r = 80);
8
+ translate(v = [100, 0, 35])
9
+ cube(size = 50, center = true);
10
+ }
11
+ echo(0, 0.000, 80.000);
12
+ translate(v = [0.000, 80.000, 0])
13
+ cylinder(h = 200, r = 10);
14
+ echo(60, 69.282, 40.000);
15
+ translate(v = [69.282, 40.000, 0])
16
+ cylinder(h = 200, r = 10);
17
+ echo(120, 69.282, -40.000);
18
+ translate(v = [69.282, -40.000, 0])
19
+ cylinder(h = 200, r = 10);
20
+ echo(180, 0.000, -80.000);
21
+ translate(v = [0.000, -80.000, 0])
22
+ cylinder(h = 200, r = 10);
23
+ echo(240, -69.282, -40.000);
24
+ translate(v = [-69.282, -40.000, 0])
25
+ cylinder(h = 200, r = 10);
26
+ echo(300, -69.282, 40.000);
27
+ translate(v = [-69.282, 40.000, 0])
28
+ cylinder(h = 200, r = 10);
29
+ translate(v = [0.000, 0.000, 200])
30
+ cylinder(h = 80, r1 = 120, r2 = 0);
31
+ }
@@ -0,0 +1,46 @@
1
+ require "rubyscad"
2
+
3
+ module Example006
4
+ extend RubyScad
5
+
6
+ def self.edgeprofile()
7
+ render(convexity: 2)
8
+ difference() {
9
+ cube(size: [20, 20, 150], center: true)
10
+ translate(v: [-10, -10, 0])
11
+ cylinder(h: 80, r: 10, center: true)
12
+ translate(v:[-10, -10, 40])
13
+ sphere(r: 10);
14
+ translate(v: [-10, -10, -40])
15
+ sphere(r: 10)
16
+ }
17
+ end
18
+
19
+ difference() {
20
+ cube(size: 100, center: true)
21
+ [[0, 0, 0], [1, 0, 0], [0, 1, 0]].each do |rot|
22
+ rotate(a: 90, v: rot) {
23
+ [[1, 1, 0], [-1, 1, 90], [-1, -1, 180], [1, -1, 270]].each do |p|
24
+ translate(v: [ p[0]*50, p[1]*50, 0 ])
25
+ rotate(a: p[2], v: [0, 0, 1])
26
+ edgeprofile()
27
+ end
28
+ }
29
+ end
30
+ [
31
+ [ 0, 0, [ [0, 0] ] ],
32
+ [ 90, 0, [ [-20, -20], [20, 20] ] ],
33
+ [ 180, 0, [ [-20, -25], [-20, 0], [-20, 25], [20, -25], [20, 0], [20, 25] ] ],
34
+ [ 270, 0, [ [0, 0], [-25, -25], [25, -25], [-25, +25], [25, 25] ] ],
35
+ [ 0, 90, [ [-25, -25], [0, 0], [25, 25] ] ],
36
+ [ 0, -90, [ [-25, -25], [25, -25], [-25, 25], [25, 25] ] ]
37
+ ].each do |i|
38
+ rotate(a: i[0], v: [0, 0, 1])
39
+ rotate(a: i[1], v: [1, 0, 0])
40
+ translate(y: -50) {
41
+ i[2].each { |j| translate(v: [j[0], 0, j[1]]); sphere(r: 10) }
42
+ }
43
+ end
44
+ }
45
+ end
46
+
@@ -0,0 +1,221 @@
1
+ //created with rubyscad 1.0
2
+
3
+ difference() {
4
+ cube(size = 100, center = true);
5
+ rotate(a = 90, v = [0, 0, 0]) {
6
+ translate(v = [50, 50, 0])
7
+ rotate(a = 0, v = [0, 0, 1])
8
+ render(convexity = 2)
9
+ difference() {
10
+ cube(size = [20, 20, 150], center = true);
11
+ translate(v = [-10, -10, 0])
12
+ cylinder(h = 80, r = 10, center = true);
13
+ translate(v = [-10, -10, 40])
14
+ sphere(r = 10);
15
+ translate(v = [-10, -10, -40])
16
+ sphere(r = 10);
17
+ }
18
+ translate(v = [-50, 50, 0])
19
+ rotate(a = 90, v = [0, 0, 1])
20
+ render(convexity = 2)
21
+ difference() {
22
+ cube(size = [20, 20, 150], center = true);
23
+ translate(v = [-10, -10, 0])
24
+ cylinder(h = 80, r = 10, center = true);
25
+ translate(v = [-10, -10, 40])
26
+ sphere(r = 10);
27
+ translate(v = [-10, -10, -40])
28
+ sphere(r = 10);
29
+ }
30
+ translate(v = [-50, -50, 0])
31
+ rotate(a = 180, v = [0, 0, 1])
32
+ render(convexity = 2)
33
+ difference() {
34
+ cube(size = [20, 20, 150], center = true);
35
+ translate(v = [-10, -10, 0])
36
+ cylinder(h = 80, r = 10, center = true);
37
+ translate(v = [-10, -10, 40])
38
+ sphere(r = 10);
39
+ translate(v = [-10, -10, -40])
40
+ sphere(r = 10);
41
+ }
42
+ translate(v = [50, -50, 0])
43
+ rotate(a = 270, v = [0, 0, 1])
44
+ render(convexity = 2)
45
+ difference() {
46
+ cube(size = [20, 20, 150], center = true);
47
+ translate(v = [-10, -10, 0])
48
+ cylinder(h = 80, r = 10, center = true);
49
+ translate(v = [-10, -10, 40])
50
+ sphere(r = 10);
51
+ translate(v = [-10, -10, -40])
52
+ sphere(r = 10);
53
+ }
54
+ }
55
+ rotate(a = 90, v = [1, 0, 0]) {
56
+ translate(v = [50, 50, 0])
57
+ rotate(a = 0, v = [0, 0, 1])
58
+ render(convexity = 2)
59
+ difference() {
60
+ cube(size = [20, 20, 150], center = true);
61
+ translate(v = [-10, -10, 0])
62
+ cylinder(h = 80, r = 10, center = true);
63
+ translate(v = [-10, -10, 40])
64
+ sphere(r = 10);
65
+ translate(v = [-10, -10, -40])
66
+ sphere(r = 10);
67
+ }
68
+ translate(v = [-50, 50, 0])
69
+ rotate(a = 90, v = [0, 0, 1])
70
+ render(convexity = 2)
71
+ difference() {
72
+ cube(size = [20, 20, 150], center = true);
73
+ translate(v = [-10, -10, 0])
74
+ cylinder(h = 80, r = 10, center = true);
75
+ translate(v = [-10, -10, 40])
76
+ sphere(r = 10);
77
+ translate(v = [-10, -10, -40])
78
+ sphere(r = 10);
79
+ }
80
+ translate(v = [-50, -50, 0])
81
+ rotate(a = 180, v = [0, 0, 1])
82
+ render(convexity = 2)
83
+ difference() {
84
+ cube(size = [20, 20, 150], center = true);
85
+ translate(v = [-10, -10, 0])
86
+ cylinder(h = 80, r = 10, center = true);
87
+ translate(v = [-10, -10, 40])
88
+ sphere(r = 10);
89
+ translate(v = [-10, -10, -40])
90
+ sphere(r = 10);
91
+ }
92
+ translate(v = [50, -50, 0])
93
+ rotate(a = 270, v = [0, 0, 1])
94
+ render(convexity = 2)
95
+ difference() {
96
+ cube(size = [20, 20, 150], center = true);
97
+ translate(v = [-10, -10, 0])
98
+ cylinder(h = 80, r = 10, center = true);
99
+ translate(v = [-10, -10, 40])
100
+ sphere(r = 10);
101
+ translate(v = [-10, -10, -40])
102
+ sphere(r = 10);
103
+ }
104
+ }
105
+ rotate(a = 90, v = [0, 1, 0]) {
106
+ translate(v = [50, 50, 0])
107
+ rotate(a = 0, v = [0, 0, 1])
108
+ render(convexity = 2)
109
+ difference() {
110
+ cube(size = [20, 20, 150], center = true);
111
+ translate(v = [-10, -10, 0])
112
+ cylinder(h = 80, r = 10, center = true);
113
+ translate(v = [-10, -10, 40])
114
+ sphere(r = 10);
115
+ translate(v = [-10, -10, -40])
116
+ sphere(r = 10);
117
+ }
118
+ translate(v = [-50, 50, 0])
119
+ rotate(a = 90, v = [0, 0, 1])
120
+ render(convexity = 2)
121
+ difference() {
122
+ cube(size = [20, 20, 150], center = true);
123
+ translate(v = [-10, -10, 0])
124
+ cylinder(h = 80, r = 10, center = true);
125
+ translate(v = [-10, -10, 40])
126
+ sphere(r = 10);
127
+ translate(v = [-10, -10, -40])
128
+ sphere(r = 10);
129
+ }
130
+ translate(v = [-50, -50, 0])
131
+ rotate(a = 180, v = [0, 0, 1])
132
+ render(convexity = 2)
133
+ difference() {
134
+ cube(size = [20, 20, 150], center = true);
135
+ translate(v = [-10, -10, 0])
136
+ cylinder(h = 80, r = 10, center = true);
137
+ translate(v = [-10, -10, 40])
138
+ sphere(r = 10);
139
+ translate(v = [-10, -10, -40])
140
+ sphere(r = 10);
141
+ }
142
+ translate(v = [50, -50, 0])
143
+ rotate(a = 270, v = [0, 0, 1])
144
+ render(convexity = 2)
145
+ difference() {
146
+ cube(size = [20, 20, 150], center = true);
147
+ translate(v = [-10, -10, 0])
148
+ cylinder(h = 80, r = 10, center = true);
149
+ translate(v = [-10, -10, 40])
150
+ sphere(r = 10);
151
+ translate(v = [-10, -10, -40])
152
+ sphere(r = 10);
153
+ }
154
+ }
155
+ rotate(a = 0, v = [0, 0, 1])
156
+ rotate(a = 0, v = [1, 0, 0])
157
+ translate(v = [0.000, -50]) {
158
+ translate(v = [0, 0, 0])
159
+ sphere(r = 10);
160
+ }
161
+ rotate(a = 90, v = [0, 0, 1])
162
+ rotate(a = 0, v = [1, 0, 0])
163
+ translate(v = [0.000, -50]) {
164
+ translate(v = [-20, 0, -20])
165
+ sphere(r = 10);
166
+ translate(v = [20, 0, 20])
167
+ sphere(r = 10);
168
+ }
169
+ rotate(a = 180, v = [0, 0, 1])
170
+ rotate(a = 0, v = [1, 0, 0])
171
+ translate(v = [0.000, -50]) {
172
+ translate(v = [-20, 0, -25])
173
+ sphere(r = 10);
174
+ translate(v = [-20, 0, 0])
175
+ sphere(r = 10);
176
+ translate(v = [-20, 0, 25])
177
+ sphere(r = 10);
178
+ translate(v = [20, 0, -25])
179
+ sphere(r = 10);
180
+ translate(v = [20, 0, 0])
181
+ sphere(r = 10);
182
+ translate(v = [20, 0, 25])
183
+ sphere(r = 10);
184
+ }
185
+ rotate(a = 270, v = [0, 0, 1])
186
+ rotate(a = 0, v = [1, 0, 0])
187
+ translate(v = [0.000, -50]) {
188
+ translate(v = [0, 0, 0])
189
+ sphere(r = 10);
190
+ translate(v = [-25, 0, -25])
191
+ sphere(r = 10);
192
+ translate(v = [25, 0, -25])
193
+ sphere(r = 10);
194
+ translate(v = [-25, 0, 25])
195
+ sphere(r = 10);
196
+ translate(v = [25, 0, 25])
197
+ sphere(r = 10);
198
+ }
199
+ rotate(a = 0, v = [0, 0, 1])
200
+ rotate(a = 90, v = [1, 0, 0])
201
+ translate(v = [0.000, -50]) {
202
+ translate(v = [-25, 0, -25])
203
+ sphere(r = 10);
204
+ translate(v = [0, 0, 0])
205
+ sphere(r = 10);
206
+ translate(v = [25, 0, 25])
207
+ sphere(r = 10);
208
+ }
209
+ rotate(a = 0, v = [0, 0, 1])
210
+ rotate(a = -90, v = [1, 0, 0])
211
+ translate(v = [0.000, -50]) {
212
+ translate(v = [-25, 0, -25])
213
+ sphere(r = 10);
214
+ translate(v = [25, 0, -25])
215
+ sphere(r = 10);
216
+ translate(v = [-25, 0, 25])
217
+ sphere(r = 10);
218
+ translate(v = [25, 0, 25])
219
+ sphere(r = 10);
220
+ }
221
+ }