laser-cutter 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0bf2240e444d50e1c3a40bdeb269a0df9b09a2c3
4
- data.tar.gz: df226c09ee93f96b872f57d90e38b8abd4d15131
3
+ metadata.gz: 281b7861f4452cfb6323f9d2a4a05aff6db5a742
4
+ data.tar.gz: dd4e65121d84f8a285dd3c603d1674a5505af9f4
5
5
  SHA512:
6
- metadata.gz: 7aee00b014f159f2b2df9d0c23d2f91c3830116eb3c6f4b3bda34818a38603497c52a253103e162c4d4663f06db01b4ef3e14369e99f8db2945b3d4cbbb8cf12
7
- data.tar.gz: 2f1be7e7d1b78c182fb75b1e8597270aae29834a0401a3029d01027468249f600d3a7952afe179395b671296de045a31df86acb98ec219fd51de6120f4917f3e
6
+ metadata.gz: d42068728244eb2d1125a9f3e759d5c00e1623a15f29e0eede7deb4eb3a5711f717434f81d2c99fd400d346e3e9b6832e47cb932830171b55cc9fa551f0d979a
7
+ data.tar.gz: 65ab7c551ef9f144dc8f91e9898d526e60ac42246c779cb9d480aea6d2f3e36e44514ccc3ff7ff802bdf30097d34d3127adc4a928ec9fa9bb78317302d0bb104
data/README.md CHANGED
@@ -12,22 +12,36 @@ and calculating locations. This welcomes additional feature contributions from o
12
12
  as existing test suite offers confidence around not introducing bugs or regressions.
13
13
 
14
14
  BoxMaker's algorithm _ensures that the same notch length is across all sides, but sacrifices
15
- symmetry as a result_. So you may have your font panel's left and right sides be pretty different.
15
+ symmetry as a result_. So you may have a front panel's left and right edges be simply non symmetric.
16
+ And that might be entirely OK with you :)
16
17
 
17
18
  ```laser-cutter```'s algorithm will create a _symmetric design for most panels_, but it might sacrifice
18
- identical notch length_. Depending on the box dimensions you may end up with a slightly different notch
19
+ identical notch length. Depending on the box dimensions you may end up with a slightly different notch
19
20
  length on each side of the box.
20
21
 
21
- Finally, ```laser-cutter``` has a ton of options, that allow you to set stroke width, page size,
22
+ Having said that, one of the design goals of this ruby version is to provide a highly extensible platform,
23
+ where alternative algorithms can be implemented and supported by command line options.
24
+
25
+ ```laser-cutter``` has quite a few options that allow you to set stroke width, page size,
22
26
  layout, margins, padding (spacing between boxes), open the PDF file using system viewer right
23
- after generation, and many more are coming.
27
+ after generation, and many more are coming soon.
24
28
 
25
29
  The choice ultimately comes down to the preference and feature set, so here I show you two boxes made with
26
- each program, so you can pick what you prefer.
30
+ each program, so you can pick what you prefer.
31
+
32
+ #### Disclaimer
33
+
34
+ Important quick note that the author believes that BoxMaker is a greatly useful piece of software
35
+ generously open sourced by the author, and so in no way this project disputes it's viability.
36
+ In fact BoxMaker was an inspiration for this project. This project simply attempts to advance
37
+ further and provide additional solutions to this complex problem of creating 3D designs on a 2D
38
+ surface using laser cutter.
39
+
40
+ ### Example Outputs
27
41
 
28
42
  Below are two examples of boxes with identical dimensions produced with ```laser-cutter``` and ```boxmaker```:
29
43
 
30
- #### BoxMaker Example
44
+ #### BoxMaker
31
45
 
32
46
  ```bash
33
47
  > java -cp BOX.jar com.rahulbotics.boxmaker.BoxMaker -i -W 2.5 -H 2 -D 1 -T 0.25 -n 0.5 -f file.pdf
@@ -35,7 +49,7 @@ Below are two examples of boxes with identical dimensions produced with ```laser
35
49
 
36
50
  ![BoxMaker Example](doc/boxmaker.jpg).
37
51
 
38
- #### LaserCutter Example
52
+ #### LaserCutter
39
53
 
40
54
  ```bash
41
55
  > laser-cutter -u in -s 2.5x1x2/0.25/0.5 -o file.pdf
@@ -45,8 +59,9 @@ Below are two examples of boxes with identical dimensions produced with ```laser
45
59
 
46
60
  ## Future Features
47
61
 
