class CrystalScad::Hardware::TSlotMachining

Public Class Methods

new(args={}) click to toggle source
Calls superclass method CrystalScad::Hardware::TSlot::new
# File lib/crystalscad/Hardware.rb, line 485
def initialize(args={})                       
        super(args)
        @args[:holes] ||= "front,back" # nil, front, back
        @args[:bolt_size] ||= 8
        @args[:bolt_length] ||= 25
        puts "TSlotMachining is deprecated and will be removed in the 0.4.0 release."
end

Public Instance Methods

bolts() click to toggle source
# File lib/crystalscad/Hardware.rb, line 503
def bolts
        bolt = CrystalScadObject.new
        return bolt if @args[:holes] == nil

        if @args[:holes].include?("front")
                @args[:configuration].times do |c|                  
                        bolt+=Bolt.new(@args[:bolt_size],@args[:bolt_length]).output.rotate(y:90).translate(y:@args[:size]/2+c*@args[:size],z:@args[:size]/2)
                end
        end

        if @args[:holes].include?("back")
                @args[:configuration].times do |c|                  
                        bolt+=Bolt.new(@args[:bolt_size],@args[:bolt_length]).output.rotate(y:90).translate(y:@args[:size]/2+c*@args[:size],z:@args[:length]-@args[:size]/2)
                end
        end

        bolt
end
description() click to toggle source
# File lib/crystalscad/Hardware.rb, line 522
def description
        str = "T-Slot #{@args[:size]}x#{@args[:size]*@args[:configuration]}, length #{@args[:length]}mm"
        if @args[:holes] != nil
                str << " with holes for M#{@args[:bolt_size]} on "+ @args[:holes].split(",").join(' and ')
        end
end
output(length=nil) click to toggle source
# File lib/crystalscad/Hardware.rb, line 495
def output(length=nil)
        tslot_output(length)-bolts()         
end
Also aliased as: tslot_output
show(length=nil) click to toggle source
# File lib/crystalscad/Hardware.rb, line 499
def show(length=nil)
        output(length)+bolts
end
tslot_output(length=nil)
Alias for: output