card_holder_generator 0.2.1 → 0.3.0

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: 473fc985c46e65ec2d1445ff2d88461ba33a7561
4
- data.tar.gz: 69d284a2b2b87876199555cd6b6eca0b208535fb
3
+ metadata.gz: 9a849b2d44cee9a607336e92cd8496ba81889067
4
+ data.tar.gz: b25a4cc41b1aa477f6efffcfe83f668d0a70f275
5
5
  SHA512:
6
- metadata.gz: 2b06e94d6c95cffa0f50da6c5c4538ba94308268ff264672517f5b5304dc556a19db9b3137a84b993b34c8d5ec21e791342d667f141b484e94d937418e844693
7
- data.tar.gz: a0a9974ff8e4d8b184ce4e2c657a9adf5016f78ac36870c78ec6a452e41a7e9dca249effe6fba960d20ddd8199ca7e380cd6f0f650ba0d0ca82a7bd1c0d52c13
6
+ metadata.gz: 957300443c639dc19949e60273dc53f70b471938fdd4bf714bf21b644478ffa2eeab2424d64895da0efaf605364cc0ecfa89102d8849c1c94d9f6da462560f02
7
+ data.tar.gz: 4837c620589455785a8da784a8dd69e44ee2208bd839f7a6dce9ea29404fcb9870484054e46adf43ceeb6695aa24a30d0385093f00a1663d4aaef26498f904b6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- card_holder_generator (0.2.0)
4
+ card_holder_generator (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -32,11 +32,13 @@ end
32
32
 
33
33
  settings = {}
34
34
 
35
- settings["external_walls_depth"] = ask_value("External walls depth", "Depth of the walls at both sides (left and right) of the cards holder.", 3)
36
- settings["floor_depth"] = ask_value("Floor depth", "Depth of the walls at both sides (left and right) of the cards holder.", 3)
35
+ settings["external_walls_depth"] = ask_value("External walls depth", "Depth of external walls of the cards holder.", 3)
36
+ settings["floor_depth"] = ask_value("Floor depth", "Depth of the floor.", 3)
37
37
  settings["top_margin"] = ask_value("Top margin", "Space on top of the cards up to reach the card holder top.", 3)
38
38
  settings["separators_width"] = ask_value("Separators width", "Amount of material that will hold each set of cards on each side (left and right).", 10)
39
39
  settings["separators_depth"] = ask_value("Separators depth", "Depth of the walls that separates each set of cards.", 3)
40
+ settings["magnets_height"] = ask_value("Magnets height", "Height of each magner at corners (leave blank if you don't want magnets).", 0)
41
+ settings["magnets_diameter"] = ask_value("Magnets diameter", "Diameter of each magner at corners (leave blank if you don't want magnets).", 0)
40
42
  settings["cards_width"] = ask_value("Cards width", "Width of each card including sleeves (this will be the height of the card holder hole without the top margin).")
41
43
  settings["cards_height"] = ask_value("Cards height", "Height of each card including sleeves (this will be the width of the card holder).")
42
44
 
@@ -18,6 +18,7 @@ difference() {
18
18
  #{main_cube}
19
19
  #{main_hole}
20
20
  #{gaps}
21
+ #{magnets if magnets?}
21
22
  }
22
23
  SCAD
23
24
  end
@@ -33,6 +34,8 @@ private
33
34
  cards_width
34
35
  cards_height
35
36
  gap_depths
37
+ magnets_height
38
+ magnets_diameter
36
39
  ).each do |setting_name|
37
40
  define_method(setting_name) do
38
41
  settings[setting_name]
@@ -44,7 +47,7 @@ private
44
47
  end
45
48
 
46
49
  def external_y
47
- gap_depths.inject(&:+) + (gap_depths.size + 1) * separators_depth
50
+ external_walls_depth * 2 + gap_depths.inject(&:+) + (gap_depths.size - 1) * separators_depth
48
51
  end
49
52
 
50
53
  def external_z
