Close
0%
0%

Boxes.py

Cut out boxes and other stuff with a laser cutter

Similar projects worth following
A small python library for generating SVG drawings used for cutting out boxes or other structures using a laser cutter. It also offers a command line and web interface allowing control over many parameters.

It also comes with a growing set of ready-to-use, fully parametrized generators:

* Various simple boxes
* Flex boxes with rounded corners and living hinges
* Boxes with proper hinges
* Type trays with and without walls and floors
* Bin trays
* Display shelf
* Book cover with flex spine
* Magazine file
* Traffic lights
* Honey comb wine rack

Parts to be used in other projects:

* Pulleys
* Gears
* Knobs

And a few one trick ponies:

* An arcade cabinet
* A small robot
* A drill stand
* A rotary attachment for a laser cutter
* A castle tower
* A cutlery stand


It also offers an API to easily draw your own parts. See link to the documentation below. It is licensed under GPL v3+.

You can get the sources directly from github. You can also find some more examples there.

Usage
There are multiple ways to use the available generators:

  • Use them online
  • Use them as Inkscape plugins
  • Run scripts/boxesserver which provides an web interface on port 8000
  • Execute the scripts/boxes tool and pass the name of the generator together with the measurements on the command line
  • scripts/boxes --list gives you the list of available generators
  • Run scripts/boxesserver as an WSGI script in your web server.

You can also create your own generators using boxes/generators/_template.py or any of the generators in boxes/generators as a starting point.

Features

Of course the library and the generators allow selecting the "thickness"
of the material used and automatically adjusts lengths and width of
joining fingers and other elements.

The "burn" parameter compensates for the material removed by the laser. This
allows fine tuning the gaps between joins up to the point where plywood
can be press fitted even without any glue.


Finger Joints are the work horse of the library. They allow edges
and T connections. Their size is scaled up with the material
"thickness" to maintain the same appearance. The library also allows
putting holes and slots for screws (bed bolts) into finger joints,
although this is currently not supported for the available generators.

Dovetail joints can be used to join pieces in the same plane.

Flex allows bending and stretching the material in one direction. This
is used for rounded edges and living hinges.

  • 3rd Party Instructions

    Florian Festi04/26/2018 at 19:51 0 comments

    I accidentally stumbled across an Instructable for laser cutting boxes and though to my self: They look nice but very much like the ones my generator does. Did someone just steal my ideas?

    After scrolling down I realized that the instructable is actually about Boxes.py - which explains the similarity of the boxes quite nicely. It is also quite nicely done.

    Thanks to Andrea Biffi for all the work!

  • Trouble with pstoedit

    Florian Festi04/15/2018 at 11:47 0 comments

    Although it is not available on the public online generator Boxes.py supports generating formats like DXF directly using the pstoedit utility. Unfortunately this broke recently due to ghostscript dropping the -dDELAYBIND parameter in 9.22.

    Luckily ghostscript upstream decided to add it back in 9.23. So if you run into trouble consider updating or downgrading your ghostscript installation. 

    Pstoedit also indicated that the next version may work without -dDELAYBIND. So as soon as 3.71 comes out the issue may be off the table for ever.

    Fedora Bug report

  • Boxes.py on Windows?

    Florian Festi12/20/2017 at 09:47 5 comments

    Hi!

    I am getting questions about Boxes.py on Windows I can't really answer - both as private message or as GitHub tickets. I personally have not used Windows for anything else than occasionally using a Desktop program (like the control software for our laser cutter) in over a decade. So I really have no clue.

    Has anyone been able to run Boxes.py on their Windows machine and is able to share the steps needed preferably including links to the libraries and tools required. Are there any changes that would make installing it easier?

    Has any one been able to make the Inkscape plugins work on Windows?

    Any feed back that help improving the (very thin) install documentation or the installation itself is welcome!

  • Boxes.py gets musical

    Florian Festi11/25/2017 at 23:04 0 comments

    Due to the many requests of a single person I added another thing that is not completely unlike a box:

    This contraption is an end pin for a bass recorder. Well it is an end pin if you add the pin at the clamp on the right. Imagine a black, metal, telescopic mono pod - as you might use with a camera but a bit shorter (for some reason it did not make it on the pictures). May be at least adding the bottom piece of the recorder gives a better idea ...

    Although these things are weird and serve a very rare purpose they multiply rather quickly.

  • Side Projects

    Florian Festi11/16/2017 at 20:30 0 comments

    I has been a bit quiet here the last couple of weeks. But this has little to do with me not working on Boxes.py but rather with me working on something so big it needs its own project page: Flipper the Cocktail Bot

    Yes, yes, it is only in part made with Boxes.py and still not in the GitHub repository. But it turns out a working cocktail bot doesn't help with that...

    As a consolation I made you a new box.

  • Submitting to 2017 Hackaday Prize

    Florian Festi10/02/2017 at 20:37 0 comments

    Motivation

    Laser cutters are awesome! Really - get one (for your hacker space)! But they are inherently 2D. So you need to be a bit creative to create something three dimensional. One way is using finger joints to join sheets to larger structures. Another is using flex cuts to bend flat pieces into the 3rd dimension.

    The Challenge

    I looked for a way to do that. Preferably a way to generate generic sketches that can easily be resized, that can be parametrized for different thickness and kerf. A solution that would not just scale size but adjust the number of fingers and flex cuts. A solution that would not only allow picking the size but also the style of the joints and other features - and that is open source so I can share my creations.

    I looked at various CAD programs and available boxes generators that could be extended with my ideas. FreeCAD was still not there yet at the time. OpenSCAD did not support simple cuts which are needed for flex. The available box generators were either closed source or not really worth the effort. In addition, most parametric tools were 3D and required extra steps to generate a 2D drawing suitable for laser cutting.

    The Solution

    So I decided I can do this by myself. All it takes is a bit of turtle graphics. Can't be that difficult.

    Four years and 10k LOC later you can create over forty different things. There is an API to build your own stuff - and some people have. Many users just generate parts, and modify and arrange them in a vector graphics program like Inkscape.

    I started with simple boxes. Today the project stretches far beyond and includes things like trays and shelves, traffic (aka Jenkins) lights and a honey comb wine rack.

    Boxes.py has even spawned its own sub projects here on Hackaday.io: A cute little robot and my first steps towards laser cut gear boxes.

  • Knobs for all!

    Florian Festi10/02/2017 at 10:57 0 comments

    Ok, this is kinda embarrassing: About a year ago I added knobs to go on screw heads. They got used by generators like the Rotary Attachment (a contraption to laser engrave round objects) or the Pole Hook (a contraptions to hook a huge recorder to a music stand). Turns out they were not available anywhere else - although they are pretty handy for all other kind of thing. So:

    ConcaveKnob and WaivyKnob

    As always probably not the best names, but at least they are reasonably good looking. Please actually measure the size of the hex head you want to use and may be even reduce the value by a tenth of a Millimetre or two. Hex heads are typically a bit smaller than their nominal width to fit comfortably in the wrench while you probably want to press it in.

    Not so good looking is the text output as rendered on my server. Locally everything is fine but for a while now the Cairo library only renders weird characters instead of the size of the reference block. If anyone has an idea how to fix this (on libcairo on Python 2.7) let me know. Setting the font face does not help.

  • Honey Comb Wine Rack‚Äč

    Florian Festi09/16/2017 at 10:07 0 comments

    So we had set aside one shelf in our new IKEA Besta storage cabinet for wine bottles. Unfortunately I could  not find a wine rack that fitted in there without wasting too much space. So Boxes.py to the rescue. The new WineRack generator  arranges a honey comb pattern of holes on the front wall and renders finger joints and walls to connect to a back wall enclosing each hole with the the six walls of the honey comb. To strengthen the front wall - which is reduced to little more than holes - and to hide the finger joints poking out a second layer is glued onto the front. This makes the wine rack quite good looking - especially when using a nice wood. Mine is made out of Baltic birch plywood as it is available in really good quality. A quick coat of oil gives the final touch.

    The holes should probably be around 92mm in diameter to fit most regular wine bottles but as space is limited and most of my bottles were of the narrow type I went with only 82mm diameter and just 4mm material strength to fit 38 bottles (6 x 7) instead of 27 when loosing both a row and a column (5x6).

    When building the rack I realized that in the roughly 150 parts are quite a lot. So the generator now supports leaving out the vertical walls or even also all others that do not carry a bottle.

  • Otto Bot LC now has its own home

    Florian Festi08/17/2017 at 19:38 0 comments

    You might have seen Otto LC in a project log a while ago. We now had two workshops for kids. Before and after the workshops I did quite some tweaks and add-ons. Now the PCB is held in place and the head is held shut. While at first the feet were just pressed onto the servos now they are attached using a servo horn - similar to the original model.

    As the Otto Bot is more complicated than most boxes and needs its own instructions and components list it now lives in its own project. There also has been done a lot of work to create a better firmware and also a UI to create moves. I hope we can get that published and documented soon. We'll keep you updated over at the new project.

  • Images for the (Box) Generators

    Florian Festi05/20/2017 at 13:40 0 comments

    Getting some images for the generators has been on my list for quite a while. I got my not so professional prototypes into a very professional photo studio. It took me nearly another to months to get to fix up the web part to actually be able to serve them. Now they are available in both the standalone web server and - with some tweaking of the configuration - my public httpd/wsgi instance. This also meant that the CSS finally is a stand alone file that no longer has to be merged into the web pages.

    The pictures are now visible if you hover the mouse over the entry in the list of all generators. As I am still not a web developer things could probably better and nicer. But that's what I got so far. There is still need for better descriptions and building instructions. There are still pictures missing. Step by step...

View all 33 project logs

Enjoy this project?

Share

Discussions

Chris Jones wrote 02/06/2018 at 05:39 point

I really appreciate this project! It has helped me make card boxes and trays to help me organise board game components better inside their boxes.

This evening I have been having trouble, though. When I use traylayout to generate a tray from a layout file, the walls of the layout have gaps in them, and they are overlapping. I don't think there is anything different that I am doing, and I have screenshots to show you my input and the svg that is output. I can send them to you if you like. 

Thank you again for an incredibly useful tool!

  Are you sure? yes | no

Ian Hubbertz wrote 12/31/2017 at 13:03 point

What's the easiest way to split a large part into two (or more) parts with dovetail joints? 

I want to build a large "RoundedBox", so that the flexible part around the box is too long for the  laser cutter. It would be nice to split this part into two or even more parts?

  Are you sure? yes | no

Florian Festi wrote 01/14/2018 at 21:32 point

Oh, sorry! I missed your comment over the holidays.

The canonical way of doing this would be extending the roundedPlate() and surroundingWall() methods in boxes/__init__.py to take a param on how many splits should be used (one to four - may be without three) and then adding a param to the RoundedBox generator that set them. 

As an alternative you can provide a instructions to get Boxes.py running on Windows and I'll do the coding for you (see https://hackaday.io/project/10649/log/71764-boxespy-on-windows ). 

  Are you sure? yes | no

Ian Hubbertz wrote 01/20/2018 at 11:18 point

Ha.. :-) thanks for the offer, but I have absolutely no experience with development (or deployment) on Windows.

When I find some free time (I have two other projects right now with higher priority), I will have a look to see how to enhance the surroundingWall() method.

  Are you sure? yes | no

Chris wrote 11/17/2017 at 19:27 point

Thanks for sharing this project with the world, it looks fantastic. Do you do any further post-processing of the generated SVGs prior to cutting, and if so what is your preferred application? Also what software do you use to generate gcode/control your laser? I'm using LaserWeb 4, and I can't figure out what I need to do to the boxes.py SVG output to make it work properly in LaserWeb 4. If I open the SVG in Adobe Illustrator and save it, that only seems to increase the number of errors. Any hints or tips would be greatly appreciated.

  Are you sure? yes | no

Florian Festi wrote 11/17/2017 at 19:45 point

Our Chinese laser cutter comes with some proprietorial front end program that allows arranging the pieces. For other stuff I often use Inkscape. But this also is a mixed bag as it is not really a CAD program and adds the line widths to all measurements.

There are a few pitfalls:

Boxes.py creates a lot of very short segments. If you have some auto connect feature that tries to connect single line segments to a continuous polygon make sure if has only 0.01mm range. The common default of 0.1mm is too big.

Both SVG and also DXF do not really come with units. So all lengths are just a numbers that can mean different things to different programs under different circumstances.

If you need DXF you might want to install Boxes.py locally and also install ps2edit. Then Boxes.py can create DXF directly (among some other formats).

  Are you sure? yes | no

Chris wrote 11/20/2017 at 19:11 point

Thanks for your quick reply. Based on https://darklylabs.zendesk.com/hc/en-us/community/posts/206123108/comments/115000442212, I've had some success with the following Illustrator workflow:

1) Save boxes.py output as SVG from browser.
2) Open in Illustrator.
3) One-by-one, select each path…
4) Right-click > Release Compound Path
5) Right-Click > Join
6) For each enclosed shape, select all edges, Right Click > Join
7) For circles, Right Click > Join
8) Save As > SVG 1.1, Style Attributes

9) Import into LaserWeb

  Are you sure? yes | no

Florian Festi wrote 11/21/2017 at 09:18 point

Wow! This still sounds really painful. Have you tried DXF as a format? IIRC it is even more primitive so may be the importer can deal with the non connected line segments better.

  Are you sure? yes | no

Yash Gupta wrote 10/21/2017 at 20:56 point

Great project. I wonder if there is a way to automate splitting of the files across pages of a specific size to laser cur larger projects on laser cutters with limited real estate?

  Are you sure? yes | no

Florian Festi wrote 10/21/2017 at 23:22 point

No, this is not possible right now and I am not planning to add this. It turns out that the parts need to be rearranged by hand most of the time anyway. Even if they fit in the laser cutter they do not fit on the leftover sheets which at least I often use for one ofs.

In case you want to do a larger run with one size you'll want to optimize by hand anyway to make sure you make the best use of the your sheets.

  Are you sure? yes | no

Jarrett wrote 10/02/2017 at 16:12 point

I just want you to know that I really appreciate this project! Especially the web interface. It has saved me so much time in CAD stuff to just be able to directly generate profiles.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates