Class: CrystalScad::Hardware::TSlotMachining

Inherits:
TSlot show all
Defined in:
lib/crystalscad/Hardware.rb

Instance Attribute Summary

Attributes inherited from TSlot

#args

Attributes inherited from Assembly

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

Attributes inherited from Primitive

#children

Attributes inherited from CrystalScadObject

#args, #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, #colorize, get_skip, get_views, #method_missing, #part, #scad_output, #show_hardware, skip, #threads, #transform, view, #walk_tree

Methods inherited from Primitive

#mirror, #rotate, #rotate_around, #scale, #transform, #translate, #union

Methods inherited from CrystalScadObject

#method_missing, #save, #to_rubyscad, #walk_tree, #walk_tree_classes

Constructor Details

#initialize(args = {}) ⇒ TSlotMachining

Returns a new instance of TSlotMachining.



485
486
487
488
489
490
491
# 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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CrystalScad::Assembly

Instance Method Details

#boltsObject



503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
# 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

#descriptionObject



522
523
524
525
526
527
# 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) ⇒ Object



495
496
497
# File 'lib/crystalscad/Hardware.rb', line 495

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

#show(length = nil) ⇒ Object



499
500
501
# File 'lib/crystalscad/Hardware.rb', line 499

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

#tslot_outputObject



493
# File 'lib/crystalscad/Hardware.rb', line 493

alias tslot_output output