@@ -77,7 +80,7 @@ module roundedcube(xdim, ydim, zdim, rdim) {
77
80
 
78
81
  def main_hole
79
82
  <<-MAINHOLE
80
- translate([#{external_walls_depth + separators_width}, #{separators_depth}, #{floor_depth}]) mirror([0, 1, 0]) rotate([90, 0, 0]) roundedcube(#{cards_height - separators_width * 2}, #{external_z * 2}, #{external_y - 2 * separators_depth}, 10);
83
+ translate([#{external_walls_depth + separators_width}, #{external_walls_depth}, #{floor_depth}]) mirror([0, 1, 0]) rotate([90, 0, 0]) roundedcube(#{cards_height - separators_width * 2}, #{external_z * 2}, #{external_y - 2 * external_walls_depth}, 10);
81
84
  translate([#{external_walls_depth + separators_width}, 0, #{floor_depth + cards_width * 0.5}]) mirror([0, 1, 0]) rotate([90, 0, 0]) roundedcube(#{cards_height - separators_width * 2}, #{external_z * 2}, #{separators_width}, 10);
82
85
  translate([#{external_walls_depth + separators_width}, #{external_y - separators_width}, #{floor_depth + cards_width * 0.5}]) mirror([0, 1, 0]) rotate([90, 0, 0]) roundedcube(#{cards_height - separators_width * 2}, #{external_z * 2}, #{separators_width + 1}, 10);
83
86
  MAINHOLE
@@ -87,11 +90,22 @@ translate([#{external_walls_depth + separators_width}, #{external_y - separators
87
90
  gaps = ""
88
91
  gap_subtotal = 0
89
92
  gap_depths.each_with_index do |gap_depth, index|
90
- gaps += "translate([#{external_walls_depth}, #{separators_depth * (index + 1) + gap_subtotal}, #{floor_depth}]) cube([#{cards_height}, #{gap_depth}, #{external_z}]); "
91
- gaps += "translate([#{external_walls_depth + separators_width}, #{separators_depth * (index + 1) + gap_subtotal}, 0]) cube([#{cards_height - separators_width * 2}, #{gap_depth}, #{external_z}]); "
93
+ gaps += "translate([#{external_walls_depth}, #{external_walls_depth + separators_depth * index + gap_subtotal}, #{floor_depth}]) cube([#{cards_height}, #{gap_depth}, #{external_z}]); "
94
+ gaps += "translate([#{external_walls_depth + separators_width}, #{external_walls_depth + separators_depth * index + gap_subtotal}, 0]) cube([#{cards_height - separators_width * 2}, #{gap_depth}, #{external_z}]); "
92
95
  gap_subtotal += gap_depth
93
96
  end
94
97
  gaps
95
98
  end
96
99
 
100
+ def magnets
101
+ "translate([#{external_walls_depth / 2}, #{external_walls_depth / 2}, #{external_z - magnets_height + 1}]) cylinder(#{magnets_height}, d = #{magnets_diameter}, $fn = 100);" +
102
+ "translate([#{external_x - external_walls_depth / 2}, #{external_walls_depth / 2}, #{external_z - magnets_height + 1}]) cylinder(#{magnets_height}, d = #{magnets_diameter}, $fn = 100);" +
103
+ "translate([#{external_walls_depth / 2}, #{external_y - external_walls_depth / 2}, #{external_z - magnets_height + 1}]) cylinder(#{magnets_height}, d = #{magnets_diameter}, $fn = 100);" +
104
+ "translate([#{external_x - external_walls_depth / 2}, #{external_y - external_walls_depth / 2}, #{external_z - magnets_height + 1}]) cylinder(#{magnets_height}, d = #{magnets_diameter}, $fn = 100);"
105
+ end
106
+
107
+ def magnets?
108
+ magnets_height > 0 && magnets_diameter > 0
109
+ end
110
+
97
111
  end
@@ -1,3 +1,3 @@
1
1
  class CardHolderGenerator
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card_holder_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Paramio
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-15 00:00:00.000000000 Z
11
+ date: 2018-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler