crystalscad 0.3.2 → 0.3.3
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/lib/crystalscad/CrystalScad.rb +2 -1
- data/lib/crystalscad/Gears.rb +56 -0
- data/lib/crystalscad/version.rb +1 -1
- data/lib/crystalscad.rb +1 -0
- metadata +8 -5
| @@ -0,0 +1,56 @@ | |
| 1 | 
            +
            #    This file is part of CrystalScad.
         | 
| 2 | 
            +
            #
         | 
| 3 | 
            +
            #    CrystalScad is free software: you can redistribute it and/or modify
         | 
| 4 | 
            +
            #    it under the terms of the GNU General Public License as published by
         | 
| 5 | 
            +
            #    the Free Software Foundation, either version 3 of the License, or
         | 
| 6 | 
            +
            #    (at your option) any later version.
         | 
| 7 | 
            +
            #
         | 
| 8 | 
            +
            #    CrystalScad is distributed in the hope that it will be useful,
         | 
| 9 | 
            +
            #    but WITHOUT ANY WARRANTY; without even the implied warranty of
         | 
| 10 | 
            +
            #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
         | 
| 11 | 
            +
            #    GNU General Public License for more details.
         | 
| 12 | 
            +
            #
         | 
| 13 | 
            +
            #    You should have received a copy of the GNU General Public License
         | 
| 14 | 
            +
            #    along with CrystalScad.  If not, see <http://www.gnu.org/licenses/>.
         | 
| 15 | 
            +
             | 
| 16 | 
            +
             | 
| 17 | 
            +
            module CrystalScad::Gears
         | 
| 18 | 
            +
             | 
| 19 | 
            +
              class Gear < CrystalScad::Assembly
         | 
| 20 | 
            +
                # this library is to be used to easily work with gears and their distances to each other
         | 
| 21 | 
            +
                # TODO: maybe at some point port the publicDomainGear.scad into it?
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                attr_reader :module, :teeth
         | 
| 24 | 
            +
                
         | 
| 25 | 
            +
                def initialize(args={})
         | 
| 26 | 
            +
                  @module = args[:module] || 1.0
         | 
| 27 | 
            +
                  @teeth = args[:teeth] || 1.0
         | 
| 28 | 
            +
                  @bore = args[:bore] || 0.0
         | 
| 29 | 
            +
                  @height = args[:height] || 3.0
         | 
| 30 | 
            +
                end 
         | 
| 31 | 
            +
                
         | 
| 32 | 
            +
                def show
         | 
| 33 | 
            +
                  output
         | 
| 34 | 
            +
                end
         | 
| 35 | 
            +
                
         | 
| 36 | 
            +
                # very simple output
         | 
| 37 | 
            +
                def output
         | 
| 38 | 
            +
                  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 | 
            +
                  end
         | 
| 42 | 
            +
                  res
         | 
| 43 | 
            +
                end
         | 
| 44 | 
            +
                
         | 
| 45 | 
            +
                def distance_to(other_gear)
         | 
| 46 | 
            +
                  if @module != other_gear.module
         | 
| 47 | 
            +
                    raise "You cannot use two gears with different gear modules."
         | 
| 48 | 
            +
                    return
         | 
| 49 | 
            +
                  end
         | 
| 50 | 
            +
                  return (@module * (@teeth + other_gear.teeth))/2.0
         | 
| 51 | 
            +
                end
         | 
| 52 | 
            +
                
         | 
| 53 | 
            +
              end 
         | 
| 54 | 
            +
              
         | 
| 55 | 
            +
            end
         | 
| 56 | 
            +
             | 
    
        data/lib/crystalscad/version.rb
    CHANGED
    
    
    
        data/lib/crystalscad.rb
    CHANGED
    
    
    
        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:  | 
| 4 | 
            +
              hash: 21
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 0
         | 
| 8 8 | 
             
              - 3
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 0.3. | 
| 9 | 
            +
              - 3
         | 
| 10 | 
            +
              version: 0.3.3
         | 
| 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: 2013-12- | 
| 18 | 
            +
            date: 2013-12-23 00:00:00 +01:00
         | 
| 19 | 
            +
            default_executable: 
         | 
| 19 20 | 
             
            dependencies: 
         | 
| 20 21 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 21 22 | 
             
              name: rubyscad
         | 
| @@ -67,12 +68,14 @@ files: | |
| 67 68 | 
             
            - lib/crystalscad/Assembly.rb
         | 
| 68 69 | 
             
            - lib/crystalscad/BillOfMaterial.rb
         | 
| 69 70 | 
             
            - lib/crystalscad/CrystalScad.rb
         | 
| 71 | 
            +
            - lib/crystalscad/Gears.rb
         | 
| 70 72 | 
             
            - lib/crystalscad/Hardware.rb
         | 
| 71 73 | 
             
            - lib/crystalscad/LinearBearing.rb
         | 
| 72 74 | 
             
            - lib/crystalscad/version.rb
         | 
| 73 75 | 
             
            - skeleton_project/assemblies/example.rb
         | 
| 74 76 | 
             
            - skeleton_project/observe.sh
         | 
| 75 77 | 
             
            - skeleton_project/skeleton.rb
         | 
| 78 | 
            +
            has_rdoc: true
         | 
| 76 79 | 
             
            homepage: http://github.com/Joaz/CrystalScad
         | 
| 77 80 | 
             
            licenses: 
         | 
| 78 81 | 
             
            - GPL-3
         | 
| @@ -104,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 104 107 | 
             
            requirements: []
         | 
| 105 108 |  | 
| 106 109 | 
             
            rubyforge_project: 
         | 
| 107 | 
            -
            rubygems_version: 1. | 
| 110 | 
            +
            rubygems_version: 1.6.2
         | 
| 108 111 | 
             
            signing_key: 
         | 
| 109 112 | 
             
            specification_version: 3
         | 
| 110 113 | 
             
            summary: CrystalScad is a framework for programming OpenScad models in Ruby
         |