crystalscad 0.3.3 → 0.3.4

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/examples/gear.rb ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/ruby1.9.3
2
+ require "rubygems"
3
+ require "crystalscad"
4
+ include CrystalScad
5
+
6
+
7
+
8
+
9
+
10
+ g1 = Gear.new(module:0.5,teeth:80,bore:5,height:4)
11
+ g2 = Gear.new(module:0.5,teeth:14,bore:5,height:8)
12
+
13
+ puts g1.distance_to(g2)
14
+ #puts g1.show.scad_output
15
+
@@ -20,13 +20,15 @@ module CrystalScad::Gears
20
20
  # this library is to be used to easily work with gears and their distances to each other
21
21
  # TODO: maybe at some point port the publicDomainGear.scad into it?
22
22
 
23
- attr_reader :module, :teeth
23
+ attr_reader :module, :teeth, :height, :hub_dia, :hub_height
24
24
 
25
25
  def initialize(args={})
26
26
  @module = args[:module] || 1.0
27
27
  @teeth = args[:teeth] || 1.0
28
28
  @bore = args[:bore] || 0.0
29
29
  @height = args[:height] || 3.0
30
+ @hub_dia = args[:hub_dia] || 0.0
31
+ @hub_height = args[:hub_height] || 0.0
30
32
  end
31
33
 
32
34
  def show
@@ -36,10 +38,15 @@ module CrystalScad::Gears
36
38
  # very simple output
37
39
  def output
38
40
  res = cylinder(d:@module*@teeth,h:@height)
39
- if @bore.to_f > 0.0
40
- res -= cylinder(d:@bore,h:@height+0.2).translate(z:-0.1)
41
+
42
+ if @hub_height.to_f > 0 && @hub_dia.to_f > 0
43
+ res += cylinder(d:@hub_dia,h:@hub_height).translate(z:@height)
44
+ end
45
+
46
+ if @bore.to_f > 0.0
47
+ res -= cylinder(d:@bore,h:@height+@hub_height+0.2).translate(z:-0.1)
41
48
  end
42
- res
49
+ res.color("darkgray")
43
50
  end
44
51
 
45
52
  def distance_to(other_gear)
@@ -1,4 +1,4 @@
1
1
  module CrystalScad
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
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: 21
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 3
10
- version: 0.3.3
9
+ - 4
10
+ version: 0.3.4
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: 2013-12-23 00:00:00 +01:00
19
- default_executable:
18
+ date: 2013-12-24 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: rubyscad
@@ -63,6 +62,7 @@ files:
63
62
  - README.md
64
63
  - Rakefile
65
64
  - crystalscad.gemspec
65
+ - examples/gear.rb
66
66
  - examples/stack.rb
67
67
  - lib/crystalscad.rb
68
68
  - lib/crystalscad/Assembly.rb
@@ -75,7 +75,6 @@ files:
75
75
  - skeleton_project/assemblies/example.rb
76
76
  - skeleton_project/observe.sh
77
77
  - skeleton_project/skeleton.rb
78
- has_rdoc: true
79
78
  homepage: http://github.com/Joaz/CrystalScad
80
79
  licenses:
81
80
  - GPL-3
@@ -107,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
106
  requirements: []
108
107
 
109
108
  rubyforge_project:
110
- rubygems_version: 1.6.2
109
+ rubygems_version: 1.8.15
111
110
  signing_key:
112
111
  specification_version: 3
113
112
  summary: CrystalScad is a framework for programming OpenScad models in Ruby