crystalscad 0.3.11 → 0.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -7,9 +7,10 @@ Installation:
7
7
  ===========
8
8
  Dependencies:
9
9
  - Ruby 1.9.3
10
- - inotifywait
11
10
  - gem rubyscad
12
11
  - gem requireall
12
+ - gem observr (optional)
13
+
13
14
 
14
15
  Install via gem:
15
16
 
data/examples/threads2.rb CHANGED
@@ -79,7 +79,6 @@ pos = male.threads_bottom.first.position_on(female.threads_top.first,rotation)
79
79
  res += female.show.rotate(rotation).mirror(z:1).translate(pos)
80
80
 
81
81
 
82
-
83
82
  rotation = {y:-90}
84
83
  pos = male.threads_left.first.position_on(female.threads_top.first,rotation)
85
84
  res += female.show.rotate(rotation).translate(pos)
@@ -26,6 +26,7 @@ module CrystalScad::Hardware
26
26
  # options for output only:
27
27
  @args[:additional_length] ||= 0
28
28
  @args[:additional_diameter] ||= 0.3
29
+ @args[:head_margin] ||= 0.0
29
30
 
30
31
  if @args[:washer] == true
31
32
  @washer = Washer.new(size,{:material => @args[:material], :surface => @args[:surface]})
@@ -38,7 +39,7 @@ module CrystalScad::Hardware
38
39
 
39
40
  def description
40
41
  norm = ""
41
- if ["912"].include? @args[:type]
42
+ if ["912","933"].include? @args[:type]
42
43
  norm = "DIN"
43
44
  elsif ["7380"].include? @args[:type]
44
45
  norm = "ISO"
@@ -49,16 +50,33 @@ module CrystalScad::Hardware
49
50
 
50
51
  def output
51
52
  add_to_bom
52
- return transform(bolt_912(@args[:additional_length],@args[:additional_diameter])) if @args[:type] == "912"
53
- return transform(bolt_7380(@args[:additional_length],@args[:additional_diameter])) if @args[:type] == "7380"
53
+ case @args[:type].to_s
54
+ when "912"
55
+ res = bolt_912(@args[:additional_length], @args[:additional_diameter])
56
+ when "933"
57
+ res = bolt_933(@args[:additional_length], @args[:additional_diameter], @args[:head_margin])
58
+ when "7380"
59
+ res = bolt_7380(@args[:additional_length], @args[:additional_diameter])
60
+ else
61
+ raise "unkown type #{args[:type]} for Bolt!"
62
+ end
63
+
64
+ return transform(res)
54
65
  end
55
66
 
56
67
  def show
57
68
  add_to_bom
58
- res = bolt_912(0,0) if @args[:type] == "912"
59
- res = bolt_7380(0,0) if @args[:type] == "7380"
60
- raise "unkown type #{args[:type]} for Bolt!" if res == nil
61
-
69
+ case @args[:type].to_s
70
+ when "912"
71
+ res = bolt_912(0,0)
72
+ when "933"
73
+ res = bolt_933(0,0)
74
+ when "7380"
75
+ res = bolt_7380(0,0)
76
+ else
77
+ raise "unkown type #{args[:type]} for Bolt!"
78
+ end
79
+
62
80
  if @washer
63
81
  res += @washer.show
64
82
  res = res.translate(z:-@washer.height)
@@ -131,7 +149,28 @@ module CrystalScad::Hardware
131
149
  end
132
150
  res
133
151
  end
134
-
152
+
153
+ def bolt_933(additional_length=0, addtional_diameter=0, head_margin=0)
154
+
155
+ chart = {2 => {head_side_to_side:4,head_length:1.4},
156
+ 2.5=> {head_side_to_side:5,head_length:1.7},
157
+ 3 => {head_side_to_side:5.5,head_length:2},
158
+ 4 => {head_side_to_side:7,head_length:2.8},
159
+ 5 => {head_side_to_side:8,head_length:3.5},
160
+ 6 => {head_side_to_side:10,head_length:4},
161
+ 8 => {head_side_to_side:13,head_length:5.5},
162
+ 10=> {head_side_to_side:17,head_length:7},
163
+ 12=> {head_side_to_side:19,head_length:8},
164
+ 14=> {head_side_to_side:22,head_length:9},
165
+ 16=> {head_side_to_side:24,head_length:10},
166
+ }
167
+ head_dia = chart[@size][:head_side_to_side].to_f + head_margin.to_f
168
+ res = cylinder(d:(head_dia/Math.sqrt(3))*2,fn:6,h:chart[@size][:head_length]).translate(z:-chart[@size][:head_length]).color("Gainsboro")
169
+ total_length = @length + additional_length
170
+ res+= cylinder(d:@size+addtional_diameter, h:total_length).color("DarkGray")
171
+
172
+ end
173
+
135
174
  end
136
175
 
137
176
  class Washer < CrystalScad::Assembly
@@ -1,4 +1,4 @@
1
1
  module CrystalScad
2
- VERSION = "0.3.11"
2
+ VERSION = "0.3.12"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crystalscad
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 11
10
- version: 0.3.11
9
+ - 12
10
+ version: 0.3.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joachim Glauche
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2014-01-27 00:00:00 +01:00
19
- default_executable:
18
+ date: 2014-02-06 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: rubyscad
@@ -86,7 +85,6 @@ files:
86
85
  - skeleton_project/assemblies/example.rb
87
86
  - skeleton_project/observe.sh
88
87
  - skeleton_project/skeleton.rb
89
- has_rdoc: true
90
88
  homepage: http://github.com/Joaz/CrystalScad
91
89
  licenses:
92
90
  - GPL-3
@@ -118,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
116
  requirements: []
119
117
 
120
118
  rubyforge_project:
121
- rubygems_version: 1.6.2
119
+ rubygems_version: 1.8.15
122
120
  signing_key:
123
121
  specification_version: 3
124
122
  summary: CrystalScad is a framework for programming OpenScad models in Ruby