GithubHelp home page GithubHelp logo

kigster / laser-cutter Goto Github PK

View Code? Open in Web Editor NEW
93.0 9.0 59.0 980 KB

Similar to boxmaker, this ruby gem generates PDFs that can be used as a basis for cutting boxes on a typical laser cutter. The intention is to create an extensible, well tested, and modern ruby framework for generating PDF templates used in laser cutting.

License: MIT License

Ruby 100.00%

laser-cutter's Introduction

Gem Version Build status Code Climate Test Coverage

LaserCutter and Make-A-Box.io

laser-cutter is a ruby library for generating PDF designs for boxes of custom dimensions that suit your project, that can be cut from wood or acrylic using a laser-cutter. The sides of the box snap together using alternating notches, that are deliberately layed out in a symmetric form.

To use laser-cutter you need to have a recent version of ruby interpreter, install it as a gem, and use command line to generate PDFs.

Make-A-Box is a online web application that uses laser-cutter library and provides a straight-forward user interface for generating PDF designs without the need to install the gem or use command line.

Use whatever suites you better.

Design Goals

One of the design goals of this project is to provide a highly extensible platform for creating laser-cut designs, where alternative strategies can be added over time, and supported by various command line options, and perhaps a light weight web application. If you are interested in contributing to the project, please see contributing for more details.

laser-cutter supports many flexible command line options that allow setting dimensions, stroke width, page size, layout, margins, padding (spacing between the boxes), and many more.

Dependencies

The gem depends primarily on Prawn โ€“ a fantastic PDF generation library.

Installation

Add this line to your application's Gemfile:

gem 'laser-cutter'

And then execute:

$ bundle

Or install it yourself as:

$ gem install laser-cutter

Usage

Usage: laser-cutter [options] -o filename.pdf
   eg: laser-cutter -b 1x1.5x2/0.125 -O -o box.pdf

Specific Options:
    -w, --width WIDTH                Internal width of the box
    -h, --height HEIGHT              Internal height of the box
    -d, --depth DEPTH                Internal depth of the box
    -t, --thickness THICKNESS        Thickness of the box material
    -n, --notch NOTCH                Optional notch length (aka "tab width"), guide only
    -k, --kerf KERF                  Kerf - cut width (default is 0.007in)

    -m, --margin MARGIN              Margins from the edge of the document
    -p, --padding PADDING            Space between the boxes on the page
    -s, --stroke WIDTH               Numeric stroke width of the line
    -i, --page_size LETTER           Document page size, default is autofit the box.
    -l, --page_layout portrait       Page layout, other option is 'landscape'

    -O, --open                       Open generated file with system viewer before exiting
    -W, --write CONFIG_FILE          Save provided configuration to a file, use '-' for STDOUT
    -R, --read CONFIG_FILE           Read configuration from a file, or use '-' for STDIN

    -L, --list-all-page-sizes        Print all available page sizes with dimensions and exit
    -M, --no-metadata                Do not print box metadata on the PDF
    -v, --[no-]verbose               Run verbosely
    -B, --inside-box                 Draw the inside boxes (helpful to verify kerfing)
    -D, --debug                      Show full exception stack trace on error

        --examples                   Show detailed usage examples
        --help                       Show this message
        --version                    Show version

Common Options:
    -o, --file FILE                  Required output filename of the PDF
    -z, --box WxHxD/T[/N]           Combined internal dimensions: W = width, H = height,
                                     D = depth, T = thickness, and optional N = notch length

    -u, --units UNITS                Either 'in' for inches (default) or 'mm'

Examples

Create a box defined in inches, with kerf (cut width) set to 0.008", and open PDF in preview right after:

    laser-cutter -b 3x2x2/0.125 -k 0.008 -O -o box.pdf

Create a box defined in millimeters, print verbose info, and set page size to A3, and layout to landscape, and stroke width to 1/2mm:

    laser-cutter -u mm -w70 -h20 -d50 -t4.3 -n5 -iA3 -l landscape -s0.5 -v -O -o box.pdf

List all possible page sizes in metric system:

    laser-cutter -L -u mm

Create a box with provided dimensions, and save the config to a file for later use:

    laser-cutter -b 1.1x2.5x1.5/0.125/0.125 -p 0.1 -O -o box.pdf -W box-settings.json

Read settings from a previously saved file:

    laser-cutter -O -o box.pdf -R box-settings.json
    cat box-settings.json | laser-cutter -O -o box.pdf -R -

