-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
71 lines (61 loc) · 1.71 KB
/
Rakefile
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
60
61
62
63
64
65
66
67
68
69
70
require 'fileutils'
output_dir = 'out'
task :output_dir do
Dir.mkdir output_dir unless File.exists?(output_dir)
end
desc "clean everything"
task :clean do
FileUtils.rm_rf(output_dir)
end
def openscad_command
if RUBY_PLATFORM.include? 'darwin'
return '/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD'
end
'openscad'
end
def openscad(scad, stl, argument_list)
args = ""
argument_list.each do |key, value|
args = "#{args}-D '#{key}=#{value}' "
end
puts ">> Generate #{stl} from #{scad}"
sh "#{openscad_command} #{args} -o out/#{stl} #{scad}"
end
desc 'germination hive'
task :germination_hive => :output_dir do
openscad(
"main.scad",
"germination-pod.stl",
{
'height' => 60,
'width' => 2,
'diameter' => 60,
})
end
desc 'create a more complex version'
task :complex_version => :output_dir do
bottle_height = 80
bottle_diameter = 80
filter_diameter = 50
filter_height = 8
nossle_diameter = 5
nossle_height = 10
openscad(
"make_filter.scad",
"complex_filter.stl",
{
'diameter' => filter_diameter,
'height' => filter_height,
})
openscad(
"make_bottle.scad",
"complex_bottle.stl",
{
'diameter' => bottle_diameter,
'height' => bottle_height,
'filter_diameter' => filter_diameter,
'filter_height' => filter_height,
'nossle_diameter' => nossle_diameter,
'nossle_height' => nossle_height,
})
end