48
- * Creating T-style holes and spacers for various sized nuts and bolts (such as common #4-40 and M2)
49
- * Creating lids and front panels that are larger than the box
62
+ * Creating T-style joins, using various sized nuts and bolts (such as common #4-40 and M2 sizes)
63
+ * Creating lids and front panels that are larger than the box
64
+ * Rendering to CSS to show live preview on a web app
50
65
  * Your brilliant idea can be here! Please see [contributing](CONTRIBUTING.md) for more info.
51
66
 
52
67
  ## Installation
@@ -66,11 +81,18 @@ Or install it yourself as:
66
81
  ## Usage
67
82
 
68
83
  ```bash
69
- > laser-cutter --help
70
- Usage: laser-cutter [options]'
84
+ Usage: laser-cutter [options]
85
+ laser-cutter --list-all-page-sizes --units in
86
+
87
+ Examples:
88
+ 1. Create a box defined in inches, and open PDF in preview right after:
89
+
90
+ laser-cutter --units in -s 3x2x2/0.125/0.5 -O -o box.pdf
91
+
92
+ 2. Create a box defined in millimeters, print verbose info and set
93
+ page size to A3, and layout to landscape, and stroke width to 2mm:
71
94
 
72
- eg: laser-cutter --units in -s 2x3x2/0.125/0.5 -o box.pdf'
73
- laser-cutter -w 30 -h 20 -d 10 -t 4.3 -n 10 -o box.pdf
95
+ laser-cutter -w70 -h20 -d50 -t4.3 -n5 -PA3 -L landscape -S 0.5 -v -O -o box.pdf
74
96
 
75
97
 
76
98
  Specific options:
@@ -86,10 +108,11 @@ Specific options:
86
108
  -u, --units UNITS Either 'mm' (default) or 'in'
87
109
  -m, --margin MARGIN Margins from the edge of the document
88
110
  -p, --padding PADDING Space between the boxes on the page
89
- -P, --page_size LETTER Page size, see docs on Prawn for more options
111
+ -P, --page_size LETTER Page size, see --list-all-page-sizes for more info.
90
112
  -L, --page_layout portrait Page layout, other option is 'landscape'
91
113
  -S, --stroke WIDTH Numeric stroke width of the line
92
114
  -O, --open Open generated file with system viewer before exiting
115
+ -A, --list-all-page-sizes Print all available page sizes with dimensions and exit
93
116
  -v, --[no-]verbose Run verbosely
94
117
 
95
118
  Common options:
data/bin/laser-cutter CHANGED
@@ -10,7 +10,8 @@ module Laser
10
10
  class OptParse
11
11
  def self.parse(args)
12
12
  banner_text = <<-EOF
13
- Usage: laser-cutter [options]'
13
+ Usage: laser-cutter [options]
14
+ laser-cutter --list-all-page-sizes --units in
14
15
 
15
16
  Examples:
16
17
  1. Create a box defined in inches, and open PDF in preview right after:
@@ -25,6 +26,7 @@ EOF
25
26
 
26
27
  options = Hashie::Mash.new
27
28
  options.verbose = false
29
+ options.units = 'mm'
28
30
 
29
31
  opt_parser = OptionParser.new do |opts|
30
32
  opts.banner = banner_text.cyan
@@ -48,11 +50,14 @@ EOF
48
50
  opts.on("-m", "--margin MARGIN", "Margins from the edge of the document") { |value| options.margin = value }
49
51
  opts.on("-p", "--padding PADDING", "Space between the boxes on the page") { |value| options.padding = value }
50
52
 
51
- opts.on("-P", "--page_size LETTER", "Page size, see docs on Prawn for more options") { |value| options.page_size = value }
53
+ opts.on("-P", "--page_size LETTER", "Page size, see --list-all-page-sizes for more info.") { |value| options.page_size = value }
52
54
  opts.on("-L", "--page_layout portrait", "Page layout, other option is 'landscape' ") { |value| options.page_layout = value }
53
55
  opts.on("-S", "--stroke WIDTH", "Numeric stroke width of the line") { |value| options.stroke = value }
54
56
 
55
57
  opts.on("-O", "--open", "Open generated file with system viewer before exiting") { |v| options.open = v }
58
+
59
+ opts.on("-A", "--list-all-page-sizes", "Print all available page sizes with dimensions and exit") { |v| options.list_all_page_sizes = true }
60
+
56
61
  opts.on("-v", "--[no-]verbose", "Run verbosely") { |v| options.verbose = v }
57
62
 
58
63
  opts.separator ""
@@ -80,6 +85,21 @@ EOF
80
85
  end # class OptParse
81
86
 
82
87
  options = Laser::Cutter::OptParse.parse(ARGV)
88
+
89
+ if options.list_all_page_sizes
90
+ puts
91
+ unit = 1.0 / 72.0 # PDF units per inch
92
+ multiplier = options.units == 'in' ? 1.0 : 25.4
93
+ hash = PDF::Core::PageGeometry::SIZES
94
+ hash.keys.sort.each do |k|
95
+ printf("\t%10s:\t%6.1f x %6.1f\n",
96
+ k,
97
+ multiplier * hash[k][0].to_f * unit,
98
+ multiplier * hash[k][1].to_f * unit )
99
+ end
100
+ exit 0
101
+ end
102
+
83
103
  config = Laser::Cutter::Configuration.new(options.to_hash)
84
104
 
85
105
  if options.verbose
@@ -1,5 +1,5 @@
1
1
  module Laser
2
2
  module Cutter
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: laser-cutter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Gredeskoul
@@ -180,3 +180,4 @@ test_files:
180
180
  - spec/rect_spec.rb
181
181
  - spec/renderer_spec.rb
182
182
  - spec/spec_helper.rb
183
+ has_rdoc: