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.

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/ or any of the generators in boxes/generators as a starting point.


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.

  • New Generators and Features

    Florian Festi10/31/2018 at 08:21 0 comments

    I promised new generators. Luckily several people sent some in. So there is a pretty long list:

    • PaintStand from Jens Persson is a stackable stand for small paint bottles based in this video from Tested.
    • CardBox also from Jens Persson can house a number of playing card decks and features a nice slide in lid.
    • TwoPiece is simple box with another box as a lid that slides over the first one. While I rewrote large parts of the generator the idea and first implementation was submitted by bobm123 quite a while ago.
    • DisplayCase from Alexander Bulimov is a simple closed box optimized to be cut from acrylic for displaying small objects.
    • RoyalGame of Ur is an ancient board game featured in this video from the British Museum
    • LaserClamp can hold warped plywood down on a knife table. This already kinda works but it will probably still change form to work more conveniently.

    Additionally some old things got improved:

    • Most flex boxes now have a latchsize parameter to allow cutting them much smaller
    • Cabinet hinges can now be mounted on the outside of the box
    • The HingeBox supports a split lid that opens to both sides
    • The move parameter in the parts API now supports "mirror" to make rendering  symmetrical parts easier

  • Finally!

    Florian Festi09/24/2018 at 16:07 2 comments

    OK, OK. I know you are actually all waiting for cool new boxes and other generators - or at least new features for the existing ones. But there is even more infrastructure work that need to be done. I do have some new generators in some - not quite finished - branches. So there will be new stuff to cut out. I promise!

    One long standing issue with the project has been the logo. The web site used a gray cube that was added as a place holder in the web UI mock up and just didn't get replaced. I wanted the logo to also be a box generator  and I have a branch that does that. It applies some transformation matrices to render a box with finger joints in an isometric projection. But the result was still closer to a technical drawing that a proper logo. After some encouragement in the GitHub tickets I finally ditched the idea and sketched something in Inkscape. It's not that great but it is a box that's green like a Python (mascot) and has a laser welding it together. There is probably some things that can be improved. The contrast between the greens and the light gray used as a background in many web browsers could be better and and the laser could be nicer, brighter ans shinier. But so far I am happy with what I have achieved - given my artistic talent. If you have some design skills and some improvements feel free to open an pull request.

    PS: The logo is also - finally - used as a favicon. So I can now find all those still open boxes browser tabs.

  • Update for the Web Instance

    Florian Festi09/17/2018 at 15:50 0 comments

    Some may have noted that I recently added a Dockerfile to the repository. Playing around a bit more I moved the public web instance into a more modern docker container. This is not in its final form. Several things still need to be done right. Nevertheless it already solves two long standing and annoying issues:

    For the later I still need to fix the docs with still state those formats or only available for local installations.

    Overall the docker container is considered being in beta test. So if you encounter any issues, please report here or in a GH ticket. But in general I expect things to work.


    Turns out this simple setup is not good enough for a public instance. I added uWSGI - a light weight web server - to the container. So now there are multiple processes and threads handling the requests. I also created a systemd service file for the container so it gets started and restarted automatically.

    I did not update the Dockerfile in the repository as I guess most people won't be using it to run their own public instance but would rather use it for development where having one single process with the SimpleHttpServer is just fine. It also contains a few specifics of my setup.

  • More Documentation

    Florian Festi09/14/2018 at 13:30 0 comments

    Updating the API docs has been on the ToDo list for one and a half year. Turns out being on vacation far away from a laser cutter is helping. Not only did I update some doc strings - which are the basis for the Sphinx generated API docs - but I wrote some new documents:

    And I added an Introduction to the Edge classes. The rest of the page probably still needs some work as some Edge types are still missing. The Settings classes and their role in creating the HTML and Inkscape user interfaces and in creating the Edge instances probably also deserves a bit more text.

    What also helped getting it done - probably not getting it done well - was a good amount of medication. It at least prevented me from doing something more complicated - and may be more rewarding - instead. I hope it does not show too much. So if something looks weird or doesn't make sense please open a ticket on GitHub or leave a comment below.

  • goes to Jupyter

    Florian Festi09/10/2018 at 14:19 0 comments

    No, didn't make it to space - yet. But @speendo used a Jupyter notebook to develop a housing for his switch. After a bit of back and forth we now have an example notebook that allows to play around interactively in your web browser - sort of. You still need running on your system - or where ever your Jupyter instance is running. If you do not have installed in your Python path you can uncomment and adjust the sys.path line in the first code cell.

    The example code - a simple, single shelve to screw to the wall - did not yet make it into the regular code. So it is only available in the notebook for now.

  • Reuse your previous Box settings

    Florian Festi08/14/2018 at 10:40 0 comments

    When designing the web interface I was deliberately using URL parameters so the link to the rendered SVG can be used to generate it again and to adjust the values. But so far there was no way to get those values back into the input form. Yes, you *can* edit the URL directly but this got much less convenient when the settings for the edges got added and the URL looks like a database.

    bwente rightly complained about this in #66. So I finally fixed it. Now you can just remove the &render=1  at the end of the URL or turn the 1 into a 0 to open the input form filled with the previously used values.

    The actual issue in #66 - adding the URL as a comment in the SVG file - is still unresolved. So far I could not yet bring myself to re-open and rework the SVG file. But there are several issues open that would require this. So one day eventually...

    In the mean time Rotzbua created a greasemonkey script that adds the comment on the client side.

  • 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 - 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 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

  • on Windows?

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


    I am getting questions about 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 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!

  • 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.

View all 39 project logs

Enjoy this project?



Mohab Fawzy wrote 10/24/2018 at 01:39 point

HI Florian , love your project , and can help you with the visuals or logo if you like , since i'm really dumb when it comes to coding XD
I wanted to ask you about running it in windows , but scrolled down and found that it doesnt have an obvious solution , i messed with it but im dumb XD so i think i'll run it on my linux laptop for now .

  Are you sure? yes | no

Florian Festi wrote 10/24/2018 at 07:30 point

Sure, I am not much of a web or graphics person. So help is welcome in this area.

 Yeah, on Windows is still a sad story. There is still the bounty up for working installation instructions.

  Are you sure? yes | no

Mohab Fawzy wrote 10/24/2018 at 16:09 point

cool , see what i can help with and i'm up for it =)

  Are you sure? yes | no

Andrew Bills wrote 10/18/2018 at 05:00 point

FYI - Took me a little bit to figure out what I was doing wrong, but if you generate a flexbox4 too small (i tried 25x25x40) the sold curve wall part doesn't get added to the model. Took me a bit to realise (after I broke the pieces trying different things to make it go together)

  Are you sure? yes | no

Florian Festi wrote 10/19/2018 at 09:40 point

There are two issues here. The generator reduces the radius of the flex if there is not enough space. But there is a bug where this reduced radius is not used for the length of the flex.

The second issue is that there is just not enough room for the flex in this dimensions. One could make the latch configurable to allow making more space or just some heuristics for small values.

On the larger picture there is the question of using unsuitable parameters. So far I have avoided to add checks for the most part and left the checking to the user. This has obviously fail here - to some extend due to the bug above.

I hope I can get the bug fixed today or tomorrow. But this may still not make the box work with this small dimensions.

  Are you sure? yes | no

Florian Festi wrote 10/24/2018 at 07:49 point

Ok, so the issue with FlexBox4 not calculating the length of flex correctly is fixed. I also added a latchsize param to FlexBox, FlexBox2 and FlexBox4 and updated the code of the flex boxes to a more recent code style.


Remove the &render=1 at the end of the URL to get to the parameter form.

  Are you sure? yes | no

megajas wrote 10/17/2018 at 03:45 point

Hi Florian, first of all, stumbling onto your project is really an eye-opener for me and I'm sure for many others! Great job!

I've only played around with the online box generator for a few minutes and I will spend much more time later. Is there a way to set the number of 'fingers' and have them evenly spaced along an edge of a wall?

  Are you sure? yes | no

Florian Festi wrote 10/19/2018 at 10:17 point

You can adjust the style of the fingers in the Settings for Finger Joint section that can be opened on most generators. Right now there is no way to evenly space them as the fingers have a fixed size. But you can change the size of the fingers and the mount of space required towards the corners. 

  Are you sure? yes | no

Thomas Pearce wrote 08/14/2018 at 15:46 point

What would be the feasibility of adding a grayscale based dovetail joint to this generator? I made them a while ago, but it didn't go anywhere because it was too tedious to make the joints. This is an awesome project, I'll have to play with it when I get the chance. the old link to the dovetails, I probably should rewrite it and move it somewhere better at some point.

  Are you sure? yes | no

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

It should be possible to add something like this to The question is what parameters are needed, to make things fit. One would also need some test piece to read the parameters from.

  Are you sure? yes | no

ornery shard wrote 08/06/2018 at 14:44 point

This tool is really great.

@Florian Festi Do you have pics and/or instructions how to  assemble the "rotary attachment for a laser cutter"

What kind of raw materials would I need for this?

  Are you sure? yes | no

Florian Festi wrote 08/07/2018 at 12:28 point

I don't. I am currently travelling so it may take a while until I can take pictures. The rotary attachment consist of two parts that slide on a metal bar. One side houses a NEMA 23 stepper that drives two rollers. The other part is a scissor lift with two free rollers.

You will need to adjust the bottom hole for the metal bar you are using.

Overall I am not 100% satisfied with the rotary attachment. The scissor lift is not as smooth and rigid as I'd want. But IIRC I made it from 5 or 6mm poppler. You want to use birch ply for that. I am still thinking about making a version without scissor lift that can be tilted as a whole.

You need a stepper motor that is electrically compatible with your Y axis of your laser cutter. Mine has 3 phase steppers which make getting one a bit more difficult. Your laser cutter needs to have a outlet for plugging the rotary device in. Or you need to do the wiring yourself.

The attachment also is still missing some accessories like rollers to limit left to right movement and pressing the inside of glasses against the driven rollers.

Beside these short coming it works reasonably well and we have engraved several glasses and bottles with it.

  Are you sure? yes | no

Jan wrote 08/03/2018 at 11:50 point

Love this tool. One can spend so much time optimizing stuff like that but you "just" write a script for it and automate it for everyone to use for free. NICE!
But I wonder: don't use wood laser-cutters DXF files like the whole sheet metal industry?

  Are you sure? yes | no

Florian Festi wrote 08/03/2018 at 17:00 point

Yes, they do. can generate DXF using ps2edit. Edit: That's now available in the online generator, too.

  Are you sure? yes | no

paul wrote 08/02/2018 at 12:00 point

this tool is great but it outputs the svg into the browser, how do I download it?

  Are you sure? yes | no

Florian Festi wrote 08/02/2018 at 16:01 point

Just right click and "save as"

  Are you sure? yes | no

dejan.k wrote 06/26/2018 at 08:13 point

Hello, absolutly fenomenal work, thank you very much, you shoud think about adding a feature to universal box top_edge edge with hinges and click on, on other side so it closes :) 

  Are you sure? yes | no

Florian Festi wrote 08/03/2018 at 11:32 point

The click-on edge probably deserves some more love before that becomes really feasible. But adding lock and latches to the lids is on my todo list. To my shame I have to admit that I hand drew a pair of latches for the box I recently build...

  Are you sure? yes | no

Cristian wrote 06/04/2018 at 16:44 point

Hello people... Mr. Florian, your application it is of great help, thank you very much!!! if you are interested i have a kinda new project for you. Letter shaped boxes with and without lid. Those are used for led lighting lettes and so. 

  Are you sure? yes | no

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/ 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 running on Windows and I'll do the coding for you (see ). 

  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

Florian Festi wrote 08/06/2018 at 17:53 point

OK, I finally did just that. Instead of offering full control over where exactly to split the wall I just used a param allowing values from 1 to 4. This allows to split:

* front only

* front and back

* front and right and back

* all four sides

The new code is already online. Please double check before laser cutting. The change isn't entirely trivial.

  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 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: 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 locally and also install ps2edit. Then 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, I've had some success with the following Illustrator workflow:

1) Save 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