class CrystalScad::Import

Public Class Methods

new(args) click to toggle source
# File lib/crystalscad/CrystalScad.rb, line 416
def initialize(args)
        @transformations = []
        @children = []                       

        if args.kind_of? String
          filename = args
        else # assume hash otherwise
          filename = args[:file]
          @layer = args[:layer]
        end                  
        
        
        # we need to convert relative to absolute paths if the openscad output is not in the same directory
        # as the crystalscad program.
        @filename = File.expand_path(filename)               
end

Public Instance Methods

to_rubyscad() click to toggle source
# File lib/crystalscad/CrystalScad.rb, line 433
def to_rubyscad       
  layer = ""
  if @layer
    layer = ",layer=\"#{@layer}\""
  end
        res = self.children.map{|l| l.walk_tree}
        if res == []
                res = ""
        end
        res += RubyScadBridge.new.import("file=\""+@filename.to_s+"\"#{layer}") # apparently the quotes get lost otherwise
        res          
end