crystalscad 0.6.5 → 0.6.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 287d067c580abbd3c12857eaf2d24f4b2c0c3195
4
- data.tar.gz: d1b32c216e29a883f4f76ddf7ce4434735305e5d
3
+ metadata.gz: acc0be6258406fcd9ce18f27bcdfa1f7d3b58878
4
+ data.tar.gz: 7f6fe119c519dc95483a5dad60c72aca8fcbaf86
5
5
  SHA512:
6
- metadata.gz: 18f560c3ed30377de9236824876ab974ae54f4ddb386527152c975a81830e24fd43845b25d47c4c3504c85b04121fa154b5cc1ee639416addd5a0f302afbdcf8
7
- data.tar.gz: 4ea021b28a6b058881c763649e0cf8b147823032db76b94ea2dca66d3d03faa54b4e1344434227fdd79ccc9d4d42455e5b8d9e95c72fe8b423030df156752f7a
6
+ metadata.gz: 2a044145935cb14d98890d87833a350a24009c288ea0bf36dbce2676e070d46433fcf3bcaedf661a5225315247670546fd9b5e7e7fdb70b319579baf16270428
7
+ data.tar.gz: c4c87cddd1ddae6809b49e6e5fb8121609ce20340200148062bc6c61779a441bdc741195d1e225731f7491e1de1704ec595830703ff1b6f86e95e58eae73a9c8
data/crystalscad.gemspec CHANGED
@@ -7,9 +7,9 @@ require "crystalscad/version"
7
7
  Gem::Specification.new do |gem|
8
8
  gem.name = "crystalscad"
9
9
  gem.version = CrystalScad::VERSION
10
- gem.authors = ["Joachim Glauche"]
11
- gem.email = ["webmaster@joaz.de"]
12
- gem.homepage = "http://github.com/Joaz/CrystalScad"
10
+ gem.authors = ["Jennifer Glauche"]
11
+ gem.email = ["mail@crystalscad.jglauche.de"]
12
+ gem.homepage = "http://github.com/jglauche/CrystalScad"
13
13
  gem.summary = %q{CrystalScad is a framework for programming OpenScad models in Ruby}
14
14
  gem.description = %q{Inspired by SolidPython, based on RubyScad}
15
15
 
data/examples/pipe_bug.rb CHANGED
@@ -4,7 +4,7 @@ require "crystalscad"
4
4
  include CrystalScad
5
5
 
6
6
  # Used to debug
7
- # https://github.com/Joaz/CrystalScad/issues/5
7
+ # https://github.com/jglauche/CrystalScad/issues/5
8
8
 
9
9
  pipe = Pipe.new(diameter:10)
10
10
 
data/examples/text.rb ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/ruby1.9.3
2
+ require "rubygems"
3
+ require "crystalscad"
4
+ include CrystalScad
5
+
6
+ string = "CrystalScad!"
7
+
8
+ res = text(text: string)
9
+ res += text(text: string, size: 3).translate(y: 10)
10
+ res += text(text: string, spacing: 0.75).translate(y: 20)
11
+ res.save("text.scad")
@@ -256,8 +256,28 @@ module CrystalScad
256
256
  class AdvancedPrimitive < Primitive
257
257
 
258
258
 
259
+ NUMERIC_ATTRIBUTES = []
260
+
261
+ def self.numeric_attributes(*attribute_names)
262
+ Array(attribute_names).flatten.each do |attrbute_name|
263
+ NUMERIC_ATTRIBUTES << attrbute_name.to_sym
264
+ end
265
+ end
266
+
267
+ class <<self
268
+ alias_method :numeric_attribute, :numeric_attributes
269
+ end
270
+
259
271
  def initialize(attributes)
260
- @attr = attributes.collect { |k, v| "#{k} = \"#{v}\"" }.join(', ')
272
+ @attr = attributes.collect { |k, v|
273
+ value_output = if NUMERIC_ATTRIBUTES.include?(k.to_sym)
274
+ v.to_f
275
+ else
276
+ "\"#{v}\""
277
+ end
278
+
279
+ "#{k} = #{value_output}"
280
+ }.join(', ')
261
281
  super
262
282
  end
263
283
 
@@ -269,6 +289,7 @@ module CrystalScad
269
289
 
270
290
 
271
291
  class Text < AdvancedPrimitive
292
+ numeric_attributes :size, :spacing
272
293
  def initialize(attributes)
273
294
  @operation = "text"
274
295
  super(attributes)
@@ -54,11 +54,11 @@ module CrystalScad::Hardware
54
54
  add_to_bom
55
55
  case @args[:type].to_s
56
56
  when "912"
57
- res = bolt_912(@args[:additional_length], @args[:additional_diameter])
57
+ res = bolt_912(@args[:additional_length], @args[:additional_diameter], @args[:head_margin])
58
58
  when "933"
59
59
  res = bolt_933(@args[:additional_length], @args[:additional_diameter], @args[:head_margin])
60
60
  when "7380"
61
- res = bolt_7380(@args[:additional_length], @args[:additional_diameter])
61
+ res = bolt_7380(@args[:additional_length], @args[:additional_diameter], @args[:head_margin])
62
62
  else
