Class: JennCad::Extras::Iso7380

Inherits:
Hardware
  • Object
show all
Defined in:
lib/jenncad/extras/iso7380.rb

Instance Attribute Summary collapse

Attributes inherited from Hardware

#z_fight

Instance Method Summary collapse

Methods inherited from Hardware

#option_string

Constructor Details

#initialize(size, length, args = {}) ⇒ Iso7380

Returns a new instance of Iso7380.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/jenncad/extras/iso7380.rb', line 5

def initialize(size,length,args={})
	super(args)
    @args = args
	# options for output only:
	@args[:additional_length] ||= 0
	@args[:additional_diameter] ||= 0.3
	@args[:head_margin] ||= 0.0

#	if @args[:washer] == true
#		@washer = Washer.new(size,{:material => @args[:material], :surface => @args[:surface]})
#	end

	@size = size
	@length = length
	@transformations ||= []
end

Instance Attribute Details

#heightObject

Returns the value of attribute height.



3
4
5
# File 'lib/jenncad/extras/iso7380.rb', line 3

def height
  @height
end

Instance Method Details

#bolt_7380(additional_length = 0, addtional_diameter = 0, head_margin = 0) ⇒ Object

ISO 7380



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/jenncad/extras/iso7380.rb', line 38

def bolt_7380(additional_length=0, addtional_diameter=0, head_margin=0)
  if head_margin.to_d != 0
	puts "[warning] :head_margin is not implemented for 7380 bolts"
end
chart_iso7380 = {
                  3 => {head_dia:5.7,head_length:1.65},
                  4 => {head_dia:7.6,head_length:2.2},
                  5 => {head_dia:9.5,head_length:2.75},
                  6 => {head_dia:10.5,head_length:3.3},
                  8 => {head_dia:14,head_length:4.4},
                  10=> {head_dia:17.5,head_length:5.5},
                  12=> {head_dia:21,head_length:6.6},


  }
	res = cylinder(d1:chart_iso7380[@size][:head_dia]/2.0,d2:chart_iso7380[@size][:head_dia],h:chart_iso7380[@size][:head_length]).move(z:-chart_iso7380[@size][:head_length])
   total_length = @length + additional_length
   res+= cylinder(d:@size+addtional_diameter, h:total_length)
end

#cutObject



22
23
24
25
# File 'lib/jenncad/extras/iso7380.rb', line 22

def cut
  res = bolt_7380(@args[:additional_length], @args[:additional_diameter], @args[:head_margin])
 Aggregation.new("iso7380c#{@size}#{option_string}", res)
end

#showObject



27
28
29
30
31
32
33
34
35
# File 'lib/jenncad/extras/iso7380.rb', line 27

def show
			res = bolt_7380(0,0)
			#if @washer
			#	res += @washer.show
		#		res = res.move(z:-@washer.height)
	#		end
			res.color("DarkGray")
Aggregation.new("iso7380s#{@size}#{option_string}", res)
end