oozby 0.4.0 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/oozby +1 -0
- data/lib/oozby/environment.rb +10 -0
- data/lib/oozby/preprocessor-definitions.rb +23 -14
- data/lib/oozby/preprocessor.rb +7 -8
- data/lib/oozby/version.rb +1 -1
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdb941976cc799e103cace769bb835829c0f6e2a
|
4
|
+
data.tar.gz: 02cd7754307c2772d08da24d5daffc0c980f3488
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b91789fe1b0168b93e7414ef24a70b1eabbe1fd1aa6f84131b8a0522a90136d14b8a1c723cfc9927e480a1d058243821f45e76f3e3265ac020b5649de72392c5
|
7
|
+
data.tar.gz: fecffe94b5cbdc3a3cdd1dbf704ec25d70f39e0fc740ac54a2dd19df972b7f3df9fa94a8efb35ee7b09c8c5329ed22e13da133d7fdd50444a26179066f97129e
|
data/bin/oozby
CHANGED
data/lib/oozby/environment.rb
CHANGED
@@ -149,6 +149,16 @@ class Oozby::Environment
|
|
149
149
|
(a[1].to_f * value_proportion) + (b[1].to_f * (1.0 - value_proportion))
|
150
150
|
end
|
151
151
|
|
152
|
+
# utility for rotating around in a full circle and doing stuff
|
153
|
+
def turn iterations = nil, &proc
|
154
|
+
if iterations
|
155
|
+
raise "Iterations must be Numeric" unless iterations.is_a? Numeric
|
156
|
+
(0.0...360.0).step(360.0 / iterations, &proc)
|
157
|
+
else
|
158
|
+
0.0...360.0 # return a range which can be iterated however
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
152
162
|
# gets and sets resolution settings
|
153
163
|
def resolution **settings, &proc
|
154
164
|
warn "Setting fragments_per_turn and degrees_per_fragment together makes no sense!" if settings[:fragments_per_turn] && settings[:degrees_per_fragment]
|
@@ -5,16 +5,16 @@ class Oozby::Preprocessor
|
|
5
5
|
public
|
6
6
|
|
7
7
|
default_filters [:xyz, default: 0]
|
8
|
-
passthrough :rotate
|
9
|
-
passthrough :translate
|
10
|
-
passthrough :mirror
|
8
|
+
passthrough :rotate, :a, :v
|
9
|
+
passthrough :translate, :v
|
10
|
+
passthrough :mirror, :v
|
11
|
+
passthrough :resize, :newsize, :auto
|
11
12
|
default_filters [:xyz, default: 1]
|
12
|
-
passthrough :scale
|
13
|
-
passthrough :resize
|
13
|
+
passthrough :scale, :v
|
14
14
|
|
15
15
|
default_filters # none for these guys
|
16
|
-
passthrough :multmatrix
|
17
|
-
passthrough :color
|
16
|
+
passthrough :multmatrix, :m
|
17
|
+
passthrough :color, :c
|
18
18
|
|
19
19
|
default_filters :resolution, :layout_defaults, :expanded_names
|
20
20
|
|
@@ -37,9 +37,8 @@ class Oozby::Preprocessor
|
|
37
37
|
return call
|
38
38
|
end
|
39
39
|
|
40
|
-
passthrough :sphere
|
41
|
-
|
42
|
-
passthrough :polyhedron
|
40
|
+
passthrough :sphere, :r
|
41
|
+
passthrough :polyhedron, :points, :triangles, :convexity
|
43
42
|
# 2d shapes
|
44
43
|
|
45
44
|
# detect requests for rounded squares and transfer them over
|
@@ -51,8 +50,10 @@ class Oozby::Preprocessor
|
|
51
50
|
return call
|
52
51
|
end
|
53
52
|
|
54
|
-
|
55
|
-
passthrough :
|
53
|
+
filter :refuse_args, :h
|
54
|
+
passthrough :circle, :r
|
55
|
+
filter :refuse_args, :h
|
56
|
+
passthrough :polygon, :points, :paths
|
56
57
|
# extrude 2d shapes to 3d shapes
|
57
58
|
filter :expanded_names, height_label: :height
|
58
59
|
passthrough :linear_extrude
|
@@ -171,6 +172,7 @@ class Oozby::Preprocessor
|
|
171
172
|
[:radius2, :radius_2] => :r2,
|
172
173
|
[:facets, :fragments, :sides] => :"$fn",
|
173
174
|
[:inr, :inradius, :in_radius, :inner_r, :inner_radius] => :ir,
|
175
|
+
[:width] => :diameter,
|
174
176
|
[:height, :h] => height_label
|
175
177
|
)
|
176
178
|
|
@@ -266,7 +268,7 @@ class Oozby::Preprocessor
|
|
266
268
|
if call.named_args.keys.include? key
|
267
269
|
value = call.named_args[key]
|
268
270
|
if acceptable.none? { |accepts| accepts === value }
|
269
|
-
raise "#{
|
271
|
+
raise "#{@original_method}'s argument #{key} must be #{acceptable.inspect}"
|
270
272
|
end
|
271
273
|
end
|
272
274
|
end
|
@@ -277,10 +279,17 @@ class Oozby::Preprocessor
|
|
277
279
|
# Usage> filter :require_args, :first_arg, :second_arg
|
278
280
|
def require_args *list
|
279
281
|
list.each do |name|
|
280
|
-
raise "#{
|
282
|
+
raise "#{@original_method} requires argument #{name}" unless call.named_args.keys.include? name
|
281
283
|
end
|
282
284
|
end
|
283
285
|
|
286
|
+
# ban a list of arguments, to highlight mistakes like passing height to circle
|
287
|
+
# Usage> filter :refuse_args, :h
|
288
|
+
def refuse_args *list
|
289
|
+
list.each do |name|
|
290
|
+
raise "#{@original_method} doesn't support #{name}" if call.named_args.keys.include? name
|
291
|
+
end
|
292
|
+
end
|
284
293
|
|
285
294
|
def rounded_rectangle size: [1,1], center: false, corner_radius: 0.0, facets: nil
|
286
295
|
size = [size] * 2 if size.is_a? Numeric
|
data/lib/oozby/preprocessor.rb
CHANGED
@@ -26,11 +26,6 @@ class Oozby::Preprocessor
|
|
26
26
|
super
|
27
27
|
end
|
28
28
|
|
29
|
-
# def passthrough method_name
|
30
|
-
# @@method_filters[method_name] = @@queued_filters
|
31
|
-
# @@queued_filters = @@default_filters.dup
|
32
|
-
# end
|
33
|
-
|
34
29
|
def finalize_filter method_name
|
35
30
|
@@method_filters[method_name] = @@queued_filters
|
36
31
|
@@queued_filters = @@default_filters.dup
|
@@ -83,7 +78,7 @@ class Oozby::Preprocessor
|
|
83
78
|
def transform_call call_info
|
84
79
|
raise "call info isn't Oozby::Element #{call_info.inspect}" unless call_info.is_a? Oozby::Element
|
85
80
|
@call = call_info
|
86
|
-
original_method = @call.method
|
81
|
+
@original_method = @call.method
|
87
82
|
|
88
83
|
run_filters call_info.method.to_sym
|
89
84
|
|
@@ -98,7 +93,7 @@ class Oozby::Preprocessor
|
|
98
93
|
# replace called item with this new stuff
|
99
94
|
return result
|
100
95
|
elsif result != nil # ignore nil - we don't need to do anything for that!
|
101
|
-
raise "#{original_method} preprocessor returned invalid result #{result.inspect}"
|
96
|
+
raise "#{@original_method} preprocessor returned invalid result #{result.inspect}"
|
102
97
|
end
|
103
98
|
end
|
104
99
|
|
@@ -173,7 +168,11 @@ class Oozby::Preprocessor
|
|
173
168
|
env.preprocessor(false) {
|
174
169
|
env._execute_oozby(&proc)
|
175
170
|
}
|
176
|
-
}).find { |x|
|
171
|
+
}).find { |x|
|
172
|
+
x.is_a? Oozby::Element
|
173
|
+
}.tap { |x|
|
174
|
+
x.modifier = "#{call.modifier}#{x.modifier}" if call.modifier
|
175
|
+
}
|
177
176
|
end
|
178
177
|
|
179
178
|
# remember list of public methods defined so far - these are system ones
|
data/lib/oozby/version.rb
CHANGED
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oozby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bluebie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: listen
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "<"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "<"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: thor
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.18.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.18.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: amatch
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.2.11
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.2.11
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: colored
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.2'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.2'
|
69
69
|
description: OpenSCAD - a cad language for creating solid 3d objects, useful for CNC
|
@@ -90,24 +90,24 @@ files:
|
|
90
90
|
- license.txt
|
91
91
|
- examples/using classes/demo-class.rb
|
92
92
|
- bin/oozby
|
93
|
-
homepage: http://
|
93
|
+
homepage: http://creativepony.com/oozby/
|
94
94
|
licenses:
|
95
95
|
- LGPL-3
|
96
96
|
metadata: {}
|
97
97
|
post_install_message:
|
98
98
|
rdoc_options:
|
99
|
-
- --main
|
99
|
+
- "--main"
|
100
100
|
- lib/oozby/base.rb
|
101
101
|
require_paths:
|
102
102
|
- lib
|
103
103
|
required_ruby_version: !ruby/object:Gem::Requirement
|
104
104
|
requirements:
|
105
|
-
- -
|
105
|
+
- - ">="
|
106
106
|
- !ruby/object:Gem::Version
|
107
107
|
version: 2.0.0
|
108
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- -
|
110
|
+
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '0'
|
113
113
|
requirements: []
|