Class: SolidRuby::Assemblies::TSlotMachining

Inherits:
TSlot show all
Defined in:
lib/solidruby/assemblies/tslot_machining.rb

Instance Attribute Summary

Attributes inherited from TSlot

#args

Attributes inherited from Assembly

#hardware, #skip, #transformations, #x, #y, #z

Attributes inherited from SolidRubyObject

#attributes, #children, #siblings, #transformations

Instance Method Summary collapse

Methods inherited from TSlot

#hole, #holes, #length, #multi_profile, #profile, #single_profile, #thread, #threads

Methods inherited from Assembly

#*, #+, #-, #add_to_bom, #color, #colorize, get_skip, get_views, #part, #scad_output, #show_hardware, skip, #threads, #transform, view, #walk_tree

Methods inherited from SolidRubyObject

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

Constructor Details

#initialize(args = {}) ⇒ TSlotMachining

Returns a new instance of TSlotMachining.



18
19
20
21
22
23
24
# 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

Instance Method Details

#boltsObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# 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

#descriptionObject



55
56
57
58
59
60
# 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) ⇒ Object



28
29
30
# File 'lib/solidruby/assemblies/tslot_machining.rb', line 28

def output(length = nil)
   tslot_output(length) - bolts
end

#show(length = nil) ⇒ Object



32
33
34
# File 'lib/solidruby/assemblies/tslot_machining.rb', line 32

def show(length = nil)
   output(length) + bolts
end

#tslot_outputObject



26
# File 'lib/solidruby/assemblies/tslot_machining.rb', line 26

alias tslot_output output