Class: SolidRuby::CSGModelling::CSGModelling

Inherits:
SolidRubyObject show all
Defined in:
lib/solidruby/csg_modelling/csg_modelling.rb

Instance Attribute Summary

Attributes inherited from SolidRubyObject

#attributes, #children, #siblings, #transformations

Instance Method Summary collapse

Methods inherited from SolidRubyObject

#&, alias_attr, #debug, #debug?, #mirror, #place, #rotate, #rotate_around, #save, #scale, #translate, #union, #walk_tree, #walk_tree_classes

Constructor Details

#initialize(*list) ⇒ CSGModelling

Returns a new instance of CSGModelling.



18
19
20
21
22
23
# File 'lib/solidruby/csg_modelling/csg_modelling.rb', line 18

def initialize(*list)
  super(list)
  @transformations = []
  @children = list
  @operation = self.class.name.split('::').last.downcase
end

Instance Method Details

#get_point_on(args = {}) ⇒ Object



39
40
41
# File 'lib/solidruby/csg_modelling/csg_modelling.rb', line 39

def get_point_on(args = {})
  @children[0].get_point_on(args) if @children.count > 0
end

#to_rubyscadObject



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/solidruby/csg_modelling/csg_modelling.rb', line 25

def to_rubyscad
  @children ||= []
  ret = "#{@operation}(){"
  @children.each do |child|
    begin
      ret += child.walk_tree
    rescue NoMethodError
    end
  end
  # puts @children.map{|l| l.walk_tree_classes}.inspect

  ret += '}'
end