63
63
  raise "unkown type #{args[:type]} for Bolt!"
64
64
  end
@@ -89,8 +89,11 @@ module CrystalScad::Hardware
89
89
  end
90
90
 
91
91
  # ISO 7380
92
- def bolt_7380(additional_length=0, addtional_diameter=0)
93
- chart_iso7380 = {
92
+ def bolt_7380(additional_length=0, addtional_diameter=0, head_margin=0)
93
+ if head_margin.to_f != 0
94
+ puts "[warning] :head_margin is not implemented for 7380 bolts"
95
+ end
96
+ chart_iso7380 = {
94
97
  3 => {head_dia:5.7,head_length:1.65},
95
98
  4 => {head_dia:7.6,head_length:2.2},
96
99
  5 => {head_dia:9.5,head_length:2.75},
@@ -107,9 +110,8 @@ module CrystalScad::Hardware
107
110
  end
108
111
 
109
112
  # DIN 912
110
- def bolt_912(additional_length=0, addtional_diameter=0)
113
+ def bolt_912(additional_length=0, addtional_diameter=0, head_margin=0)
111
114
 
112
-
113
115
  chart_din912 = {2 => {head_dia:3.8,head_length:2,thread_length:16},
114
116
  2.5=> {head_dia:4.5,head_length:2.5,thread_length:17},
115
117
  3 => {head_dia:5.5,head_length:3,thread_length:18},
@@ -131,8 +133,7 @@ module CrystalScad::Hardware
131
133
 
132
134
  }
133
135
 
134
- res = cylinder(d:chart_din912[@size][:head_dia],h:chart_din912[@size][:head_length]).translate(z:-chart_din912[@size][:head_length]).color("Gainsboro")
135
-
136
+ res = cylinder(d:chart_din912[@size][:head_dia]+head_margin,h:chart_din912[@size][:head_length]).translate(z:-chart_din912[@size][:head_length]).color("Gainsboro")
136
137
  total_length = @length + additional_length
137
138
  thread_length=chart_din912[@size][:thread_length]
138
139
  if total_length.to_f <= thread_length
@@ -343,9 +344,9 @@ module CrystalScad::Hardware
343
344
  end
344
345
 
345
346
  def nut_934(show=true,margin=0,height_margin=0)
346
- @s += margin
347
+ size = @s + margin
347
348
 
348
- res = cylinder(d:(@s/Math.sqrt(3))*2,h:@height+height_margin,fn:6)
349
+ res = cylinder(d:(size/Math.sqrt(3))*2,h:@height+height_margin,fn:6)
349
350
  res -= cylinder(d:@size,h:@height) if show == true
350
351
  if @support
351
352
  res -= add_support
@@ -357,9 +358,8 @@ module CrystalScad::Hardware
357
358
 
358
359
 
359
360
  class TSlot < CrystalScad::Assembly
360
- # the code in this class is based on code by Nathan Zadoks
361
- # taken from https://github.com/nathan7/scadlib
362
- # Ported to CrystalScad by Joachim Glauche
361
+ # the code in this class is based on code by edef1c
362
+ # Ported to CrystalScad by Jennifer Glauche
363
363
  # License: GPLv3
364
364
  attr_accessor :args
365
365
  def initialize(args={})
@@ -1,4 +1,4 @@
1
1
  module CrystalScad
2
- VERSION = "0.6.5"
2
+ VERSION = "0.6.8"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crystalscad
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
- - Joachim Glauche
7
+ - Jennifer Glauche
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-26 00:00:00.000000000 Z
11
+ date: 2018-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyscad
@@ -68,7 +68,7 @@ dependencies:
68
68
  version: 1.0.5
69
69
  description: Inspired by SolidPython, based on RubyScad
70
70
  email:
71
- - webmaster@joaz.de
71
+ - mail@crystalscad.jglauche.de
72
72
  executables:
73
73
  - crystalgen
74
74
  extensions: []
@@ -95,6 +95,7 @@ files:
95
95
  - examples/printed_thread.rb
96
96
  - examples/printed_thread2.rb
97
97
  - examples/stack.rb
98
+ - examples/text.rb
98
99
  - examples/threads.rb
99
100
  - examples/threads2.rb
100
101
  - examples/threads3.rb
@@ -119,7 +120,7 @@ files:
119
120
  - skeleton_project/skeleton.rb
120
121
  - static/logo.png
121
122
  - static/logo_small.png
122
- homepage: http://github.com/Joaz/CrystalScad
123
+ homepage: http://github.com/jglauche/CrystalScad
123
124
  licenses:
124
125
  - GPL-3
125
126
  metadata: {}
@@ -139,8 +140,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
140
  version: '0'
140
141
  requirements: []
141
142
  rubyforge_project:
142
- rubygems_version: 2.5.1
143
+ rubygems_version: 2.6.13
143
144
  signing_key:
144
145
  specification_version: 4
145
146
  summary: CrystalScad is a framework for programming OpenScad models in Ruby
146
147
  test_files: []
148
+ has_rdoc: