laser-cutter 0.2.2 → 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.
- data/.gitignore +0 -1
- data/CONTRIBUTING.md +117 -0
- data/README.md +46 -5
- data/doc/boxmaker.jpg +0 -0
- data/doc/laser-cutter.jpg +0 -0
- data/laser-cutter.gemspec +3 -3
- data/lib/laser-cutter/renderer/box_renderer.rb +1 -4
- data/lib/laser-cutter/renderer/line_renderer.rb +1 -3
- data/lib/laser-cutter/renderer/rect_renderer.rb +1 -3
- data/lib/laser-cutter/version.rb +1 -1
- metadata +11 -4
data/.gitignore
CHANGED
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Contributing to Laser-Cutter
|
|
2
|
+
======================
|
|
3
|
+
|
|
4
|
+
You're encouraged to submit [pull requests](https://github.com/kigster/laser-cutter/pulls), [propose features and discuss issues](https://github.com/kigster/laser-cutter/issues).
|
|
5
|
+
|
|
6
|
+
#### Fork the Project
|
|
7
|
+
|
|
8
|
+
Fork the [project on Github](https://github.com/kigster/laser-cutter) and check out your copy.
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
git clone https://github.com/contributor/laser-cutter.git
|
|
12
|
+
cd laser-cutter
|
|
13
|
+
git remote add upstream https://github.com/kigster/laser-cutter.git
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
#### Create a Topic Branch
|
|
17
|
+
|
|
18
|
+
Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
git checkout master
|
|
22
|
+
git pull upstream master
|
|
23
|
+
git checkout -b my-feature-branch
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
#### Bundle Install and Test
|
|
27
|
+
|
|
28
|
+
Ensure that you can build the project and run tests.
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
bundle install
|
|
32
|
+
bundle exec rake
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
#### Write Tests
|
|
36
|
+
|
|
37
|
+
Try to write a test that reproduces the problem you're trying to fix or describes a
|
|
38
|
+
feature that you want to build. Add to [spec/laser-cutter](spec/laser-cutter).
|
|
39
|
+
|
|
40
|
+
We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
|
|
41
|
+
|
|
42
|
+
#### Write Code
|
|
43
|
+
|
|
44
|
+
Implement your feature or bug fix.
|
|
45
|
+
|
|
46
|
+
Make sure that `bundle exec rspec` completes without errors.
|
|
47
|
+
|
|
48
|
+
#### Write Documentation
|
|
49
|
+
|
|
50
|
+
Document any external behavior in the [README](README.md).
|
|
51
|
+
|
|
52
|
+
#### Update Changelog
|
|
53
|
+
|
|
54
|
+
Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. Make it look like every other line, including your name and link to your Github account.
|
|
55
|
+
|
|
56
|
+
#### Commit Changes
|
|
57
|
+
|
|
58
|
+
Make sure git knows your name and email address:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
git config --global user.name "Your Name"
|
|
62
|
+
git config --global user.email "contributor@example.com"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Writing good commit logs is important. A commit log should describe what changed and why.
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
git add ...
|
|
69
|
+
git commit
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### Push
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
git push origin my-feature-branch
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
#### Make a Pull Request
|
|
79
|
+
|
|
80
|
+
Go to https://github.com/contributor/laser-cutter and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
|
|
81
|
+
|
|
82
|
+
#### Rebase
|
|
83
|
+
|
|
84
|
+
If you've been working on a change for a while, rebase with upstream/master.
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
git fetch upstream
|
|
88
|
+
git rebase upstream/master
|
|
89
|
+
git push origin my-feature-branch -f
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### Update CHANGELOG Again
|
|
93
|
+
|
|
94
|
+
Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
* [#123](https://github.com/kigster/laser-cutter/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Amend your previous commit and force push the changes.
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
git commit --amend
|
|
104
|
+
git push origin my-feature-branch -f
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
#### Check on Your Pull Request
|
|
108
|
+
|
|
109
|
+
Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
|
|
110
|
+
|
|
111
|
+
#### Be Patient
|
|
112
|
+
|
|
113
|
+
It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
|
|
114
|
+
|
|
115
|
+
#### Thank You
|
|
116
|
+
|
|
117
|
+
Please do know that we really appreciate and value your time and work. We love you, really.
|
data/README.md
CHANGED
|
@@ -1,11 +1,52 @@
|
|
|
1
1
|
[](http://travis-ci.org/kigster/laser-cutter)
|
|
2
2
|
[](https://codeclimate.com/github/kigster/laser-cutter)
|
|
3
3
|
|
|
4
|
-
LaserCutter
|
|
5
|
-
============
|
|
4
|
+
## LaserCutter
|
|
6
5
|
|
|
7
|
-
Similar to boxmaker
|
|
8
|
-
basis for cutting boxes on a typical laser cutter.
|
|
6
|
+
Similar to [BoxMaker](https://github.com/rahulbot/boxmaker/) (which is written in Java a long time ago),
|
|
7
|
+
this ruby gem generates PDFs that can be used as a basis for cutting boxes on a typical laser cutter.
|
|
8
|
+
|
|
9
|
+
Unlike ```BoxMaker```, this gem has a lot of automated tests around creating the geometry of the notches
|
|
10
|
+
and calculating locations. This welcomes additional feature contributions from other developers,
|
|
11
|
+
as existing test suite offers confidence around not introducing bugs or regressions.
|
|
12
|
+
|
|
13
|
+
BoxMaker's algorithm _ensures that the same notch length is across all sides, but sacrifices
|
|
14
|
+
symmetry as a result_. So you may have your font panel's left and right sides be pretty different.
|
|
15
|
+
|
|
16
|
+
```laser-cutter```'s algorithm will create a _symmetric design for most panels_, but it might sacrifice
|
|
17
|
+
identical notch length_. Depending on the box dimensions you may end up with a slightly different notch
|
|
18
|
+
length on each side of the box.
|
|
19
|
+
|
|
20
|
+
Finally, ```laser-cutter``` has a ton of options, that allow you to set stroke width, page size,
|
|
21
|
+
layout, margins, padding (spacing between boxes), open the PDF file using system viewer right
|
|
22
|
+
after generation, and many more are coming.
|
|
23
|
+
|
|
24
|
+
The choice ultimately comes down to the preference and feature set, so here I show you two boxes made with
|
|
25
|
+
each program, so you can pick what you prefer.
|
|
26
|
+
|
|
27
|
+
Below are two examples of boxes with identical dimensions produced with ```laser-cutter``` and ```boxmaker```:
|
|
28
|
+
|
|
29
|
+
#### BoxMaker Example
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
> 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
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
.
|
|
36
|
+
|
|
37
|
+
#### LaserCutter Example
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
> laser-cutter -u in -s 2.5x1x2/0.25/0.5 -o file.pdf
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
.
|
|
44
|
+
|
|
45
|
+
## Future Features
|
|
46
|
+
|
|
47
|
+
* Creating T-style holes and spacers for various sized nuts and bolts (such as common #4-40 and M2)
|
|
48
|
+
* Creating lids and front panels that are larger than the box
|
|
49
|
+
* Your brilliant idea can be here! Please see [contributing](CONTRIBUTING.md) for more info.
|
|
9
50
|
|
|
10
51
|
## Installation
|
|
11
52
|
|
|
@@ -24,7 +65,7 @@ Or install it yourself as:
|
|
|
24
65
|
## Usage
|
|
25
66
|
|
|
26
67
|
```bash
|
|
27
|
-
>
|
|
68
|
+
> laser-cutter --help
|
|
28
69
|
Usage: laser-cutter [options]'
|
|
29
70
|
|
|
30
71
|
eg: laser-cutter --units in -s 2x3x2/0.125/0.5 -o box.pdf'
|
data/doc/boxmaker.jpg
ADDED
|
Binary file
|
|
Binary file
|
data/laser-cutter.gemspec
CHANGED
|
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
|
|
|
8
8
|
spec.version = Laser::Cutter::VERSION
|
|
9
9
|
spec.authors = ['Konstantin Gredeskoul']
|
|
10
10
|
spec.email = ["kigster@gmail.com"]
|
|
11
|
-
spec.summary = %q{Creates box outlines for laser-cut boxes.}
|
|
12
|
-
spec.description = %q{}
|
|
13
|
-
spec.homepage = ""
|
|
11
|
+
spec.summary = %q{Creates notched box outlines for laser-cut boxes which are geometrically symmetric and pleasing to the eye.}
|
|
12
|
+
spec.description = %q{Similar to the older BoxMaker, this ruby gem generates PDFs that can be used as a basis for cutting boxes on a typical laser cutter. The intention was to create an extensible, well tested, and modern ruby gem for generating PDF templates used in laser cutting.}
|
|
13
|
+
spec.homepage = "https://github.com/kigster/laser-cutter"
|
|
14
14
|
spec.license = "MIT"
|
|
15
15
|
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
|
@@ -2,9 +2,7 @@ module Laser
|
|
|
2
2
|
module Cutter
|
|
3
3
|
module Renderer
|
|
4
4
|
class LineRenderer < AbstractRenderer
|
|
5
|
-
|
|
6
|
-
subject
|
|
7
|
-
end
|
|
5
|
+
alias_method :line, :subject
|
|
8
6
|
def render pdf = nil
|
|
9
7
|
pdf.stroke { pdf.line [line.p1.x, line.p1.y].map{ |p| p.send(units) },
|
|
10
8
|
[line.p2.x, line.p2.y].map{ |p| p.send(units) }}
|
data/lib/laser-cutter/version.rb
CHANGED
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.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -107,7 +107,10 @@ dependencies:
|
|
|
107
107
|
- - ! '>='
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
109
|
version: '0'
|
|
110
|
-
description:
|
|
110
|
+
description: Similar to the older BoxMaker, this ruby gem generates PDFs that can
|
|
111
|
+
be used as a basis for cutting boxes on a typical laser cutter. The intention was
|
|
112
|
+
to create an extensible, well tested, and modern ruby gem for generating PDF templates
|
|
113
|
+
used in laser cutting.
|
|
111
114
|
email:
|
|
112
115
|
- kigster@gmail.com
|
|
113
116
|
executables:
|
|
@@ -119,12 +122,15 @@ files:
|
|
|
119
122
|
- .rspec
|
|
120
123
|
- .ruby-version
|
|
121
124
|
- .travis.yml
|
|
125
|
+
- CONTRIBUTING.md
|
|
122
126
|
- Gemfile
|
|
123
127
|
- LICENSE
|
|
124
128
|
- LICENSE.txt
|
|
125
129
|
- README.md
|
|
126
130
|
- Rakefile
|
|
127
131
|
- bin/laser-cutter
|
|
132
|
+
- doc/boxmaker.jpg
|
|
133
|
+
- doc/laser-cutter.jpg
|
|
128
134
|
- laser-cutter.gemspec
|
|
129
135
|
- lib/laser-cutter.rb
|
|
130
136
|
- lib/laser-cutter/box.rb
|
|
@@ -153,7 +159,7 @@ files:
|
|
|
153
159
|
- spec/rect_spec.rb
|
|
154
160
|
- spec/renderer_spec.rb
|
|
155
161
|
- spec/spec_helper.rb
|
|
156
|
-
homepage:
|
|
162
|
+
homepage: https://github.com/kigster/laser-cutter
|
|
157
163
|
licenses:
|
|
158
164
|
- MIT
|
|
159
165
|
post_install_message:
|
|
@@ -177,7 +183,8 @@ rubyforge_project:
|
|
|
177
183
|
rubygems_version: 1.8.23
|
|
178
184
|
signing_key:
|
|
179
185
|
specification_version: 3
|
|
180
|
-
summary: Creates box outlines for laser-cut boxes
|
|
186
|
+
summary: Creates notched box outlines for laser-cut boxes which are geometrically
|
|
187
|
+
symmetric and pleasing to the eye.
|
|
181
188
|
test_files:
|
|
182
189
|
- spec/box_spec.rb
|
|
183
190
|
- spec/configuration_spec.rb
|