crystalscad 0.3.10 → 0.3.11

Sign up to get free protection for your applications and to get access to all the features.
data/examples/threads2.rb CHANGED
@@ -79,6 +79,7 @@ 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
+
82
83
  rotation = {y:-90}
83
84
  pos = male.threads_left.first.position_on(female.threads_top.first,rotation)
84
85
  res += female.show.rotate(rotation).translate(pos)
@@ -201,9 +201,11 @@ module CrystalScad
201
201
  if args.kind_of? Array
202
202
  args = {size:args}
203
203
  elsif args.kind_of? Hash
204
- args[:x] ||= 0
205
- args[:y] ||= 0
206
- args = {size:[args[:x],args[:y]]}
204
+ unless args[:size]
205
+ args[:x] ||= 0
206
+ args[:y] ||= 0
207
+ args = {size:[args[:x],args[:y]]}
208
+ end
207
209
  end
208
210
  Square.new(args)
209
211
  end
@@ -334,10 +334,15 @@ module CrystalScad::Hardware
334
334
  else
335
335
  start=@args[:thickness].to_f/Math.sqrt(2);
336
336
 
337
- gap = @args[:gap]
338
- thickness = @args[:thickness]
337
+ gap = @args[:gap].to_f
338
+ thickness = @args[:thickness].to_f
339
339
  size= @args[:size]
340
- profile = square(size:gap+thickness,center:true);
340
+ square_size = gap+thickness
341
+ if square_size > 0
342
+ profile = square(size:square_size,center:true)
343
+ else
344
+ profile = nil
345
+ end
341
346
  (0..3).each{|d|
342
347
  profile+=polygon(points:[[0,0],[0,start],[size/2-thickness-start,size/2-thickness],[gap/2,size/2-thickness],[gap/2,size/2],[size/2,size/2],[size/2,gap/2],[size/2-thickness,gap/2],[size/2-thickness,size/2-thickness-start],[start,0]]).rotate(z:d*90)
343
348
  }
@@ -49,6 +49,10 @@ module CrystalScad::ScrewThreads
49
49
  cylinder(d:@size,h:@depth).rotate(rotation).translate(x:@x,y:@y,z:@z).color(r:130,g:130,b:130)
50
50
  end
51
51
 
52
+ def output
53
+ show
54
+ end
55
+
52
56
  def orientation_swap_to(coords,rotation)
53
57
  if rotation[:x].to_i == -90
54
58
  return [coords[0],coords[2],-coords[1]]
@@ -1,4 +1,4 @@
1
1
  module CrystalScad
2
- VERSION = "0.3.10"
2
+ VERSION = "0.3.11"
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: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 10
10
- version: 0.3.10
9
+ - 11
10
+ version: 0.3.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joachim Glauche
@@ -15,7 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2014-01-19 00:00:00 Z
18
+ date: 2014-01-27 00:00:00 +01:00
19
+ default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rubyscad
@@ -85,6 +86,7 @@ files:
85
86
  - skeleton_project/assemblies/example.rb
86
87
  - skeleton_project/observe.sh
87
88
  - skeleton_project/skeleton.rb
89
+ has_rdoc: true
88
90
  homepage: http://github.com/Joaz/CrystalScad
89
91
  licenses:
90
92
  - GPL-3
@@ -116,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
118
  requirements: []
117
119
 
118
120
  rubyforge_project:
119
- rubygems_version: 1.8.15
121
+ rubygems_version: 1.6.2
120
122
  signing_key:
121
123
  specification_version: 3
122
124
  summary: CrystalScad is a framework for programming OpenScad models in Ruby