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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e77957381ff8c5d69c62508dad6309d647b56377085319443b6938c2bf88ce2
4
- data.tar.gz: 0f1893fcea231e2009fc6a3b5f6224483e413e648f7681d6ae0e85be64bba92e
3
+ metadata.gz: ceeccb1511db4a12b24c38116c2daa1835f9a64f3c62fe8446feea6712c9f200
4
+ data.tar.gz: 5b25c737ac0ba61039f7a54d8810a6fd94f2057ca2c482027683105adc767e54
5
5
  SHA512:
6
- metadata.gz: '047058746e5a8bb3c44995c5ea21edf308272844722f02820300de08493bfc24bec0cd74e26c4343d9fe2ffe514f9c8c57a3ba0981c871c0b161f18705099652'
7
- data.tar.gz: 724cbde8c1efa685b3762b7a51c27efd0812a8839d7147e832bede775a695b9e05af0dfbc996b139c531b5f78af26e6560a27efc99024fbbda54f8cf2835e3ef
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
- OpenScadObject.new(cmd, args, children)
190
+ modifier = part.openscad_modifier || nil
191
+ OpenScadObject.new(cmd, args, children, modifier)
189
192
  end
190
193
  end
191
194
  end
@@ -39,7 +39,7 @@ module JennCad
39
39
  end
40
40
 
41
41
  def stl(file, args={})
42
- StlImport.new(file, args)
42
+ StlImport.new(file, args).set_parent(self)
43
43
  end
44
44
 
45
45
  def extrude(args={})
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)
@@ -1,4 +1,4 @@
1
1
  module JennCad
2
- VERSION = "1.0.0-alpha11"
2
+ VERSION = "1.0.0-alpha12"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jenncad
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.alpha11
4
+ version: 1.0.0.pre.alpha12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jennifer Glauche