jenncad 1.0.0.pre.alpha11 → 1.0.0.pre.alpha12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jenncad/exporters/openscad.rb +8 -5
- data/lib/jenncad/shortcuts.rb +1 -1
- data/lib/jenncad/thing.rb +31 -0
- data/lib/jenncad/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ceeccb1511db4a12b24c38116c2daa1835f9a64f3c62fe8446feea6712c9f200
|
4
|
+
data.tar.gz: 5b25c737ac0ba61039f7a54d8810a6fd94f2057ca2c482027683105adc767e54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e509d98347b1a96093fb62ccea12c3e71733f3af4e946694286783e54958245b99373c9721b338bc4da17ddac531a7b215b8394364b4af31aa82c3be8a183cc0
|
7
|
+
data.tar.gz: 14ecaa2c0698e5fad95d311f373f2399f98eaa5b1e0220dce807053ce7ea0b505f879dce042006232cac8b6d25dd6e9c08eb1a713f78a09aba9c47c1e9bbdf08
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module JennCad::Exporters
|
2
2
|
class OpenScadObject
|
3
|
-
def initialize(cmd, args, children=[])
|
3
|
+
def initialize(cmd, args, children=[], modifier=nil)
|
4
4
|
@command = cmd
|
5
5
|
@args = args
|
6
|
+
@modifier = modifier || ""
|
7
|
+
|
6
8
|
case children
|
7
9
|
when Array
|
8
10
|
@children = children
|
@@ -43,11 +45,11 @@ module JennCad::Exporters
|
|
43
45
|
def handle_command(i=1)
|
44
46
|
case @children.size
|
45
47
|
when 0
|
46
|
-
"#{@command}(#{handle_args});"
|
48
|
+
"#{@modifier}#{@command}(#{handle_args});"
|
47
49
|
when 1
|
48
|
-
"#{@command}(#{handle_args})#{@children.first.handle_command(i+1)}"
|
50
|
+
"#{@modifier}#{@command}(#{handle_args})#{@children.first.handle_command(i+1)}"
|
49
51
|
when (1..)
|
50
|
-
res = "#{@command}(#{handle_args}){"
|
52
|
+
res = "#{@modifier}#{@command}(#{handle_args}){"
|
51
53
|
res += nl
|
52
54
|
inner = @children.map do |c|
|
53
55
|
next if c == nil
|
@@ -185,7 +187,8 @@ module JennCad::Exporters
|
|
185
187
|
def new_obj(part, cmd, args=nil, children=[])
|
186
188
|
transform(part) do
|
187
189
|
apply_color(part) do
|
188
|
-
|
190
|
+
modifier = part.openscad_modifier || nil
|
191
|
+
OpenScadObject.new(cmd, args, children, modifier)
|
189
192
|
end
|
190
193
|
end
|
191
194
|
end
|
data/lib/jenncad/shortcuts.rb
CHANGED
data/lib/jenncad/thing.rb
CHANGED
@@ -529,6 +529,37 @@ module JennCad
|
|
529
529
|
JennCad::Exporters::OpenScad.new(self).save(file)
|
530
530
|
end
|
531
531
|
|
532
|
+
def ghost
|
533
|
+
set_option :ghost, true
|
534
|
+
set_option :no_auto_color, true
|
535
|
+
set_option :color, nil
|
536
|
+
set_option :auto_color, false
|
537
|
+
self
|
538
|
+
end
|
539
|
+
|
540
|
+
def hide
|
541
|
+
set_option :hide, true
|
542
|
+
self
|
543
|
+
end
|
544
|
+
|
545
|
+
def only
|
546
|
+
set_option :only, true
|
547
|
+
self
|
548
|
+
end
|
549
|
+
|
550
|
+
def hl
|
551
|
+
set_option :highlight, true
|
552
|
+
self
|
553
|
+
end
|
554
|
+
|
555
|
+
def openscad_modifier
|
556
|
+
return "%" if option(:ghost)
|
557
|
+
return "#" if option(:highlight)
|
558
|
+
return "!" if option(:only)
|
559
|
+
return "*" if option(:hide)
|
560
|
+
nil
|
561
|
+
end
|
562
|
+
|
532
563
|
def referenced_z
|
533
564
|
return false if @z.to_f != 0.0
|
534
565
|
return option(:zref) if option(:zref)
|
data/lib/jenncad/version.rb
CHANGED