Feature Wish List

  • Create T-style joins, using various standard sizes of nuts and bolts (such as common #4-40 and M2 sizes)
  • Extensibility with various layout strategies, notch drawing strategies, basically plug and play model for adding new algorithms for path creation and box joining
  • Support more shapes than just box, such as prisms
  • Supporting lids and front panels, that are larger than the box itself and have holes for notches.
  • Your brilliant idea can be here too! Please see contributing for more info.

LaserCutter vs BoxMaker

Rahulbot-made BoxMaker is a functional generator of notched designs, similar to laser-cutter, and generously open sourced by the author, and so in no way this project disputes BoxMaker's viability. In fact BoxMaker was an inspiration for this project.

Laser-Cutter library attempts to further advance the concept of programmatically creating laser-cut box designs, provides additional fine tuning, many more options, strategies and most importantly โ€“ extensibility.

Unlike BoxMaker, this gem has a suit of automated tests (rspecs) around the core functionality. In addition, new feature contributions are highly encouraged, and in that regard having existing test suit offers confidence against regressions, and thus welcomes colaboration.

Finally, BoxMaker's notch-drawing algorithm generates non-symmetric and sometimes purely broken designs (see picture below).

laser-cutter's algorithm will create a symmetric design for most panels, but it might sacrifice identical notch length. Depending on the box dimensions you may end up with a slightly different notch length on each side of the box.

The choice ultimately comes down to the preference and feature set, so here I show you two boxes made with each program, so you can pick what you prefer.

Example Outputs

Below are two examples of boxes with identical dimensions produced with laser-cutter and boxmaker:

This is how you would make a box with Adam Phelp's fork of BoxMaker (which adds flags and a lot of niceties):

git clone https://github.com/aphelps/boxmaker && cd boxmaker && ant
java -cp BOX.jar com.rahulbotics.boxmaker.BoxMaker \
      -W 1 -H 2 -D 1.5 -T 0.125 -n 0.125 -o box.pdf

And laser-cutter:

gem install laser-cutter
laser-cutter -b 1x1.5x2/0.125/0.125 -O -o box.pdf

LaserCutter Comparison.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/laser-cutter/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

laser-cutter's People

Contributors

gitter-badger avatar kigster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laser-cutter's Issues

Stuart - download of PDF

Hi

Tried to follow instructions on reinventone page but does not do anything. Re-tried the program but still does not download the PDF, just hangs

Stuart

Issue with generating PDF file when using millimeters unit via the website (makebox.io)

The generation of the PDF file using any of the known supported web browsers on either Windows 7 or Mac OS X Sierra, causes the resulting PDF file to be blank when opened with Adobe Acrobat Reader. Mac OS Preview is able to show something but the box design is overlapping each of the sides. When the resulting PDF file is opened in CorelDraw X7, the measurements are off and shows up in "meters" and not millimeters as expected.

makeabox-200.00W-350.00H-200.00D-5.00T-20170501131243_correctlygenerated.pdf
makeabox-200.00W-100.00H-200.00D-5.00T-20170531043053_infobox.pdf
makeabox-200.00W-100.00H-200.00D-5.00T-20170531042033.pdf
makebox_io_screenshot_chrome

Option to create tilted face box.

Consider the scenario where you are creating an enclosure for an LCD panel. (e.g, RepRap standalone 3D printing LCD upgrade)

It would be really nice to have that face housing the LCD be at an angle like 45 degrees or so.
Not sure if that is possible using a dynamic tabbed-box generator or not, but it would be great option to
to have.

Thank you for your hard work.

Tab mismatch when using same thickness and tab width.

When producing boxes which have the same tab widths as the board thickness, the tabs don't match.
For example, producing a box with dimensions that are divisible by the tab width such as:

width: 172
height: 52
depth: 112
thickness: 4
tab width: 4

gives the following result.
makeabox-172.00W-52.00H-112.00D-4.00T-20171203134837.pdf

In the top left 3 piece joint, assuming that each piece has a depth identical to the tab width, you can geometrically see that one of the pieces doesn't fit.
For example, the top-left notch of the left board interferes with the left-bottom notch of the bigger board.

Am I thinking about this the wrong way or is this a bug?

Nesting Storage boxes

Any chance of creating an option for folding boxes, which could be lasered out and then folded, similar to something like these storage boxes:
http://www.thingiverse.com/thing:673699

In an ideal world being able to specify sizes ranging from 3" square up to possibly as large as 9x9x4".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.