class SolidRuby::Assemblies::TSlotMachining

Public Class Methods

new(args = {}) click to toggle source
Calls superclass method SolidRuby::Assemblies::TSlot::new
# File lib/solidruby/assemblies/tslot_machining.rb, line 18
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/solidruby/assemblies/tslot_machining.rb, line 36
def bolts
   bolt = SolidRubyObject.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/solidruby/assemblies/tslot_machining.rb, line 55
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/solidruby/assemblies/tslot_machining.rb, line 28
def output(length = nil)
   tslot_output(length) - bolts
end
Also aliased as: tslot_output
show(length = nil) click to toggle source
# File lib/solidruby/assemblies/tslot_machining.rb, line 32
def show(length = nil)
   output(length) + bolts
end
tslot_output(length = nil)
Alias for: output