class CrystalScad::CrystalScadObject

Attributes

args[RW]
transformations[RW]

Public Class Methods

new(*args) click to toggle source
# File lib/crystalscad/CrystalScadObject.rb, line 5
def initialize(*args)
        @transformations = []
        @args = args.flatten
        if @args[0].kind_of? Hash
                @args = @args[0]                    
        end          
end

Public Instance Methods

save(filename,start_text=nil) click to toggle source
# File lib/crystalscad/CrystalScadObject.rb, line 37
          def save(filename,start_text=nil)
file = File.open(filename,"w")
file.puts start_text unless start_text == nil
file.puts scad_output
file.close                
          end
scad_output()
Alias for: walk_tree
to_rubyscad() click to toggle source
# File lib/crystalscad/CrystalScadObject.rb, line 33
def to_rubyscad
        ""
end
walk_tree() click to toggle source
# File lib/crystalscad/CrystalScadObject.rb, line 13
def walk_tree
        res = ""                     
        
        @transformations.reverse.each{|trans|
                res += trans.walk_tree 
        }
        res += self.to_rubyscad.to_s+ "\n"
        res
end
Also aliased as: scad_output
walk_tree_classes() click to toggle source
# File lib/crystalscad/CrystalScadObject.rb, line 24
def walk_tree_classes
        res = []
        @transformations.reverse.each{|trans|
                res += trans.walk_tree_classes 
        }
        res << self.class
        res
end